CNAS取数仪器端升级
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

79 lignes
2.2KB

  1. using CnasSynchronousCommon;
  2. using CnasSynchronusClient;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace CNAS_DBSync
  12. {
  13. public partial class frmOperationPwd : Form
  14. {
  15. public frmOperationPwd()
  16. {
  17. InitializeComponent();
  18. }
  19. private void btnOK_Click(object sender, EventArgs e)
  20. {
  21. Config();
  22. }
  23. public void Config()
  24. {
  25. //获取本地存储的操作密码
  26. string strPwd = FileOperation.GetLocalOperationPwd();
  27. if (this.txtOldPwd.Text.Trim() == strPwd)
  28. {
  29. this.DialogResult = DialogResult.OK;
  30. this.Close();
  31. }
  32. else
  33. {
  34. MessageBox.Show("密码无效.");
  35. }
  36. }
  37. private void frmOperationPwd_KeyDown(object sender, KeyEventArgs e)
  38. {
  39. try
  40. {
  41. if (!btnOK.Focused)
  42. {
  43. FormKeyEventClass fke = new FormKeyEventClass();
  44. fke.FormKeyEvent += new FormKeyEventClass.FormKey(Config);
  45. fke.FormKeyEventRun(e);
  46. }
  47. }
  48. catch (Exception ex)
  49. {
  50. AppLog.Error(ex.Message.ToString());
  51. }
  52. }
  53. [System.Runtime.InteropServices.DllImport("user32.dll")]
  54. public static extern bool ReleaseCapture();
  55. [System.Runtime.InteropServices.DllImport("user32.dll")]
  56. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  57. public const int WM_SYSCOMMAND = 0x0112;
  58. public const int SC_MOVE = 0xF010;
  59. public const int HTCAPTION = 0x0002;
  60. private void frmOperationPwd_MouseDown(object sender, MouseEventArgs e)
  61. {
  62. try
  63. {
  64. ReleaseCapture();
  65. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  66. }
  67. catch (Exception ex)
  68. {
  69. AppLog.Error(ex.Message.ToString());
  70. }
  71. }
  72. }
  73. }