示例#1
0
        private void BtnEnterKey_Click(object sender, EventArgs e)
        {
            FrmKey fKey = new FrmKey();

            fKey.Title = "请输入密码解锁";
            fKey.ShowDialog();
            if (fKey.DialogResult == DialogResult.OK)
            {
                Key = fKey.Key;
                ShowMsg("解锁成功!现在是:{0}", DateTime.Now.ToString());
                Init();
            }
        }
示例#2
0
        private void BtnModifyKey_Click(object sender, EventArgs e)
        {
            string pwd1;
            string pwd2;

            FrmKey fKey = new FrmKey();

            fKey.Title = "请输入新的密码:";
            fKey.ShowDialog();
            if (fKey.DialogResult == DialogResult.OK)
            {
                pwd1       = fKey.Key;
                fKey       = new FrmKey();
                fKey.Title = "请再次输入新密码";
                fKey.ShowDialog();
                if (fKey.DialogResult == DialogResult.OK)
                {
                    pwd2 = fKey.Key;
                    if (pwd1 == pwd2)
                    {
                        this.Key = pwd2;
                        ShowMsg("密码修改成功!将在下次启动软件生效。");
                    }
                    else
                    {
                        ShowMsg("两次密码不一样!");
                    }
                }
                else
                {
                    ShowMsg("操作取消了 pwd2");
                }
            }
            else
            {
                ShowMsg("操作取消了 pwd1");
            }
        }