Skip to content

Commit

Permalink
Auto close the app after a period of inactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou committed Dec 29, 2024
1 parent 454c054 commit f56a4e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ namespace Meziantou.Framework.InlineSnapshotTesting.Prompt.NotificationTray;

internal static class Program
{
private static readonly System.Threading.Timer Timer = new(_ => Application.Exit());

private static void ResetTimer()
{
Timer.Change(TimeSpan.FromHours(4), Timeout.InfiniteTimeSpan);
}

[STAThread]
public static void Main()
{
const string AppId = "Local\\6495bb03-4c5c-4695-bb73-310b06982b5c";
using var mutex = new Mutex(initiallyOwned: false, AppId);
if (!mutex.WaitOne(0))
{
ResetTimer();
return;
}

Application.EnableVisualStyles();
using var appContext = new MyCustomApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Description>Enables verification of objects using inline snapshots</Description>
<DefineConstants Condition="'$(IsOfficialBuild)' != 'true'">$(DefineConstants);DEBUG_TaskDialogPrompt</DefineConstants>

<Version>3.3.5</Version>
<Version>3.3.6</Version>
<NoWarn>$(NoWarn);NU5100</NoWarn>

<!-- Buggy because of netstandard2.0 -->
Expand Down

0 comments on commit f56a4e5

Please sign in to comment.