Using TurboActivate with C#
Before you can do anything you need to login to your LimeLM account (or sign up) and download the TurboActivate.zip. This zip contains the TurboActivate.dll & TurboActivate.exe along with source code examples.
Adding licensing & online activation to your app
After you've created a new product, go to the version page of the product you will be adding licensing to. You will need to do 2 things:
- Download the TurboActivate.dat file for the product version.
- Make a note of the Version GUID.
You'll be including the TurboActivate.dat file in the same folder as the TurboActivate.dll and TurboActivate.exe files and you'll use the Version GUID in your code as part of integrating TurboActivate within your app.
Set the "Platform target" to x86
For C# projects we recommend you set the "Platform target" to x86. If you do this, your app will be able to run on both 32-bit and 64-bit machines without having to do complex installation scripts.
To set the target platform to x86 first click the "Project -> [Project Name] Properties" menu in Visual Studio. Click the "Build" tab on the right hand side. Then choose x86 from the "Platform target" dropdown:

Make sure you set this for both your "Release" and "Debug" configurations.
Example project
Included in TurboActivate.zip is a simple example project. The TurboActivate.cs file contains all the functions you'll be using to add licensing, online-activation, and trial functionality to your app.
VersionGUID
You must set the TurboActivate.VersionGUID property before you use any TurboActivate functions. We recommend you set the VersionGUID property when your application first loads. You only need to set it once:
TurboActivate.VersionGUID = "Version GUID you copied earlier";
IsActivated()
The IsActivated() function simply checks if the user is activated and returns a boolean value.
UseTrial(), TrialDaysRemaining()
The UseTrial() function starts and/or revalidates the trial. The TrialDaysRemaining() function returns the number of days remaining in the trial. When TrialDaysRemaining() returns 0 you should disable your apps features and require them to activate. See the example project.
Note: Always call UseTrial() before calling TrialDaysRemaining().
if (TurboActivate.IsActivated())
{
mnuActDeact.Text = "Deactivate";
}
else
{
mnuActDeact.Text = "Activate...";
TurboActivate.UseTrial();
if (TurboActivate.TrialDaysRemaining() == 0)
{
//TODO: disable the features of your app
}
}
Learn more about using trials & trial extensions to win over prospective customers.
Activating your product
We recommend you use the TurboActivate.exe for entering product keys and activating your product. In the example project we show how to launch TurboActivate.exe and then check if the user is activated after it closes.
If you want to build your own interface then just use the CheckAndSavePKey(string pkey) and Activate() functions.
IsGenuine()
The IsGenuine() function connects to the LimeLM servers and reconfirms that your user's activation is valid. Using this function lets you retroactively revoke product keys. You do not need to (and should not) call IsGenuine() every time your application runs.
We recommend you call this function about every 90 days.
Also, if IsGenuine() throws an exception (particularly InternetException) it might be a result of the user blocking TurboActivate from checking with the servers. We recommend you handle this case by first warning the user that the genuine check failed, then disabling the features of your app after X failures.
Step-by-step walkthrough
Now we're going to walk you through each step you need to take in adding licensing, online activation, and timed-trials to your C# app. There are lots of ways you can add licensing to your app, but there are 2 popular styles:
- Separate versions of your app. This style of licensing is where you build 2 versions of your product: a trial version and a full version.
- Hybrid version of your app. This style of licensing is where your product is the trial version or the full version depending on whether the user is activated.
The first method (the separate versions method) is possible with TurboActivate, but we're not going to talk about it here because it's not very user friendly. Instead we'll talk about making your app a hybrid Full/Trial app. That is, your users will be able to use your app in "trial mode" until either the trial expires or they purchase a product key and use it to activate your app.
Step 1. Signup for LimeLM, download TurboActivate
If you haven't already signed up for LimeLM then sign up now. All plans have a 30-day free trial. Or, if you're just putting your toes in the water, there's even a free plan that has no time limit and doesn't require a credit card.
After you've created your account download TurboActivate.zip and extract it anywhere. After you extract it you'll find 3 folders:
- API: This folder contains all Windows source code examples. Inside this folder you'll find the "CSharp" project folder which contains the end-result of this tutorial. You'll also find the "TurboActivate.cs" file which you'll be adding to your app's project.
- x64: This folder contains the 64-bit version of TurboActivate. This version only runs on 64-bit versions of Windows.
- x86: This folder contains the 32-bit version of TurboActivate. This version runs on all versions of Windows. You'll be using this x86 version of TurboActivate with your application for this reason.
Step 2. Add TurboActivate to your project
Now you need to add TurboActivate to your app. Add "TurboActivate.cs" from the "CSharp" project you extracted from TurboActivate.zip. You do this by right clicking your project in Visual Studio and clicking "Add -> Existing Items..." and browsing for the "TurboActivate.cs" file:

Next we'll copy "TurboActivate.exe" and "TurboActivate.dll" from the x86 folder we extracted. Put these files in both your project's "Debug" and "Release" folders.
Step 3. Set the "Platform target" to x86
Since you'll be using the x86 version of TurboActivate you'll have to set the "Platform target" to x86. After you do this your app will be able to run on both 32-bit and 64-bit machines without having to do complex installation scripts.
To set the target platform to x86 first click the "Project -> [Project Name] Properties" menu in Visual Studio. Click the "Build" tab on the right hand side. Then choose x86 from the "Platform target" dropdown:

Make sure you set this for both your "Release" and "Debug" configurations.
Step 4. Create a new product in LimeLM
If you haven't already created a new product in LimeLM, do it now. You can change any value later, so don't worry about making a mistake.
Step 5. Download TurboActivate.dat
Go to your version page in LimeLM. Download the "TurboActivate.dat" file. Now copy this file to your app's "Release" and "Debug" folders.
Step 6. Version GUID
Now you need to set the version GUID in your application. You only need to do this once. In your form's constructor add the following line:
public Form1()
{
InitializeComponent();
TurboActivate.VersionGUID = "Paste GUID Here";
}
Replace the "Paste GUID Here" string with the Version GUID string your copied from your version page.
Step 7. Adding licensing functionality
There are many ways you can use TurboActivate to add licensing to your application. For this example we're going to keep it simple. The first thing you need to do is a new Activate/Deactivate menu to your form. You can name it anything you want — in this example we call it mnuActDeact:

After you've created the menu item, changed the name to mnuActDeact in the properties window, click the little lightning bold, then double click the "Click" event and Visual Studio will automatically generate the event code for you:

We'll come back to this menu later. Now, scroll up to your form constructor code and add a "bool" to save the "isActivated" and make a call to IsActivated:
bool isActivated;
public Form1()
{
InitializeComponent();
TurboActivate.VersionGUID = "Paste GUID Here";
isActivated = TurboActivate.IsActivated();
}
Now that we know whether the user is activated we can take one of 2 actions:
- Show the remaining trial days
- Enable all of the application features
But before we can do that we to make a few functions:
- ShowTrial(bool show)
- DisableAppFeatures()
- ReEnableAppFeatures()
In the ShowTrial method you can show how many trial days remain for the user. You can open the CSharp example from TurboActivate.zip if you want to see a full example. Here we'll set the activate menu text to either "Activate" or "Deactivate" and will disable the app features if there are no more trial days remaining:
void ShowTrial(bool show)
{
mnuActDeact.Text = show ? "Activate..." : "Deactivate";
if (show)
{
int trialDaysRemaining = 0;
try
{
TurboActivate.UseTrial();
// get the number of remaining trial days
trialDaysRemaining = TurboActivate.TrialDaysRemaining();
}
catch { }
// if no more trial days then disable all app features
if (trialDaysRemaining == 0)
DisableAppFeatures();
}
}
Now you can add the functions to your code to disable and enable your application features:
void DisableAppFeatures()
{
//TODO: disable all the features of the program
}
void ReEnableAppFeatures()
{
//TODO: re-enable all the features of the program
}
In the example CSharp project the app "feature" we enable/disable is the text box. Obviously you need to tailor this to your specific application.
Now that we have the foundation set we can actually start calling these functions. Scroll back up to the form's constructor and add the following code:
public Form1()
{
InitializeComponent();
TurboActivate.VersionGUID = "Paste GUID Here";
isActivated = TurboActivate.IsActivated();
ShowTrial(!isActivated);
}
Now we need to handle when the user clicks the Activate/Deactivate menu that you created earlier. Scroll down to the "mnuActDeact_Click" function that Visual Studio generated for you. You can add code to Deactivate if the user is activated, or launch TurboActivate.exe if the user isn't activated:
void mnuActDeact_Click(object sender, EventArgs e)
{
if (isActivated)
{
// deactivate product without deleting the product key
// allows the user to easily reactivate
TurboActivate.Deactivate(false);
isActivated = false;
ShowTrial(true);
}
else
{
//Note: you can launch the TurboActivate wizard or you can create you own interface
// launch TurboActivate.exe to get the product key from the user
Process TAProcess = new Process
{
StartInfo =
{
FileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "TurboActivate.exe")
},
EnableRaisingEvents = true
};
TAProcess.Exited += p_Exited;
TAProcess.Start();
}
}
void p_Exited(object sender, EventArgs e)
{
// remove the event
((Process) sender).Exited -= p_Exited;
// recheck if activated
if (TurboActivate.IsActivated())
{
// the UI thread is running asynchronous to TurboActivate closing
// that's why we can't call TAIsActivated(); directly
Invoke(new TAIsActivatedDelegate(TAIsActivated));
}
}
delegate void TAIsActivatedDelegate();
void TAIsActivated()
{
isActivated = true;
ReEnableAppFeatures();
ShowTrial(false);
}
