|
- using HKLib.Logic;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
-
- namespace HKCardManager.UserPages
- {
- public partial class InstitutionalEntryPage : UserControl
- {
- public InstitutionalEntryPage()
- {
- InitializeComponent();
- //this.SizeChanged += InstitutionalEntryPage_SizeChanged;
- }
-
- //private void InstitutionalEntryPage_SizeChanged(object? sender, EventArgs e)
- //{
- // this.panel1.Left = (this.Width - this.panel1.Width) / 2;
- // this.panel1.Top = (this.Height - this.panel1.Height) / 2;
- //}
-
- private void button2_Click(object sender, EventArgs e)
- {
- string name = this.textBox1.Text.Trim();
- if (string.IsNullOrEmpty(name))
- {
- MessageLogNotify.GetInstance.ShowWarning("请输入机构名称");
- return;
- }
- Task.Factory.StartNew(() =>
- {
- this.Invoke(() => { button2.Enabled = false; });
- if (ServiceHandler.AddOrg(name))
- {
- Global.OrgList.Add(name);
- MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功");
- }
- else
- MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试");
- this.Invoke(() => { button2.Enabled = true; });
- });
- }
- }
- }
|