Skip to content

Commit

Permalink
修复了预提醒在启用了"不要提醒"后仍然弹出的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
noberumotto committed Sep 28, 2019
1 parent 65cf034 commit 828a7e8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/ProjectEye/Core/Service/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ public class MainService : IService
/// 到达休息时间时发生(不管是否进入休息状态)
/// </summary>
public event MainEventHandler OnReset;
/// <summary>
/// 计时器停止时发生
/// </summary>
public event MainEventHandler OnPause;
/// <summary>
/// 计时器启动时发生
/// </summary>
public event MainEventHandler OnStart;
#endregion
public MainService(App app,
ScreenService screen,
Expand Down Expand Up @@ -341,6 +349,7 @@ private void DoStart()
//用眼统计
useeye_timer.Start();
}
OnStart?.Invoke(this, 0);
}
#endregion

Expand All @@ -353,7 +362,7 @@ private void DoStop()

back_timer.Stop();


OnPause?.Invoke(this, 0);
}
#endregion

Expand Down
19 changes: 19 additions & 0 deletions src/ProjectEye/Core/Service/PreAlertService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public PreAlertService(ConfigService config,
main.OnReset += Main_OnReset;
main.OnLeaveEvent += Main_OnLeaveEvent;
main.OnComeBackEvent += Main_OnComeBackEvent;
main.OnPause += Main_OnPause;
main.OnStart += Main_OnStart;
config.Changed += Config_Changed;
reset.ResetStart += Reset_ResetStart;
reset.ResetCompleted += Reset_ResetCompleted;
Expand All @@ -118,6 +120,23 @@ public PreAlertService(ConfigService config,
preAlertTimer.Tick += new EventHandler(preAlertTimer_Tick);
}

private void Main_OnStart(object service, int msg)
{
if (config.options.Style.IsPreAlert)
{
InitPreAlert();
}

}

private void Main_OnPause(object service, int msg)
{
if (config.options.Style.IsPreAlert && preAlertTimer.IsEnabled)
{
preAlertTimer.Stop();
}
}

private void Main_OnComeBackEvent(object service, int msg)
{
if (config.options.Style.IsPreAlert)
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectEye/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

0 comments on commit 828a7e8

Please sign in to comment.