Content.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.IO;
  3. using System.Windows.Forms;
  4. using 新一代CaptB点名器.Properties;
  5. namespace 新一代CaptB点名器
  6. {
  7. public partial class Content : Form
  8. {
  9. public Content()
  10. {
  11. InitializeComponent();
  12. }
  13. string[] strings;
  14. private void Content_Load(object sender, EventArgs e)
  15. {
  16. if (Settings.Default.Content == true)
  17. {
  18. label2.Text = Program.num.ToString() + Resources.Units;
  19. try
  20. {
  21. strings = File.ReadAllLines(Program.cbcfpath);
  22. }
  23. catch (Exception ex)
  24. {
  25. MessageBox.Show(ex.Message + "\n" + Resources.ExRe_RR, Resources.CErrTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
  26. Close();
  27. }
  28. }
  29. else
  30. {
  31. label1.Text = "未点人数:";
  32. int display_num = Program.num - Program.called_num;
  33. label2.Text = display_num + Resources.Units;
  34. try
  35. {
  36. strings = File.ReadAllLines(Program.cfpath);
  37. }
  38. catch (Exception ex)
  39. {
  40. MessageBox.Show(ex.Message + "\n" + Resources.ExRe_RR, Resources.CErrTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
  41. Close();
  42. }
  43. }
  44. listView1.BeginUpdate();
  45. for (int i = 1; i < Program.num + 1; i++)
  46. {
  47. ListViewItem listViewItem = new ListViewItem
  48. {
  49. Text = strings[i]
  50. };
  51. if (listViewItem.Text != "")
  52. listView1.Items.Add(listViewItem);
  53. }
  54. listView1.EndUpdate();
  55. }
  56. }
  57. }