Downloading and Preparing the Sample
- Visual Studio 2008 or better
- DeployLX 4.1 or 5.0
- SQL Server Express CE 3.5
Download the sample files, save them to your desktop and extract the files. The starter kit includes both C# and Visual Basic versions. Navigate to the desired language and open the solution file.
The license files and projects have been protected with the default sample keys included with the DeployLX install. All references to the licensing runtime assume that DeployLX was installed to the default location on a 32-bit machine. If you're running a 64-bit OS, or you've installed DeployLX to a different location, you'll need to update the references to point to your installation.
See Building the Licensing Samples for details on updating the sample projects for your machine.
Using your DeployLX License
If you're exploring the trial version of DeployLX, the starter kit will work without changes. If you've purchased DeployLX and you're using the release version you must update the LicenseServer.asmx file to use the serial number issued by XHEO when you purchased.
- Open LicenseServer.asmx in code view
- Add your serial number to the DeployLxSerialNumbers array created in the constructor.
Exploring the Starter Kit
Generating Serial Numbers
The sample application is unlocked with a serial number. To generate a serial number for your installation
- Open DeployLX
- Select the Application Menu (Blue Shield) | Open and navigate to the folder and language where you extracted the starter kit.
- Navigate to the Licensed Windows Application Starter Kit folder and select the runtime.lic file.
- Select the Standard Edition license.
- Select Generate Code | Generate Serial Number.
- Select Generate.
The LicenseHelper class serves as a utility class for interacting with the DeployLX Licensing runtime. It was generated automatically by the Protect Project wizard in DeployLX. The default implementation works for the most common scenarios, and can be customized to meet individual application requirements.
When the application is started, the MainForm creates a new instance of the LicenseHelper class and invokes the Required method. The Required method in turn prepares a request to the licensing runtime and asks for a valid license. If a valid license cannot be found, then an exception is logged and thrown. If a valid license can be found, it is saved and used to expose properties of the license state. After a valid license has been obtained, the MainForm updates it's menu's and controls to reflect the license state.
For each page in the application that the user must have a license for, it must check for a valid license from DeployLX on each request. The ProtectedPage class serves as a base class to manage invoking the LicenseHelper on each request. By inheriting from ProtectedPage, the page will automatically request a license as needed.