Version 8.0 of the Manco .NET Licensing System supports license protection of the .NET Windows Store Applications. It provides separate protection library which can be used with this kind of applications.
I suppose that you have read section “Online product activation” in our product documentation already. So I describe only things are specific for the Windows Store Application in this article.
First of all you should keep in mind that Windows Store Application has not access to the traditional protected storage locations are used by our system in .NET Framework applications: Windows Registry and IsolatedStorage. So protection library uses another approach in this case. To make it possible for License Manager to clear protected storage you should inform it that this is Windows Store Application:
Next, you should use special edition of the protection library designed for the Windows Store Applications. You can find it here: in the InstallationPath/DLL/WinStore/Manco.Licensing.dll where InstallationPath depends on your OS:
The next difference is the asynchronous nature of the Windows Store Application. To call Activation Web Service you should use asynchronous calls provided with AwsHelper class. For example, to activate license you can use following method:
// If "Unlock Key" has been entered
if (this.UnlockKey.Trim() != string.Empty)
{
string message = null;
MainPage.ActivationServiceUrl);
string activationKey = await helper.ActivateProductGetKeyAsync(false);
// AWS has been called
m_bAWSCalled = true;
txtActivationKey.Text = activationKey;
await MainPage.ShowMessage(
"Activation Key has been succesfully"
+ " generated and passed to the text box."
+ " Click OK to continue.");
}
}
catch (Exception exc)
{
message = MainPage.ProcessException(exc);
}
await MainPage.ShowMessage(message);
}
}
else
{
await MainPage.ShowMessage("Enter Unlock Key to be able activate product");
}
}
' If "Unlock Key" has been entered
If Me.UnlockKey.Trim() <> String.Empty Then
Dim message As String = Nothing
MainPage.ActivationServiceUrl)
m_bAWSCalled = True
txtActivationKey.Text = activationKey
Await MainPage.ShowMessage( _
"Activation Key has been succesfully" _
& " generated and passed to the text box." _
& " Click OK to continue.")
End If
Catch exc As Exception
message = MainPage.ProcessException(exc)
End Try
End If
Else
Await MainPage.ShowMessage("Enter Unlock Key to be able activate product")
End If
End Sub
You can find sample solution which demonstrates protection of the Windows 8 Store Application on our official site at http://www.mancosoftware.com/licensing/download.htm
I suppose that you have read section “Online product activation” in our product documentation already. So I describe only things are specific for the Windows Store Application in this article.
First of all you should keep in mind that Windows Store Application has not access to the traditional protected storage locations are used by our system in .NET Framework applications: Windows Registry and IsolatedStorage. So protection library uses another approach in this case. To make it possible for License Manager to clear protected storage you should inform it that this is Windows Store Application:
Next, you should use special edition of the protection library designed for the Windows Store Applications. You can find it here: in the InstallationPath/DLL/WinStore/Manco.Licensing.dll where InstallationPath depends on your OS:
- For 32-bits OS it is “C:\Program Files\Manco Software\Manco .NET Licensing System”.
- For 64-bits OS it is “C:\Program Files (x86)\Manco Software\Manco .NET Licensing System”.
The next difference is the asynchronous nature of the Windows Store Application. To call Activation Web Service you should use asynchronous calls provided with AwsHelper class. For example, to activate license you can use following method:
C#
private async void ActivateLicense(object sender, RoutedEventArgs e)
{// If "Unlock Key" has been entered
if (this.UnlockKey.Trim() != string.Empty)
{
string message = null;
// Pass "Unlock
Key" to the license object
this.license.UnlockKey = this.UnlockKey.Trim();
AwsHelper helper = new AwsHelper(
this.license, MainPage.ActivationServiceUrl);
try
{string activationKey = await helper.ActivateProductGetKeyAsync(false);
if (!string.IsNullOrEmpty(activationKey))
{// AWS has been called
m_bAWSCalled = true;
txtActivationKey.Text = activationKey;
await MainPage.ShowMessage(
"Activation Key has been succesfully"
+ " generated and passed to the text box."
+ " Click OK to continue.");
}
}
catch (Exception exc)
{
message = MainPage.ProcessException(exc);
}
if (!string.IsNullOrEmpty(message))
{await MainPage.ShowMessage(message);
}
}
else
{
await MainPage.ShowMessage("Enter Unlock Key to be able activate product");
}
}
VB.NET
Private Async Sub ActivateLicense(sender As Object, e As RoutedEventArgs)' If "Unlock Key" has been entered
If Me.UnlockKey.Trim() <> String.Empty Then
Dim message As String = Nothing
' Pass "Unlock
Key" to the license object
Me.license.UnlockKey = Me.UnlockKey.Trim()
Dim helper As AwsHelper = New AwsHelper( _
Me.license, _MainPage.ActivationServiceUrl)
Try
Dim activationKey As String = Await
helper.ActivateProductGetKeyAsync(False)
If Not String.IsNullOrEmpty(activationKey) Then
' AWS has been calledm_bAWSCalled = True
txtActivationKey.Text = activationKey
Await MainPage.ShowMessage( _
"Activation Key has been succesfully" _
& " generated and passed to the text box." _
& " Click OK to continue.")
End If
Catch exc As Exception
message = MainPage.ProcessException(exc)
End Try
If Not String.IsNullOrEmpty(message) Then
Await MainPage.ShowMessage(message)End If
Else
Await MainPage.ShowMessage("Enter Unlock Key to be able activate product")
End If
End Sub
You can find sample solution which demonstrates protection of the Windows 8 Store Application on our official site at http://www.mancosoftware.com/licensing/download.htm