PromptForm.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace PMSUI
  11. {
  12. public partial class PromptForm : Form
  13. {
  14. private const string PASSWORD = "casun36689";
  15. /// <summary>
  16. ///开设置窗口事件
  17. /// </summary>
  18. public static System.Action<int> OpenAction { get; set; }
  19. public PromptForm()
  20. {
  21. InitializeComponent();
  22. }
  23. private void btConfirm_Click(object sender, EventArgs e)
  24. {
  25. if (txtPassword.Text == PASSWORD)
  26. {
  27. this.Close();
  28. if (OpenAction != null)
  29. {
  30. OpenAction(1);
  31. }
  32. }
  33. else
  34. {
  35. MessageBox.Show("密码错误!");
  36. }
  37. }
  38. private void txtPassword_KeyDown(object sender, KeyEventArgs e)
  39. {
  40. if (e.KeyCode == Keys.Enter)
  41. {
  42. this.btConfirm_Click(sender, e);
  43. }
  44. }
  45. }
  46. }