Skip to content

Commit

Permalink
Use GithubReleaseChecker's monitoring timer and log (ignore) exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nachmore committed Sep 24, 2020
1 parent 5d3501d commit 108f425
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions ChimeHelper/ChimeHelperUX/ChimeHelperState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void StartState()
if (_timerState == TimerState.STOPPED)
{
StartMeetingTimer();
StartCheckForUpdatesTimer();
StartCheckForUpdates();

Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
}
Expand Down Expand Up @@ -186,15 +186,16 @@ private void CheckForChimeMeetings(object stateInfo)
}));
}

private void StartCheckForUpdatesTimer()
private void StartCheckForUpdates()
{
var updateTimer = new Timer(CheckForUpdates, null, 0, 24 * 60 * 60);
UpdateState = new ReleaseChecker("nachmore", "AmazonChimeHelper");
UpdateState.UnhandledException += UpdateState_UnhandledException;
UpdateState.MonitorForUpdates(VersionString);
}

private void CheckForUpdates(object state)
private void UpdateState_UnhandledException(object sender, Exception e)
{
UpdateState = new ReleaseChecker("nachmore", "AmazonChimeHelper");
UpdateState.MonitorForUpdates(VersionString);
Debug.WriteLine($"(ignored) Exception checking for updates:\n\n{e}");
}
}
}
2 changes: 1 addition & 1 deletion ChimeHelper/ChimeHelperUX/ChimeHelperUX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<Resource Include="Icons\fan-off.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitHubReleaseChecker" Version="0.6.1" />
<PackageReference Include="GitHubReleaseChecker" Version="0.6.3" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.13" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
</ItemGroup>
Expand Down

0 comments on commit 108f425

Please sign in to comment.