Skip to content

Commit d138928

Browse files
committed
修复各种bug
1 parent 2a96c40 commit d138928

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

TimeControl/Data/Task.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@ public Task(string name, TimeSpan duration, bool isFocus, bool isDeepFocus)
2323
private bool isDeepFocus;
2424
private DateTime startTime = new DateTime(0);
2525
private DateTime endTime;
26+
2627
public bool IsDeepFocus
2728
{ get { return IsFocus && isDeepFocus; } }
2829

2930
public override string ToString()
3031
{
31-
return Name + " (" + Duration.Minutes + "min)";
32+
return Name + " (" + Duration.TotalMinutes + "min)";
3233
}
34+
3335
/// <summary>
34-
///
36+
///
3537
/// </summary>
3638
/// <returns>If the task is ended</returns>
3739
public bool RunTask()
3840
{
3941
bool res = false;
4042
startTime = DateTime.Now;
41-
if (IsFocus)
43+
if (IsFocus&&(!isDeepFocus))
4244
{
4345
LockHelper.StartLock(Password.unlockPasswordHash, (int)Duration.TotalMinutes);
4446
EndTask();
@@ -66,6 +68,7 @@ private string EndTaskString()
6668
endTime = DateTime.Now;
6769
return ToString() + "(实际" + (endTime - startTime) + ")";
6870
}
71+
6972
public void EndTask()
7073
{
7174
MessageBox.Show(EndTaskString(),

TimeControl/Tools/LockHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace TimeControl.Tools
99
internal class LockHelper
1010
{
1111
public static TimeData TimeData;
12+
1213
public static void StartLock(string unlockPasswordHash, int minutes)
1314
{
1415
IntPtr nowDesktop = Dllimport.GetThreadDesktop(Dllimport.GetCurrentThreadId());
@@ -51,6 +52,7 @@ public static void StartDeepLock(int minutes)
5152
SystemControl.Shutdown();
5253
Application.Exit();
5354
}
55+
5456
public static void ShowAndSave(TimeSpan timeSpan)
5557
{
5658
ResultWindow resultWindow = new(timeSpan);

TimeControl/Windows/ControlPanel.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Reflection;
66
using System.Windows.Forms;
77
using TimeControl.AppControl;
8-
using TimeControl.Data;
98
using TimeControl.Properties;
109
using TimeControl.Tools;
1110

@@ -207,8 +206,6 @@ private void StartLock(string unlockPasswordHash, int minutes = 0)
207206
RefreshAndSaveData();
208207
}
209208

210-
211-
212209
private void WhiteProcessBox_TextChanged(object sender, EventArgs e)
213210
{
214211
File.WriteAllText(TCFile.WhiteAppLocation, whiteProcessBox.Text);

0 commit comments

Comments
 (0)