You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Form1.cs 5.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. using HKLib.DB;
  2. using HKCardManager.UserPages;
  3. namespace HKCardManager
  4. {
  5. public partial class Form1 : Form
  6. {
  7. public Form1()
  8. {
  9. InitializeComponent();
  10. splitContainer1.SplitterDistance = 240;
  11. Task.Factory.StartNew(() =>
  12. {
  13. DbContext.InitTable();
  14. });
  15. ShowPage(new PersonnelEntryPage());
  16. this.SizeChanged += Form1_SizeChanged;
  17. this.button1.SizeChanged += Button1_SizeChanged;
  18. MessageLogNotify.GetInstance.Info = new Action<string>((s) =>
  19. {
  20. this.Invoke(() =>
  21. {
  22. if (listBox1.Items.Count > 0)
  23. listBox1.Items.Insert(0, $"{DateTime.Now.ToString("HH:mm:ss")}{s}");
  24. else
  25. listBox1.Items.Add($"{DateTime.Now.ToString("HH:mm:ss")}{s}");
  26. });
  27. });
  28. }
  29. private void Button1_SizeChanged(object? sender, EventArgs e)
  30. {
  31. groupBox1.Width = button1.Width;
  32. groupBox2.Width = button1.Width;
  33. groupBox3.Width = button1.Width;
  34. groupBox4.Width = button1.Width;
  35. button2.Left = 10;
  36. button2.Width = (groupBox1.Width - 20);
  37. button3.Left = 10;
  38. button3.Width = (groupBox1.Width - 20);
  39. button4.Left = 10;
  40. button4.Width = (groupBox2.Width - 20);
  41. button5.Left = 10;
  42. button5.Width = (groupBox2.Width - 20);
  43. button6.Left = 10;
  44. button6.Width = (groupBox2.Width - 20);
  45. button7.Left = 10;
  46. button7.Width = (groupBox2.Width - 20);
  47. button9.Left = 10;
  48. button9.Width = (groupBox3.Width - 20);
  49. button10.Left = 10;
  50. button10.Width = (groupBox3.Width - 20);
  51. button11.Left = 10;
  52. button11.Width = (groupBox3.Width - 20);
  53. button12.Left = 10;
  54. button12.Width = (groupBox4.Width - 20);
  55. }
  56. UserControl tempUserControl;
  57. private void Form1_SizeChanged(object? sender, EventArgs e)
  58. {
  59. if (tempUserControl != null)
  60. {
  61. tempUserControl.Width = this.panel1.Width;
  62. tempUserControl.Height = this.panel1.Height;
  63. }
  64. splitContainer1.SplitterDistance = 240;
  65. }
  66. private void Ա¼ToolStripMenuItem_Click(object sender, EventArgs e)
  67. {
  68. new PersonnelEntry().ShowDialog();
  69. }
  70. private void ¼ToolStripMenuItem_Click(object sender, EventArgs e)
  71. {
  72. new InstitutionalEntry().ShowDialog();
  73. }
  74. private void ToolStripMenuItem_Click(object sender, EventArgs e)
  75. {
  76. new Hairpin().ShowDialog();
  77. }
  78. private void ToolStripMenuItem_Click(object sender, EventArgs e)
  79. {
  80. Cancellation cancellation = new Cancellation();
  81. cancellation.Text = "";
  82. cancellation.ShowDialog();
  83. }
  84. private void ʧToolStripMenuItem_Click(object sender, EventArgs e)
  85. {
  86. Cancellation cancellation = new Cancellation();
  87. cancellation.Text = "ʧ";
  88. cancellation.ShowDialog();
  89. }
  90. private void ToolStripMenuItem_Click(object sender, EventArgs e)
  91. {
  92. Cancellation cancellation = new Cancellation();
  93. cancellation.Text = "";
  94. cancellation.ShowDialog();
  95. }
  96. private void ²ͶλܱToolStripMenuItem_Click(object sender, EventArgs e)
  97. {
  98. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  99. dailyConsumptionTable.Text = "²Ͷλܱ";
  100. dailyConsumptionTable.ShowDialog();
  101. }
  102. private void ƴξͲѱToolStripMenuItem_Click(object sender, EventArgs e)
  103. {
  104. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  105. dailyConsumptionTable.Text = "ƴξͲѱ";
  106. dailyConsumptionTable.ShowDialog();
  107. }
  108. private void ƴξͲϸToolStripMenuItem_Click(object sender, EventArgs e)
  109. {
  110. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  111. dailyConsumptionTable.Text = "ƴξͲϸ";
  112. dailyConsumptionTable.ShowDialog();
  113. }
  114. private void ͶToolStripMenuItem_Click(object sender, EventArgs e)
  115. {
  116. new MealSegmentSet().ShowDialog();
  117. }
  118. //Ա¼
  119. private void button2_Click(object sender, EventArgs e)
  120. {
  121. ShowPage(new PersonnelEntryPage());
  122. }
  123. //¼
  124. private void button3_Click(object sender, EventArgs e)
  125. {
  126. ShowPage(new InstitutionalEntryPage());
  127. }
  128. //
  129. private void button5_Click(object sender, EventArgs e)
  130. {
  131. ShowPage(new CarMangerPage());
  132. }
  133. //ʧ
  134. private void button4_Click(object sender, EventArgs e)
  135. {
  136. ShowPage(new CancellationPage(), ((Button)sender)?.Tag.ToString());
  137. }
  138. //²Ͷλܱ
  139. private void button11_Click(object sender, EventArgs e)
  140. {
  141. ShowPage(new ReportFormPage(), ((Button)sender)?.Tag.ToString());
  142. }
  143. //Ͷ
  144. private void button12_Click(object sender, EventArgs e)
  145. {
  146. ShowPage(new MealSegmentSetPage());
  147. }
  148. private void ShowPage(UserControl userControl, string? name = "")
  149. {
  150. panel1.Controls.Clear();
  151. userControl.Width = panel1.Width;
  152. userControl.Height = panel1.Height;
  153. tempUserControl = userControl;
  154. userControl.Tag = name;
  155. userControl.Show();
  156. panel1.Controls.Add(userControl);
  157. }
  158. }
  159. }