Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            DemoLicense.LicenseTrialTerminated += DemoLicense_LicenseTrialTerminated;
            DemoLicense.LicenseLogEntry        += DemoLicense_LicenseLogEntry;

            DemoLicense.InitializeSDK();

            try
            {
                WriteLog($"Attempting to load license from {DemoLicense.LicenseFilePath}");
                _license = DemoLicense.GetLicenseFromFile(DemoLicense.LicenseFilePath);

                if (_license != null)
                {
                    var licenseStatus = _license.CheckLicense();
                    if (licenseStatus == DemoLicense.LicenseStatus.ValidNoTimeRestriction)
                    {
                        Lb_TimeLeft.Text = $"LICENSE IS VALID WITH NO TIME RESTRICTIONS";
                        GetTimeleftTimer.Stop();
                    }
                    else if (licenseStatus == DemoLicense.LicenseStatus.TrialStillActive)
                    {
                        WriteLog($"Your license has not been validated, you are running a trial of {_license.DaysAllowed} days.");
                    }
                    else if (licenseStatus == DemoLicense.LicenseStatus.NotValid || licenseStatus == DemoLicense.LicenseStatus.TrialTerminated)
                    {
                        WriteLog($"License needs validation.");
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog($"{ex}");
            }
        }
Exemplo n.º 2
0
 private void DemoLicense_LicenseTrialTerminated(string info)
 {
     WriteLog(info);
     GetTimeleftTimer.Stop();
     Lb_TimeLeft.Text = info;
 }