Esempio n. 1
0
        /// <summary>Displays <see cref="NetworkLicenseBrowseForm"/> Initializes licensing objects.</summary>
        private void InitializeLicensingObjects()
        {
            using (NetworkLicenseBrowseForm dialog = new NetworkLicenseBrowseForm())
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    LicenseConfiguration.LicenseFilePath = dialog.SelectedPath;
                }
                else
                {
                    Environment.Exit(0);
                }
            }

            //Initialize the license object.
            m_License = SampleLicense.CreateNewLicense(sampleLicensingGui);

            //Now pass the initialized license object to the LicenseingGui component.
            sampleLicensingGui.ApplicationLicense = m_License;

            //Configure the LicensingGui component with the trigger code seed data (only applicable with writable/self-signed licenses).
            sampleLicensingGui.TriggerCodeSeed = LicenseConfiguration.TriggerCodeSeed;
            sampleLicensingGui.RegKey2Seed     = LicenseConfiguration.RegKey2Seed;

            //Wire-up event handlers for the LicensingGui component.  Although this is typically done in the designer, this sample code intentionally
            //initializes to a) make it easier for you to copy-and-paste; and b) prevent the sample functions referenced here from being deleted when
            //the event handlers are changed in the designer.
            sampleLicensingGui.LicenseManagementActionComplete += new EventHandler <LicenseManagementActionCompleteEventArgs>(PostProcessingUpdates);
            sampleLicensingGui.ManualActionLoadRequested       += new EventHandler <ManualActionLoadRequestedEventArgs>(ManualActionLoadRequested);
            sampleLicensingGui.ManualActionSaveRequested       += new EventHandler <ManualActionSaveRequestedEventArgs>(ManualActionSaveRequested);
            sampleLicensingGui.SplashDoWork            += new EventHandler <EventArgs>(InitializeApplicationSettings);
            sampleLicensingGui.SplashWorkCompleteEvent += new EventHandler <EventArgs>(SplashWorkCompleted);
        }
Esempio n. 2
0
        /// <summary>Main form Load event handler</summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            using (NetworkLicenseBrowseForm browseDlg = new NetworkLicenseBrowseForm())
            {
                if (browseDlg.ShowDialog() == DialogResult.OK)
                {
                    LicenseConfiguration.LicenseFilePath = browseDlg.SelectedPath;
                }
                else
                {
                    Application.Exit();
                }
            }

            m_License = new SampleLicense();

            if (m_License.LastError.ErrorNumber == LicenseError.ERROR_PLUS_EVALUATION_WARNING)
            {
                MessageBox.Show("Warning: (" + m_License.LastError.ErrorNumber + ") " + m_License.LastError.ErrorString, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            ReloadLicense();
        }