|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using HKLib.DB;
- using HKCardManager.UserPages;
-
- namespace HKCardManager
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- splitContainer1.SplitterDistance = 240;
- Task.Factory.StartNew(() =>
- {
- DbContext.InitTable();
- });
- ShowPage(new PersonnelEntryPage());
- this.SizeChanged += Form1_SizeChanged;
- this.button1.SizeChanged += Button1_SizeChanged;
- MessageLogNotify.GetInstance.Info = new Action<string>((s) =>
- {
- this.Invoke(() =>
- {
- if (listBox1.Items.Count > 0)
- listBox1.Items.Insert(0, $"{DateTime.Now.ToString("HH:mm:ss")}{s}");
- else
- listBox1.Items.Add($"{DateTime.Now.ToString("HH:mm:ss")}{s}");
- });
- });
- }
-
- private void Button1_SizeChanged(object? sender, EventArgs e)
- {
- groupBox1.Width = button1.Width;
- groupBox2.Width = button1.Width;
- groupBox3.Width = button1.Width;
- groupBox4.Width = button1.Width;
-
- button2.Left = 10;
- button2.Width = (groupBox1.Width - 20);
-
- button3.Left = 10;
- button3.Width = (groupBox1.Width - 20);
-
- button4.Left = 10;
- button4.Width = (groupBox2.Width - 20);
-
- button5.Left = 10;
- button5.Width = (groupBox2.Width - 20);
-
- button6.Left = 10;
- button6.Width = (groupBox2.Width - 20);
-
- button7.Left = 10;
- button7.Width = (groupBox2.Width - 20);
-
- button9.Left = 10;
- button9.Width = (groupBox3.Width - 20);
-
- button10.Left = 10;
- button10.Width = (groupBox3.Width - 20);
-
- button11.Left = 10;
- button11.Width = (groupBox3.Width - 20);
-
- button12.Left = 10;
- button12.Width = (groupBox4.Width - 20);
- }
-
-
-
- UserControl tempUserControl;
- private void Form1_SizeChanged(object? sender, EventArgs e)
- {
- if (tempUserControl != null)
- {
- tempUserControl.Width = this.panel1.Width;
- tempUserControl.Height = this.panel1.Height;
- }
- splitContainer1.SplitterDistance = 240;
- }
-
- private void Ա¼ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new PersonnelEntry().ShowDialog();
- }
-
- private void ¼ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new InstitutionalEntry().ShowDialog();
- }
-
- private void ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new Hairpin().ShowDialog();
- }
-
- private void ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Cancellation cancellation = new Cancellation();
- cancellation.Text = "";
- cancellation.ShowDialog();
- }
-
- private void ʧToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Cancellation cancellation = new Cancellation();
- cancellation.Text = "ʧ";
- cancellation.ShowDialog();
- }
-
- private void ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Cancellation cancellation = new Cancellation();
- cancellation.Text = "";
- cancellation.ShowDialog();
- }
-
- private void ²ͶλܱToolStripMenuItem_Click(object sender, EventArgs e)
- {
- DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
- dailyConsumptionTable.Text = "²Ͷλܱ";
- dailyConsumptionTable.ShowDialog();
- }
-
- private void ƴξͲѱToolStripMenuItem_Click(object sender, EventArgs e)
- {
- DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
- dailyConsumptionTable.Text = "ƴξͲѱ";
- dailyConsumptionTable.ShowDialog();
- }
-
- private void ƴξͲϸToolStripMenuItem_Click(object sender, EventArgs e)
- {
- DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
- dailyConsumptionTable.Text = "ƴξͲϸ";
- dailyConsumptionTable.ShowDialog();
- }
-
- private void ͶToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new MealSegmentSet().ShowDialog();
- }
-
- //Ա¼
- private void button2_Click(object sender, EventArgs e)
- {
- ShowPage(new PersonnelEntryPage());
- }
-
- //¼
- private void button3_Click(object sender, EventArgs e)
- {
- ShowPage(new InstitutionalEntryPage());
- }
-
- //
- private void button5_Click(object sender, EventArgs e)
- {
- ShowPage(new CarMangerPage());
- }
-
- //ʧ
- private void button4_Click(object sender, EventArgs e)
- {
- ShowPage(new CancellationPage(), ((Button)sender)?.Tag.ToString());
- }
-
- //²Ͷλܱ
- private void button11_Click(object sender, EventArgs e)
- {
- ShowPage(new ReportFormPage(), ((Button)sender)?.Tag.ToString());
- }
-
- //Ͷ
- private void button12_Click(object sender, EventArgs e)
- {
- ShowPage(new MealSegmentSetPage());
- }
-
- private void ShowPage(UserControl userControl, string? name = "")
- {
- panel1.Controls.Clear();
- userControl.Width = panel1.Width;
- userControl.Height = panel1.Height;
- tempUserControl = userControl;
- userControl.Tag = name;
- userControl.Show();
- panel1.Controls.Add(userControl);
- }
- }
- }
|