1. Take the steps described in Integrate DevMateKit if you haven't done it yet.
  2. Add the following properties to DMFrameworkSettings:
DMFrameworkSettings.PublickRSAKey = @"-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzRWGeVD5D1FDuRhpSKzU P19hTLUNE0AHZHjdU05AZOUa8gxlCfMSHjsuM95dtk2Z+Pgd9Vq1OTGrYhav9jZP xUMdtHcinyAnXjAz2hgSSb3/1qrXPxaSoG05x8LPTEN5RYxal6PorRDGOAvG8sgN /nHIBmylZMpQOegWo8JppIpKHEfii23JcGuXkoo/oen33TQq5y/HhWWRKfxVbnGx RnD25WAOcWpvg+H2gWVrfLwRAu9GK0yGBhOhbgKsfO056NAwfM02HhRAtwfC7Xhc ID6kPWp/qThVLSfGhwXkUNwAxfCHh/5dH2rF/xfCAhvfBhxLYx7Njg3Ana/Ybo1L 5wIDAQAB -----END PUBLIC KEY-----";
DMFrameworkSettings.IsFirstRun = false;



On first clean run of the application, the IsFirstRun property must be set to “true”.
Also note that you must specify PublickRSAKey to enable the Activation functionality. A unique key is provided by DevMate's Add Application wizard on the Configure Activation step.

  1. You can specify additional DMFrameworkSettings properties if needed. DevMate Activation provides the following configuration options:
IsFirstRunboolProperty (bool) must be set to “true” on first clean run of the application. In this case, DevMate will receive a report from the application that contains data on the first actual launch of the app.
IsBetaboolSpecifies whether a current version of the application is Beta.
URLActivationSchemastringUsed for running the application by the URL Scheme. For more details, read Configure Activation via URL Scheme.
StoreAdditionalParametersDictionary<string,string>Configures additional GET parameters for your Store Link.
ApplicationIconstringSets a “TitleBar” icon for DevMate Framework windows. Must contain at least one 16x16pt icon. Example: pack://application:,,,/TestApp;component/icon.ico.
  1. Configure a trial mode of an application.
    Use the following code snippet to disable the trial mode in the Activation window:
DMActivationWindow window = new DMActivationWindow(); 
window.BigIconSource = new BitmapImage(new Uri(“pack://application:,,,/Images/icon.png")); 

Use the following code snippet to enable the trial mode in the Activation window (make sure you've specified DMFrameworkSettings.TrialType before:

DMActivationWindow window = new DMActivationWindow(true); window.BigIconSource = new BitmapImage(new Uri(“pack://application:,,,/Images/icon.png")); 

Note that you must use 128x128pt icon for the BigIconSource property.
If you want to open “DMActivationWindow” on the Enter Activation Key screen, set the following property to “true” before calling ShowDialog():

window.ShowEnterActivationNumberScreenAtStart = true

Configuring Activation via URL Scheme (optional)

  1. Register the URL scheme on the client PC by creating the following registry keys and values:
	Set the default value to “URL [Application_Name] Activation Protocol”.
	Create an empty string value in HKEY_CLASSES_ROOT\[URL_Schema_Name] with the 	name "URL Protocol”.
	Set the default value to "[PATH_TO_MAIN_APPLICATION_EXE]" “%1”



You need the administrator’s permissions to complete this action. You can get these permissions during installation process.

  1. Add the following code snippet to your application (it processes command line arguments):
DMFrameworkSettings.URLActivationSchema = [URL_Schema_Name];
bool fromURL = ActivationFramework.Current.IsRunUsingURLSchema();
if (fromURL)
    DMActivationWindow window = new DMActivationWindow( ActivationFramework.Current.GetKeyFromURLSchema());
    window.BigIconSource = new BitmapImage(new Uri(“pack://application:,,,/Images/icon.png”));



Read Registering an Application to a URI Scheme (MSDN) to find out more.

Configuring Activation API

Activation API contains the following properties that must be obtained through FindDelegate method:

public class DelegateType
    public const int IsActivated;
    public const int LicenseInformation;
    public const int Activate;
    public const int StartTrial;
    public const int GetTrial;
    public const int GetRawTrialValue;
    public const int GetStoreLink;


If you use the IsActivated property, the method verifies whether the application is activated.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.IsActivated) as Func<int>;
int isActivated = func.Invoke();

Possible results are the following:

  • 0 - not activated
  • 1 - activated
  • 2 - expired


If you use the LicenseInformation property, the method verifies the license information by comparing it to the user information from DevMate.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.LicenseInformation) as Func<int, object>;
string ActivationIdKey = func.Invoke(LicenseInformationKeys.ActivationIdKey).ToString();
string UserName = func.Invoke(LicenseInformationKeys.UserNameKey).ToString();
string UserEmail = func.Invoke(LicenseInformationKeys.UserEmailKey).ToString();
long ActivationDate = Convert.ToInt64(func.Invoke(LicenseInformationKeys.ActivationDateKey));
long ExpirationDate = Convert.ToInt64(func.Invoke(LicenseInformationKeys.ExpirationDateKey));
string ExpirationVersion = func.Invoke(LicenseInformationKeys.ExpirationVersionKey).ToString();
string ActivationTag = func.Invoke(LicenseInformationKeys.ActivationTagKey).ToString();
bool IsBetaOnly = Convert.ToBoolean(func.Invoke(LicenseInformationKeys.BetaOnlyKey));

UserName and UserEmail values are not null/empty only if a user specified them during license activation. It becomes possible when an activation number has the pattern idu. Entering this kind of an activation number opens an extended activation dialog with mandatory user name and email fields.
ExpirationVersion value specifies the ultimate application version covered by the current license. An owner of this license is not eligible for upgrade to versions higher than the specified one.


If you use the Activate property, the method sends user data to DevMate to register (activate) a license.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.Activate) as Func<string, string, string, bool?, long>; Task.Factory.StartNew(() => 
      return func.Invoke(ActivationCode, UserName, UserEmail, KeepUpToDate);  }).ContinueWith((result) => 
      var activationResult = (ActivationResult)Marshal.PtrToStructure(new IntPtr(result.Result), typeof(ActivationResult));
      if (activationResult.Success)
      {         //Show Success Screen
          ErrorText = activationResult.Error;


If you use the StartTrial property, the method sends a report about the beginning of a trial period when a user clicks the Start Trial button.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.StartTrial) as Func<long, bool>;
TrialType trialType = new TrialType() { DMTrialWeek = true };   

IntPtr trialIntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(trialType));
Marshal.StructureToPtr(trialType, trialIntPtr, true);
long timeTrialRef = (long)trialIntPtr;   

bool res = func.Invoke(timeTrialRef);

TrialType class includes the following properties:

public bool DMTrialDay { get; set; }
public bool DMTrialWeek { get; set; }
public bool DMTrialTwoWeeks { get; set; }
public bool DMTrialMonth { get; set; }
public bool DMTrialYear { get; set; }

public bool DMCustom { get; set; }
public long DMTrialPeriond { get; set; }

Please note that only one of the “TrialType” properties can be set to “true” at a time. If more than one property is set to “true”, DevMate will use only the last one applied.
If DMCustom is set to “true", DMTrialPeriond is used. If DMCustom is set to “true” and DMTrialPeriond is not set, the default value is used (86400 seconds).


If you use the GetTrial property, the method returns total duration of a trial period (in hours) and the number of hours that is already spent in the trial mode.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.GetTrial) as Func<Tuple<int,int>>;
var trialInfo = func.Invoke();

if (trialInfo.Item1 == -1 || trialInfo.Item2 == -1) 
  //Trial not started 
TrialPeriod = trialInfo.Item2; //In hours  
PassedTrial = trialInfo.Item1; //In hours 


If you use the GetRawTrialValue property, the method returns total duration of a trial period (in seconds) and its expiration date (UNIX timestamp).

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.GetRawTrialValue) as Func<Tuple<long,long>>;
var trialInfo = func.Invoke();

if (trialInfo.Item1 == -1 || trialInfo.Item2 == -1) 
  //Trial not started 
  TrialPeriod = trialInfo.Item2; //In seconds
  TrialExpireDate = trialInfo.Item1; //In UNIX timestamp 


If you use the GetTrialTimeRemained property, the method returns a total number of seconds left till the end of a trial period.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.GetTrialTimeRemained) as Func<long>;
var trialInfo = func.Invoke();
if (trialInfo==-1)
 //Trial not started
 TrialPeriodRemained = trialInfo ; //In seconds


If you use the GetStoreLink property, the method returns a link to the store where a user can buy a license.

var func = ActivationFramework.Current.FindDelegate((int) DelegateType.GetStoreLink) as Func<string>; 
string storeLink = func.Invoke(); 
Process.Start(storeLink); //Open link in default browser

Note that you can add GET parameters to the link by using this method:

DMFrameworkSettings.StoreAdditionalParameters.Add("key", “value");