Beispiel #1
0
        void BtnGetLic_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <License> listLicenses = new List <License>();
                License        lic          = new License();
                lic.Name         = "UserNumber";
                lic.SerialNo     = 1100001;
                lic.Expiration   = LicDefines.KEYWORD_LICENSE_EXPIRATION_UNLIMITED;
                lic.Type         = LicOwnerType.Mono;
                lic.DataType     = LicDataType.Number;
                lic.MajorID      = 0;
                lic.MinorID      = 1;
                lic.RequestValue = "100";
                lic.Value        = "0";
                listLicenses.Add(lic);
                lic              = new License();
                lic.Name         = "OnlineUserNumber";
                lic.SerialNo     = 1100002;
                lic.Expiration   = LicDefines.KEYWORD_LICENSE_EXPIRATION_UNLIMITED;
                lic.Type         = LicOwnerType.Mono;
                lic.DataType     = LicDataType.Number;
                lic.MajorID      = 0;
                lic.MinorID      = 1;
                lic.RequestValue = "1000";
                lic.Value        = "0";
                listLicenses.Add(lic);

                if (mLicHelper != null)
                {
                    mLicHelper.Stop();
                    mLicHelper = null;
                }
                mLicHelper                 = new LicenseHelper();
                mLicHelper.Debug          += (mode, cat, msg) => AppendMessage(string.Format("{0}\t{1}", cat, msg));
                mLicHelper.LicInfoChanged += mLicHelper_LicInfoChanged;
                mLicHelper.Host            = "192.168.4.182";
                mLicHelper.Port            = 3070;
                mLicHelper.ClearLicense();
                for (int i = 0; i < listLicenses.Count; i++)
                {
                    mLicHelper.ListLicenses.Add(listLicenses[i]);
                }
                mLicHelper.Start();
                AppendMessage("End");
            }
            catch (Exception ex)
            {
                AppendMessage(string.Format("Fail.\t{0}", ex.Message));
            }
        }
Beispiel #2
0
 void MainWindow_Closing(object sender, CancelEventArgs e)
 {
     if (mLicConnector != null)
     {
         mLicConnector.Close();
         mLicConnector = null;
     }
     if (mLicChecker != null)
     {
         mLicChecker.Close();
         mLicChecker = null;
     }
     if (mLicHelper != null)
     {
         mLicHelper.Stop();
         mLicHelper = null;
     }
 }