Esempio n. 1
0
        /// <summary>Activates the license online.</summary>
        /// <param name="licenseId">The License ID issued by SOLO Server.</param>
        /// <param name="password">The customer password.</param>
        /// <returns>Returns true if the system was activated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why activation failed.</returns>
        internal bool ActivateOnline(Int32 licenseId, string password)
        {
            string licenseContent = "";

            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            //activate online using our endpoint configuration from app.config -- licenseContent may be disregarded, as the WritableLicense object's properties will be populated
            if (!this.ActivateInstallationLicenseFile(licenseId, password, ws, ref licenseContent))
            {
                return(false);
            }

            //Load our new license content
            if (!this.Load(licenseContent))
            {
                return(false);
            }

            //write the updated contents of the license file and aliases
            int filesToWrite, filesWritten;

            this.WriteAliases(out filesToWrite, out filesWritten);
            return(this.WriteLicenseFile(LicenseConfiguration.LicenseFilePath));
        }
        /// <summary>Activates the license online.</summary>
        /// <param name="licenseId">The License ID issued by SOLO Server.</param>
        /// <param name="password">The customer password.</param>
        /// <returns>Returns true if the system was activated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why activation failed.</returns>
        public bool ActivateOnline(Int32 licenseId, string password)
        {
            string licenseContent = "";

            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            //activate online using our endpoint configuration from app.config
            if (!this.ActivateInstallationLicenseFile(licenseId, password, ws, ref licenseContent))
            {
                return(false);
            }

            return(this.SaveLicenseFile(licenseContent));
        }