Setting.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using Microsoft.Toolkit.Uwp.Notifications;
  2. using System;
  3. using System.Diagnostics;
  4. using System.Windows.Forms;
  5. using 新一代CaptB点名器.Properties;
  6. namespace 新一代CaptB点名器
  7. {
  8. public partial class Setting : Form
  9. {
  10. public Setting()
  11. {
  12. InitializeComponent();
  13. if (!Settings.Default.doCheckUpdate)
  14. radioButton7.Checked = true;
  15. if (!Settings.Default.doDelete)
  16. radioButton2.Checked = true;
  17. if (!Settings.Default.doTopmost)
  18. radioButton3.Checked = true;
  19. if (!Settings.Default.doTransparent)
  20. radioButton5.Checked = true;
  21. if (!Settings.Default.doExitConfirm)
  22. radioButton9.Checked = true;
  23. trackBar1.Value = Settings.Default.Opacity;
  24. label5.Text = "当前值:" + Settings.Default.Opacity.ToString() + "%";
  25. textBox1.Text = Settings.Default.InitialWord;
  26. }
  27. private void Setting_Load(object sender, EventArgs e)
  28. {
  29. label9.Text = "上次检查更新时间:" + Settings.Default.LastestUpdateCheckTime.ToString();
  30. }
  31. private void button2_Click(object sender, EventArgs e)
  32. {
  33. Process checkupdate = new Process();
  34. checkupdate.StartInfo.FileName = Application.StartupPath + @"\CBRC_Update.exe";
  35. try
  36. {
  37. checkupdate.Start();
  38. Settings.Default.LastestUpdateCheckTime = DateTime.Now.Date;
  39. Settings.Default.Save();
  40. }
  41. catch (Exception ex)
  42. {
  43. Settings.Default.LastestUpdateCheckTime = DateTime.Now.Date;
  44. Settings.Default.Save();
  45. Form1 form1 = new Form1(null);
  46. form1.notifyIcon1.ShowBalloonTip(1000, Resources.UpdateErrToastTitle, ex.Message + Resources.ExRe_Reinstall, ToolTipIcon.Error);
  47. }
  48. }
  49. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  50. {
  51. if (radioButton2.Checked)
  52. Settings.Default.doDelete = false;
  53. else
  54. Settings.Default.doDelete = true;
  55. Settings.Default.Save();
  56. }
  57. private void radioButton3_CheckedChanged(object sender, EventArgs e)
  58. {
  59. if (radioButton3.Checked)
  60. Settings.Default.doTopmost = false;
  61. else
  62. Settings.Default.doTopmost = true;
  63. Settings.Default.Save();
  64. }
  65. private void radioButton5_CheckedChanged(object sender, EventArgs e)
  66. {
  67. if (radioButton5.Checked)
  68. Settings.Default.doTransparent = false;
  69. else
  70. Settings.Default.doTransparent = true;
  71. Settings.Default.Save();
  72. }
  73. private void trackBar1_ValueChanged(object sender, EventArgs e)
  74. {
  75. label5.Text = "当前值:" + trackBar1.Value.ToString() + "%";
  76. Settings.Default.Opacity = trackBar1.Value;
  77. Settings.Default.Save();
  78. }
  79. private void button1_Click(object sender, EventArgs e)
  80. {
  81. Settings.Default.InitialWord = textBox1.Text;
  82. Settings.Default.Save();
  83. }
  84. private void radioButton9_CheckedChanged(object sender, EventArgs e)
  85. {
  86. if (radioButton9.Checked)
  87. Settings.Default.doExitConfirm = false;
  88. else
  89. Settings.Default.doExitConfirm = true;
  90. Settings.Default.Save();
  91. }
  92. }
  93. }