Ejemplo n.º 1
0
        //检查软件使用次数是否超过10次
        private bool checkTrialTimes()
        {
            GeneralClass.printWarningMsg("您现在使用的是试用版,可以免费使用10次;");
            int tLong = 0;

            try
            {
                tLong = (int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0);
                GeneralClass.printWarningMsg("您已经使用了" + tLong + "次!");
            }
            catch
            {
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0, RegistryValueKind.DWord);
            }
            if (tLong < 10)
            {
                int tTimes = tLong + 1;
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", tTimes);
                return(true);
            }
            else
            {
                if (GeneralClass.printAskMsg("试用次数已到!您是否需要注册?") != DialogResult.Yes)
                {
                    return(false);
                }
                RegisterForm regForm = new RegisterForm(db);
                if (regForm.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                return(true);
            }
        }
Ejemplo n.º 2
0
 //检查软件使用次数是否超过10次
 private bool checkTrialTimes()
 {
     GeneralClass.printWarningMsg("您现在使用的是试用版,可以免费使用10次;");
     int tLong = 0;
     try
     {
         tLong = (int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0);
         GeneralClass.printWarningMsg("您已经使用了" + tLong + "次!");
     }
     catch
     {
         Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0, RegistryValueKind.DWord);
     }
     if (tLong < 10)
     {
         int tTimes = tLong + 1;
         Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", tTimes);
         return true;
     }
     else
     {
         if (GeneralClass.printAskMsg("试用次数已到!您是否需要注册?") != DialogResult.Yes)
             return false;
         RegisterForm regForm = new RegisterForm(db);
         if (regForm.ShowDialog() != DialogResult.OK)
             return false;
         return true;
     }
 }
Ejemplo n.º 3
0
        //对话框载入
        private void LogIn_Load(object sender, EventArgs e)
        {
            if (!RegisterForm.registered())
            {
                hasRegistered = false;
            }

            if (hasRegistered)
            {
                register.Visible = false;
            }
            else if (!hasRegistered && !checkTrialTimes())
            {
                okBtn.Enabled = false;
            }

            read_users();
            id.Items.AddRange(idList.ToArray());
            if (id.Items.Count != 0)
            {
                id.Text = id.Items[0].ToString();
            }
        }