您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

51 行
1.6 KiB

  1. using HKLib.Logic;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace HKCardManager.UserPages
  12. {
  13. public partial class InstitutionalEntryPage : UserControl
  14. {
  15. public InstitutionalEntryPage()
  16. {
  17. InitializeComponent();
  18. //this.SizeChanged += InstitutionalEntryPage_SizeChanged;
  19. }
  20. //private void InstitutionalEntryPage_SizeChanged(object? sender, EventArgs e)
  21. //{
  22. // this.panel1.Left = (this.Width - this.panel1.Width) / 2;
  23. // this.panel1.Top = (this.Height - this.panel1.Height) / 2;
  24. //}
  25. private void button2_Click(object sender, EventArgs e)
  26. {
  27. string name = this.textBox1.Text.Trim();
  28. if (string.IsNullOrEmpty(name))
  29. {
  30. MessageLogNotify.GetInstance.ShowWarning("请输入机构名称");
  31. return;
  32. }
  33. Task.Factory.StartNew(() =>
  34. {
  35. this.Invoke(() => { button2.Enabled = false; });
  36. if (ServiceHandler.AddOrg(name))
  37. {
  38. Global.OrgList.Add(name);
  39. MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功");
  40. }
  41. else
  42. MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试");
  43. this.Invoke(() => { button2.Enabled = true; });
  44. });
  45. }
  46. }
  47. }