From 828a7e817cbaad1521787a18ab973f5b4db8657e Mon Sep 17 00:00:00 2001 From: Little panda Date: Sat, 28 Sep 2019 13:22:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=A2=84=E6=8F=90?= =?UTF-8?q?=E9=86=92=E5=9C=A8=E5=90=AF=E7=94=A8=E4=BA=86"=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E6=8F=90=E9=86=92"=E5=90=8E=E4=BB=8D=E7=84=B6?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProjectEye/Core/Service/MainService.cs | 11 ++++++++++- .../Core/Service/PreAlertService.cs | 19 +++++++++++++++++++ src/ProjectEye/Properties/AssemblyInfo.cs | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/ProjectEye/Core/Service/MainService.cs b/src/ProjectEye/Core/Service/MainService.cs index 1db65ac..d2a633f 100644 --- a/src/ProjectEye/Core/Service/MainService.cs +++ b/src/ProjectEye/Core/Service/MainService.cs @@ -74,6 +74,14 @@ public class MainService : IService /// 到达休息时间时发生(不管是否进入休息状态) /// public event MainEventHandler OnReset; + /// + /// 计时器停止时发生 + /// + public event MainEventHandler OnPause; + /// + /// 计时器启动时发生 + /// + public event MainEventHandler OnStart; #endregion public MainService(App app, ScreenService screen, @@ -341,6 +349,7 @@ private void DoStart() //用眼统计 useeye_timer.Start(); } + OnStart?.Invoke(this, 0); } #endregion @@ -353,7 +362,7 @@ private void DoStop() back_timer.Stop(); - + OnPause?.Invoke(this, 0); } #endregion diff --git a/src/ProjectEye/Core/Service/PreAlertService.cs b/src/ProjectEye/Core/Service/PreAlertService.cs index d82fa4a..7d5a952 100644 --- a/src/ProjectEye/Core/Service/PreAlertService.cs +++ b/src/ProjectEye/Core/Service/PreAlertService.cs @@ -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; @@ -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) diff --git a/src/ProjectEye/Properties/AssemblyInfo.cs b/src/ProjectEye/Properties/AssemblyInfo.cs index 223b311..7f829c3 100644 --- a/src/ProjectEye/Properties/AssemblyInfo.cs +++ b/src/ProjectEye/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0")] +[assembly: AssemblyVersion("1.1.1")] [assembly: AssemblyFileVersion("1.0.0.1")]