Beispiel #1
0
        public frmStatus(string licenseFilename)
        {
            InitializeComponent();
            LicenseFilename = licenseFilename;
            ucHeading1.Text = "";
            BackColor       = Slyce.Common.Colors.BackgroundColor;
            string        message;
            List <string> machineIds = SlyceAuthorizer.GetMachineIds(out message);

            if (machineIds.Count > 0)
            {
                txtInstallationID.Text = machineIds[0];
            }
            else
            {
                MessageBox.Show(message, "Error Determining InstallationID", MessageBoxButtons.OK, MessageBoxIcon.Error);
                labelErrorMessage.Text    = message;
                labelErrorMessage.Visible = true;
            }
            PopulateLicenseStatus();
        }
Beispiel #2
0
        private void PopulateLicenseStatus()
        {
            string message;
            int    daysRemaining;
            bool   errorOccurred;
            bool   demo = false;

            SlyceAuthorizer.LockTypes     lockType;
            SlyceAuthorizer.LicenseStates status;
            bool licensed = SlyceAuthorizer.IsLicensed(LicenseFilename, out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status);

            if (errorOccurred)
            {
                labelErrorMessage.Text = "An error occurred with the Slyce licensing system. Please inform [email protected] about this error:\n\nError: " + message;
            }
            else if (licensed && !demo)
            {
                if (message.Length > 0)
                {
                    labelErrorMessage.Text = message;
                }
                labelStatus.Text     = "Licensed";
                buttonRemove.Enabled = true;
            }
            else if (licensed && demo)
            {
                labelStatus.Text     = string.Format("{0} days remaining of your extended trial.", daysRemaining);
                buttonRemove.Enabled = false;
            }
            else
            {
                switch (lockType)
                {
                case SlyceAuthorizer.LockTypes.Days:
                    labelStatus.Text = string.Format("{0} days remaining of your 30-day trial.", daysRemaining);
                    break;

                default:
                    labelStatus.Text = string.Format("{0} days remaining of your trial.", daysRemaining);
                    break;
                }
                labelStatus.Text     = string.Format("{0} days remaining of your trial.", daysRemaining);
                buttonRemove.Enabled = false;
            }
            if (licensed || demo)
            {
                Dictionary <string, string> licenseDetails = SlyceAuthorizer.AdditionalLicenseInfo;

                foreach (string key in licenseDetails.Keys)
                {
                    listDetails.Items.Add(new ListViewItem(new string[] { key, licenseDetails[key] }));

                    if (key.ToLower().Replace(" ", "") == "licensenumber")
                    {
                        LicenseNumber = licenseDetails[key];
                    }
                }
                if (licensed)
                {
                    txtSerial.Text = SlyceAuthorizer.Serial;
                }
                else
                {
                    txtSerial.Enabled = false;
                }
            }
        }