Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                bool isRegistered = false;
                if (!File.Exists(MainApp.Properties.Settings.Default.LicenseFilePath))
                {
                    var license = new LicenseAgreement();
                    license.ShowDialog();
                    isRegistered = license.IsRegistered;
                }
                else
                {
                    string info = File.ReadAllText(MainApp.Properties.Settings.Default.LicenseFilePath);
                    isRegistered = LicenseKeyHelper.IsGenuine(info);
                    if (!isRegistered)
                    {
                        var license = new LicenseAgreement();
                        license.ShowDialog();
                        isRegistered = license.IsRegistered;
                    }
                }

                if (isRegistered)
                {
                    base.OnStartup(e);
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show("There are error occur in application, please contact with admin!", ex.ToString());
            }
        }
Example #2
0
        private void OnRegister(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtLicense.Text))
            {
                RadMessageBox.Show(AppCommonResource.LicenseFailMessage);
                return;
            }
            if (!LicenseKeyHelper.IsGenuine(txtLicense.Text))
            {
                RadMessageBox.Show(AppCommonResource.LicenseFailMessage);
                return;
            }

            RadMessageBox.Show(AppCommonResource.RegisterSuccess);
            File.WriteAllText(Properties.Settings.Default.LicenseFilePath, txtLicense.Text);
            IsRegistered = true;
            Close();
        }
Example #3
0
 public LicenseAgreement()
 {
     InitializeComponent();
     txtKey.Text = LicenseKeyHelper.Value();
 }