Skip to content

Commit

Permalink
Merge pull request #29 from Planshit/dev
Browse files Browse the repository at this point in the history
修复统计和托盘图标问题
  • Loading branch information
noberumotto authored Mar 24, 2020
2 parents c329246 + fe4caed commit 8849871
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/ProjectEye/Core/Service/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,12 @@ public void Start()

#region 暂停主服务
/// <summary>
/// 暂停
/// 暂停主服务
/// </summary>
public void Pause()
/// <param name="isStopStatistic">是否停止用眼统计,默认true</param>
public void Pause(bool isStopStatistic = true)
{
DoStop();
DoStop(isStopStatistic);
OnPause?.Invoke(this, 0);
}
#endregion
Expand Down Expand Up @@ -337,7 +338,7 @@ private void DoStart()
#endregion

#region 停止计时实际操作
private void DoStop()
private void DoStop(bool isStopStatistic = true)
{

//统计数据
Expand All @@ -349,7 +350,10 @@ private void DoStop()

back_timer.Stop();

useeye_timer.Stop();
if (isStopStatistic)
{
useeye_timer.Stop();
}

busy_timer.Stop();
}
Expand Down
14 changes: 11 additions & 3 deletions src/ProjectEye/Core/Service/TrayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public TrayService(App app, MainService mainService, ConfigService config)
private void MainService_OnStart(object service, int msg)
{
UpdateIcon("sunglasses");
if (contextMenu != null)
{
menuItem_NoReset_OneHour.IsChecked = false;
menuItem_NoReset_TwoHour.IsChecked = false;
menuItem_NoReset_Forver.IsChecked = false;
menuItem_NoReset.IsChecked = false;
menuItem_NoReset_Off.IsChecked = true;
}
}

private void MainService_OnLeaveEvent(object service, int msg)
Expand Down Expand Up @@ -254,14 +262,14 @@ private void SetNoReset(int hour)
{
//直到下次启动
menuItem_NoReset.IsChecked = true;
mainService.Pause();
mainService.Pause(false);
}
else
{
//指定计时
menuItem_NoReset.IsChecked = true;
mainService.Pause();
mainService.Pause(false);

noresetTimer.Interval = new TimeSpan(hour, 0, 0);
noresetTimer.Tick += (e, c) =>
{
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.6")]
[assembly: AssemblyVersion("1.1.7")]
[assembly: AssemblyFileVersion("1.0.0.1")]

0 comments on commit 8849871

Please sign in to comment.