Skip to content

Commit cf8026e

Browse files
committed
改进
1 parent 3001bad commit cf8026e

File tree

10 files changed

+88
-76
lines changed

10 files changed

+88
-76
lines changed

TimeControl/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ private static void Main(string[] args)
4444
else
4545
return;
4646
}
47-
Application.ThreadException += ExceptionHandler;
48-
AppDomain.CurrentDomain.UnhandledException += ExceptionHandler;
47+
if (!Debugger.IsAttached)
48+
{
49+
Application.ThreadException += ExceptionHandler;
50+
AppDomain.CurrentDomain.UnhandledException += ExceptionHandler;
51+
}
4952
Application.SetHighDpiMode(HighDpiMode.SystemAware);
5053
Application.EnableVisualStyles();
5154
Application.SetCompatibleTextRenderingDefault(false);

TimeControl/Properties/Resources.Designer.cs

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/Properties/Resources.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,4 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<data name="words" xml:space="preserve">
121-
<value>这个软件是由SamHou开发的。希望可以帮你养成良好的电脑使用习惯~如果觉得好用的话,请去github和gitee点个star~</value>
122-
</data>
123120
</root>

TimeControl/Tools/TimeControlFile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static class TimeControlFile
2323
//屏保
2424
public static readonly string WhiteAppLocation = BaseLocation + "\\WhiteApp.txt";//应用白名单保存
2525
public static readonly string TempTimeFile = BaseLocation + "\\Temp.txt";
26+
public static readonly string NoteFile = BaseLocation + "\\Notes.txt";
2627
//自动关机
2728
public static readonly string ShutdownSpan = BaseLocation + "\\Shutdown.txt";
2829
//数据显示

TimeControl/Windows/ControlPanel.Designer.cs

Lines changed: 24 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/Windows/ControlPanel.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,24 @@ private void RemoveBootButton_Click(object sender, EventArgs e)
309309

310310
#endregion
311311

312-
#region AboutPage
312+
#region DataPage
313+
private void RefreshAndSaveData()
314+
{
315+
//刷新列表
316+
//屏保合计
317+
dataGridView.Rows.Clear();
318+
dataGridView.Rows.Add();
319+
dataGridView.Rows[0].Cells[0].Value = timeData.Time.Hours;
320+
dataGridView.Rows[0].Cells[1].Value = timeData.Time.Minutes;
321+
dataGridView.Rows[0].Cells[2].Value = timeData.Time.Seconds;
322+
dataGridView.Rows[0].Cells[3].Value = "屏保合计";
323+
//保存
324+
TimeControlFile.SaveTimeData(timeData);
325+
}
326+
327+
#endregion
328+
329+
#region SettingPage
313330
private void AuthorButton_Click(object sender, EventArgs e)
314331
{
315332
MessageBox.Show(Properties.Resources.words);
@@ -332,22 +349,5 @@ private void HelpLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventA
332349
}
333350
#endregion
334351

335-
#region DataPage
336-
private void RefreshAndSaveData()
337-
{
338-
//刷新列表
339-
//屏保合计
340-
dataGridView.Rows.Clear();
341-
dataGridView.Rows.Add();
342-
dataGridView.Rows[0].Cells[0].Value = timeData.Time.Hours;
343-
dataGridView.Rows[0].Cells[1].Value = timeData.Time.Minutes;
344-
dataGridView.Rows[0].Cells[2].Value = timeData.Time.Seconds;
345-
dataGridView.Rows[0].Cells[3].Value = "屏保合计";
346-
//保存
347-
TimeControlFile.SaveTimeData(timeData);
348-
}
349-
350-
#endregion
351-
352352
}
353353
}

TimeControl/Windows/Lock.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/Windows/TimeInput.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/Windows/ToolBox.Designer.cs

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/Windows/ToolBox.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Windows.Forms;
33
using TimeControl.Tools;
4+
using System.IO;
45

56
namespace TimeControl.Windows
67
{
@@ -14,6 +15,9 @@ public ToolBox(string[] whiteList)
1415
{
1516
whiteListBox.Items.Add(whiteProcess);
1617
}
18+
noteLocationLabel.Text="文件位置:"+TimeControlFile.NoteFile;
19+
if (File.Exists(TimeControlFile.NoteFile))
20+
noteTextBox.Text = File.ReadAllText(TimeControlFile.NoteFile);
1721
}
1822

1923
private void whiteListBox_DoubleClick(object sender, EventArgs e)
@@ -32,5 +36,10 @@ private void timer_Tick(object sender, EventArgs e)
3236
{
3337
timeLabel.Text = "当前时间:" + DateTime.Now.ToString("HH:mm:ss");
3438
}
39+
40+
private void noteTextBox_TextChanged(object sender, EventArgs e)
41+
{
42+
File.WriteAllText(TimeControlFile.NoteFile, noteTextBox.Text);
43+
}
3544
}
3645
}

0 commit comments

Comments
 (0)