Release v0.2.0
This commit is contained in:
27
Services.cs
27
Services.cs
@@ -1,10 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace OmniNotify;
|
||||
|
||||
@@ -61,7 +59,6 @@ public sealed class AppStore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NotificationRouter
|
||||
{
|
||||
private readonly AppState _state;
|
||||
@@ -169,7 +166,6 @@ public sealed class NotificationRouter
|
||||
StateChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class LocalHttpServer : IDisposable
|
||||
{
|
||||
private readonly NotificationRouter _router;
|
||||
@@ -273,26 +269,3 @@ public sealed class LocalHttpServer : IDisposable
|
||||
_listener?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static class StartupManager
|
||||
{
|
||||
private const string AppName = "OmniNotify";
|
||||
|
||||
public static void Apply(bool enabled)
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
|
||||
if (key is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
key.SetValue(AppName, Process.GetCurrentProcess().MainModule?.FileName ?? "");
|
||||
}
|
||||
else
|
||||
{
|
||||
key.DeleteValue(AppName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user