コード例 #1
0
        public void AttemptLicense()
        {
            EncryptedLicenseProvider provider = new EncryptedLicenseProvider();
            EncryptedLicense         license  = provider.GetLicense(LicenseBO.ValidationParameters, GetLicenseFile());

            if (license != null)
            {
                MessageForm frm = new MessageForm();
                frm.Msg = "Your license is installed properly.  No further licensing is required.";
                frm.ShowDialog();
                return;
            }
            else
            {
                LicenseForm licfrm = new LicenseForm();
                license = licfrm.ShowDialog("Llama Carbon Copy", Properties.Settings.Default.Website, LicenseBO.GetLicenseFile());
                if (licfrm.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
                if (license != null)
                {
                    //congratulate
                    OnLicensed(EventArgs.Empty);
                    MessageForm frm = new MessageForm();
                    frm.Msg = "You have successfully installed your license.";
                    frm.ShowDialog();
                }
                else
                {
                    //ask if they want to try again
                    QuestionForm frm = new QuestionForm();
                    frm.Msg = "There was a problem creating your license.  Would you like to try again?";
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AttemptLicense();
                    }
                }
            }
        }
コード例 #2
0
        public bool IsActive()
        {
            EncryptedLicenseProvider provider = new EncryptedLicenseProvider();
            EncryptedLicense         license  = provider.GetLicense(LicenseBO.ValidationParameters, GetLicenseFile());

            if (license == null)
            {
                EvaluationMonitor monitor = new EvaluationMonitor("SpittingImage");
                if (monitor.DaysInUse > 15 || monitor.Invalid)
                {
                    QuestionForm frm = new QuestionForm();
                    frm.Msg = "Your trial license has expired.  Would you like to enter a license key to activate the software?";
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        LicenseForm licfrm = new LicenseForm();
                        license = licfrm.ShowDialog("Llama Carbon Copy", Properties.Settings.Default.Website, LicenseBO.GetLicenseFile());
                        if (license != null)
                        {
                            OnLicensed(EventArgs.Empty);
                        }
                    }
                }
                else
                {
                    MessageForm frm = new MessageForm();
                    frm.Msg = string.Format("You are on day {0} of your 15 day evaluation.", monitor.DaysInUse);
                    frm.ShowDialog();
                    return(true);
                }
            }
            if (license == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }