LaurelBridge.DCF.Examples.LicenseCheck Namespace
LAUREL BRIDGE

LaurelBridge.DCF.Examples.LicenseCheck Namespace

DICOM Connectivity Framework V3.4
The LicenseCheck example demonstrates how to check for and configure the DCF license.
Classes

  ClassDescription
Public classProgram
Example to show checking the license, and configuration of the license path.
Examples

LicenseCheck Sample Code
public class Program
{
    private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    public static void Main()
    {
        // Set the license file path to a bogus value to demonstrate failure
        Framework.LicenseFilePath = "Bogus";
        try
        {
            Framework.CheckLicense();
        }
        catch (DCFException e)
        {
            Logger.Info(e, "Expected bogus license failure message:");
        }

        // Now reset to expected default value systeminfo.txt
        Framework.LicenseFilePath = Framework.DefaultLicenseFileName;
        try
        {
            Framework.CheckLicense();
            string license = File.ReadAllText(Framework.LicenseFilePath);
            Logger.InfoFormat("License check passed:{0}{1}", Environment.NewLine, license);
        }
        catch (Exception e)
        {
            Logger.Error(e, "Unexpected license check failure:");
        }

        if (System.Diagnostics.Debugger.IsAttached)
        {
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
    }
}