public AppsSwitch() : base() { try { currentComponentTheme = RegistryHandler.AppsUseLightTheme() ? Theme.Light : Theme.Dark; } catch (Exception ex) { Logger.Error(ex, "couldn't initialize apps theme state"); } }
private void SwitchThemeNow(object sender, EventArgs e) { AdmConfig config = AdmConfigBuilder.Instance().Config; Logger.Info("ui signal received: switching theme"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.SwitchTheme(config, Theme.Dark); } else { ThemeManager.SwitchTheme(config, Theme.Light); } }
public static void SwitchToDarkTheme() { if (Settings.Default.ChangeAppTheme) { RegistryHandler.AppsUseLightTheme(false); } if (Settings.Default.ChangeSystemTheme) { RegistryHandler.SystemUsesLightTheme(false); } if (Settings.Default.ChangeWallpaper) { WallpaperHandler.ChangeWallpaper(Settings.Default.DarkWallpaperPath); } }
protected RuntimeConfig() { CurrentAppsTheme = RegistryHandler.AppsUseLightTheme() ? Theme.Light : Theme.Dark; CurrentSystemTheme = RegistryHandler.SystemUsesLightTheme() ? Theme.Light : Theme.Dark; try { CurrentEdgeTheme = RegistryHandler.EdgeUsesLightTheme() ? Theme.Light : Theme.Dark; } catch (Exception ex) { Logger.Error(ex, "could not retrieve edge theme key value"); CurrentEdgeTheme = Theme.Undefined; } CurrentColorPrevalence = RegistryHandler.IsColorPrevalence(); CurrentWallpaperTheme = Theme.Undefined; CurrentWindowsThemeName = ThemeHandler.GetCurrentThemeName(); CurrentOfficeTheme = Theme.Undefined; ForcedTheme = Theme.Undefined; PostponeSwitch = false; }
//private static readonly ComponentManager cm = ComponentManager.Instance(); /// <summary> /// Parses a command message and invokes a callback function delegate for status reporting /// </summary> /// <param name="msg">list of messages to parse</param> /// <param name="SendResponse">Callback taking a string as parameter to report return values back to sender</param> /// <param name="service">Service class for invoking application exit</param> public static void Parse(List <string> msg, Action <string> SendResponse, Service service) { WaitForConfigUpdateCompletion(); msg.ForEach(message => { switch (message) { #region Switch case Command.Switch: Logger.Info("signal received: invoke theme switch"); //cm.ForceAll(); ThemeManager.TimedSwitch(builder, false); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Swap case Command.Swap: Logger.Info("signal received: swap themes"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.SwitchTheme(builder.Config, Theme.Dark); } else { ThemeManager.SwitchTheme(builder.Config, Theme.Light); } SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region AddAutoStart case Command.AddAutostart: Logger.Info("signal received: add service to autostart"); bool regOk; bool taskOk; if (builder.Config.Tunable.UseLogonTask) { Logger.Debug("logon task mode selected"); regOk = RegistryHandler.RemoveAutoStart(); taskOk = TaskSchdHandler.CreateLogonTask(); } else { Logger.Debug("autostart mode selected"); taskOk = TaskSchdHandler.RemoveLogonTask(); regOk = RegistryHandler.AddAutoStart(); } if (regOk && taskOk) { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.Err, Message = $"RegOk: {regOk}, TaskOk: {taskOk}" }.ToString()); } break; #endregion #region RemoveAutostart case Command.RemoveAutostart: Logger.Info("signal received: remove service from autostart"); bool ok; if (builder.Config.Tunable.UseLogonTask) { Logger.Debug("logon task mode selected"); ok = TaskSchdHandler.RemoveLogonTask(); } else { Logger.Debug("autostart mode selected"); ok = RegistryHandler.RemoveAutoStart(); } if (ok) { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.Err }.ToString()); } break; #endregion #region LocationAccess case Command.LocationAccess: Logger.Info("signal received: checking location access permissions"); Task <bool> geoTask = Task.Run(async() => await LocationHandler.HasPermission()); geoTask.Wait(); var result = geoTask.Result; if (result) { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.NoLocAccess, Message = "location service needs to be enabled" }.ToString()); } break; #endregion #region GeoloatorIsUpdating case Command.GeolocatorIsUpdating: Logger.Info("signal received: check if geolocator is busy"); if (state.GeolocatorIsUpdating) { SendResponse(new ApiResponse() { StatusCode = StatusCode.InProgress }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } break; #endregion #region CheckForUpdates case Command.CheckForUpdate: Logger.Info("signal received: checking for update"); SendResponse(UpdateHandler.CheckNewVersion().ToString()); break; #endregion #region CheckForUpdateNotify case Command.CheckForUpdateNotify: Logger.Info("signal received: checking for update and requesting notification"); ApiResponse updateCheckData = UpdateHandler.CheckNewVersion(); updateCheckData = UpdateHandler.CanUseUpdater(); if (updateCheckData.StatusCode == StatusCode.New) { ToastHandler.InvokeUpdateToast(); } else if (updateCheckData.StatusCode == StatusCode.UnsupportedOperation || updateCheckData.StatusCode == StatusCode.Disabled) { ToastHandler.InvokeUpdateToast(canUseUpdater: false); } SendResponse(updateCheckData.ToString()); break; #endregion #region Update case Command.Update: Logger.Info("signal received: update adm"); if (!UpdateHandler.Updating) { ApiResponse response = UpdateHandler.CanUseUpdater(); if (response.StatusCode == StatusCode.New) { SendResponse(response.ToString()); // this is run sync, as such it will block the ZMQ thread! _ = Task.Run(() => UpdateHandler.Update()); } else { SendResponse(response.ToString()); } } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.InProgress, Message = "Update already in progress", Details = $"Download Progress: {UpdateHandler.Progress}" }.ToString()); } //_ = UpdateHandler.CheckNewVersion(); break; #endregion #region Shutdown case Command.Shutdown: Logger.Info("signal received, exiting"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); service.Exit(null, null); break; #endregion #region TestError case Command.TestError: Logger.Info("signal received: test error"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Err }.ToString()); break; #endregion #region Alive case Command.Alive: Logger.Info("signal received: request for running status"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Light case Command.Light: Logger.Info("signal received: force light theme"); state.ForcedTheme = Theme.Light; ThemeManager.SwitchTheme(builder.Config, Theme.Light); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Dark case Command.Dark: Logger.Info("signal received: force dark theme"); state.ForcedTheme = Theme.Dark; ThemeManager.SwitchTheme(builder.Config, Theme.Dark); SendResponse(StatusCode.Ok); break; #endregion #region NoForce case Command.NoForce: Logger.Info("signal received: resetting forced modes"); state.ForcedTheme = Theme.Unknown; ThemeManager.TimedSwitch(builder); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region DetectMonitors case Command.DetectMonitors: Logger.Info("signal received: detecting new monitors"); WallpaperHandler.DetectMonitors(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region CleanMonitors case Command.CleanMonitors: Logger.Info("signal received: removing disconnected monitors"); WallpaperHandler.CleanUpMonitors(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region UpdateFailed case Command.UpdateFailed: Logger.Info("signal received: notify about failed update"); ToastHandler.InvokeFailedUpdateToast(); SendResponse(StatusCode.Ok); break; #endregion #region TestNotifications case Command.TestNotifications: Logger.Info("signal received: test notifications"); ToastHandler.InvokeUpdateInProgressToast(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion default: Logger.Debug("unknown message received"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Err, Message = "requested command does not exist" }.ToString()); break; } }); }
//private static readonly ComponentManager cm = ComponentManager.Instance(); /// <summary> /// Parses a command message and invokes a callback function delegate for status reporting /// </summary> /// <param name="msg">list of messages to parse</param> /// <param name="SendResponse">Callback taking a string as parameter to report return values back to sender</param> /// <param name="service">Service class for invoking application exit</param> public static void Parse(List <string> msg, Action <string> SendResponse, Service service) { //WaitForConfigUpdateCompletion(); _ = state.ConfigIsUpdatingWaitHandle.WaitOne(); msg.ForEach(message => { switch (message) { #region Switch case Command.Switch: Logger.Info("signal received: invoke theme switch"); //cm.ForceAll(); ThemeManager.RequestSwitch(builder, new(SwitchSource.Manual)); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Swap case Command.Swap: Logger.Info("signal received: swap themes"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.UpdateTheme(builder.Config, Theme.Dark, new(SwitchSource.Manual)); } else { ThemeManager.UpdateTheme(builder.Config, Theme.Light, new(SwitchSource.Manual)); } SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region AddAutoStart case Command.AddAutostart: Logger.Info("signal received: add service to autostart"); SendResponse(AutoStartHandler.AddAutostart().ToString()); break; #endregion #region RemoveAutostart case Command.RemoveAutostart: Logger.Info("signal received: remove service from autostart"); SendResponse(AutoStartHandler.RemoveAutostart().ToString()); break; #endregion #region GetAutostartState case Command.GetAutostartState: Logger.Info("signal recevied: get autostart state"); SendResponse(AutoStartHandler.GetAutostartState().ToString()); break; #endregion #region ValidateAutostartAutostart case string s when s.StartsWith(Command.ValidateAutostart): Logger.Info("signal received: validate autostart entries"); string[] split = s.Split(" "); if (split.Length > 1) { SendResponse(AutoStartHandler.Validate(true).ToString()); } else { SendResponse(AutoStartHandler.Validate(false).ToString()); } break; #endregion #region LocationAccess case Command.LocationAccess: Logger.Info("signal received: checking location access permissions"); Task <bool> geoTask = Task.Run(async() => await LocationHandler.HasLocation()); geoTask.Wait(); var result = geoTask.Result; if (result) { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.NoLocAccess, Message = "location service needs to be enabled" }.ToString()); } break; #endregion #region GeoloatorIsUpdating case Command.GeolocatorIsUpdating: Logger.Info("signal received: check if geolocator is busy"); if (state.GeolocatorIsUpdating) { SendResponse(new ApiResponse() { StatusCode = StatusCode.InProgress }.ToString()); } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); } break; #endregion #region CheckForUpdates case Command.CheckForUpdate: Logger.Info("signal received: checking for update"); SendResponse(UpdateHandler.CheckNewVersion().ToString()); break; #endregion #region CheckForUpdateNotify case Command.CheckForUpdateNotify: Logger.Info("signal received: checking for update and requesting notification"); ApiResponse updateCheckData = UpdateHandler.CheckNewVersion(); updateCheckData = UpdateHandler.CanUseUpdater(); if (updateCheckData.StatusCode == StatusCode.New) { ToastHandler.InvokeUpdateToast(); } else if (updateCheckData.StatusCode == StatusCode.UnsupportedOperation || updateCheckData.StatusCode == StatusCode.Disabled) { ToastHandler.InvokeUpdateToast(canUseUpdater: false); } SendResponse(updateCheckData.ToString()); break; #endregion #region Update case Command.Update: Logger.Info("signal received: update adm"); if (!UpdateHandler.Updating) { ApiResponse response = UpdateHandler.CanUseUpdater(); if (response.StatusCode == StatusCode.New) { SendResponse(response.ToString()); // this is run sync, as such it will block the ZMQ thread! _ = Task.Run(() => UpdateHandler.Update()); } else { SendResponse(response.ToString()); } } else { SendResponse(new ApiResponse() { StatusCode = StatusCode.InProgress, Message = "Update already in progress", Details = $"Download Progress: {UpdateHandler.Progress}" }.ToString()); } //_ = UpdateHandler.CheckNewVersion(); break; #endregion #region CheckForDowngradeNotify case Command.CheckForDowngradeNotify: Logger.Info("signal received: checking for downgrade and requesting notification"); ApiResponse downgradeCheckData = UpdateHandler.CheckDowngrade(); updateCheckData = UpdateHandler.CanUseUpdater(); if (updateCheckData.StatusCode == StatusCode.Downgrade) { ToastHandler.InvokeUpdateToast(downgrade: true); } else if (updateCheckData.StatusCode == StatusCode.UnsupportedOperation || updateCheckData.StatusCode == StatusCode.Disabled) { ToastHandler.InvokeUpdateToast(downgrade: true, canUseUpdater: false); } SendResponse(updateCheckData.ToString()); break; #endregion #region Shutdown case Command.Shutdown: Logger.Info("signal received, exiting"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); service.RequestExit(null, null); break; #endregion #region Restart case Command.Restart: Logger.Info("signal received, restarting"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); service.Restart(null, new ExitEventArgs(false)); break; #endregion #region TestError case Command.TestError: Logger.Info("signal received: test error"); Thread.Sleep(5000); SendResponse(new ApiResponse() { StatusCode = StatusCode.Err }.ToString()); break; #endregion #region Alive case Command.Alive: Logger.Info("signal received: request for running status"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Light case Command.Light: Logger.Info("signal received: force light theme"); state.ForcedTheme = Theme.Light; ThemeHandler.EnforceNoMonitorUpdates(builder, state, Theme.Light); ThemeManager.UpdateTheme(builder.Config, Theme.Light, new(SwitchSource.Manual)); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Dark case Command.Dark: Logger.Info("signal received: force dark theme"); state.ForcedTheme = Theme.Dark; ThemeHandler.EnforceNoMonitorUpdates(builder, state, Theme.Dark); ThemeManager.UpdateTheme(builder.Config, Theme.Dark, new(SwitchSource.Manual)); SendResponse(StatusCode.Ok); break; #endregion #region NoForce case Command.NoForce: Logger.Info("signal received: resetting forced modes"); state.ForcedTheme = Theme.Unknown; ThemeManager.RequestSwitch(builder, new(SwitchSource.Manual)); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region DetectMonitors case Command.DetectMonitors: Logger.Info("signal received: detecting new monitors"); DisplayHandler.DetectMonitors(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region CleanMonitors case Command.CleanMonitors: Logger.Info("signal received: removing disconnected monitors"); DisplayHandler.CleanUpMonitors(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region UpdateFailed case Command.UpdateFailed: Logger.Info("signal received: notify about failed update"); ToastHandler.InvokeFailedUpdateToast(); SendResponse(StatusCode.Ok); break; #endregion #region TestNotifications case Command.TestNotifications: Logger.Info("signal received: test notifications"); ToastHandler.InvokeUpdateInProgressToast("TestVersion"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region TestNotifications2 case Command.TestNotifications2: Logger.Info("signal received: test notifications"); //ToastHandler.InvokeUpdateToast(true, true); //ToastHandler.RemoveUpdaterToast(); //ToastHandler.UpdateProgressToast("0.5", "test"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok }.ToString()); break; #endregion #region Test case Command.Test: ThemeFile tf = new(@"C:\Users\Sam\AppData\Local\Microsoft\Windows\Themes\solid_test.theme"); tf.Save(); SendResponse(new ApiResponse() { StatusCode = StatusCode.Ok, Message = "it works" }.ToString()); break; #endregion default: Logger.Debug("unknown message received"); SendResponse(new ApiResponse() { StatusCode = StatusCode.Err, Message = "requested command does not exist" }.ToString()); break; } }); }
/// <summary> /// Parses a command message and invokes a callback function delegate for status reporting /// </summary> /// <param name="msg">list of messages to parse</param> /// <param name="SendResponse">Callback taking a string as parameter to report return values back to sender</param> /// <param name="service">Service class for invoking application exit</param> public static void Parse(List <string> msg, Action <string> SendResponse, Service service) { AdmConfigBuilder builder = AdmConfigBuilder.Instance(); RuntimeConfig rtc = RuntimeConfig.Instance(); msg.ForEach(message => { switch (message) { case Command.Switch: Logger.Info("signal received: time based theme switch"); ThemeManager.TimedSwitch(builder); SendResponse(Response.Ok); break; case Command.Swap: Logger.Info("signal received: swap themes"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.SwitchTheme(builder.Config, Theme.Dark); } else { ThemeManager.SwitchTheme(builder.Config, Theme.Light); } SendResponse(Response.Ok); break; case Command.AddAutostart: Logger.Info("signal received: adding service to autostart"); bool regOk; bool taskOk; if (builder.Config.Tunable.UseLogonTask) { regOk = RegistryHandler.RemoveAutoStart(); taskOk = TaskSchdHandler.CreateLogonTask(); } else { taskOk = TaskSchdHandler.RemoveLogonTask(); regOk = RegistryHandler.AddAutoStart(); } if (regOk && taskOk) { SendResponse(Response.Ok); } else { SendResponse(Response.Err); } break; case Command.RemoveAutostart: Logger.Info("signal received: removing service from autostart"); bool ok; if (builder.Config.Tunable.UseLogonTask) { ok = TaskSchdHandler.RemoveLogonTask(); } else { ok = RegistryHandler.RemoveAutoStart(); } if (ok) { SendResponse(Response.Ok); } else { SendResponse(Response.Err); } break; case Command.Location: Logger.Info("signal received: request location update"); Task <bool> geoTask = Task.Run(() => LocationHandler.UpdateGeoposition(AdmConfigBuilder.Instance())); geoTask.Wait(); var result = geoTask.Result; if (result) { SendResponse(Response.Ok); } else { SendResponse(Response.NoLocAccess); } break; case Command.UpdateConfig: Logger.Info("signal received: updating configuration files"); try { AdmConfigBuilder.Instance().Load(); AdmConfigBuilder.Instance().LoadLocationData(); SendResponse(Response.Ok); } catch (Exception e) { Logger.Error(e, "could not read config file"); SendResponse(Response.Err); } break; case Command.Update: Logger.Info("signal received: checking for update"); SendResponse(UpdateHandler.CheckNewVersion()); break; case Command.Shutdown: Logger.Info("signal received, exiting"); SendResponse(Response.Ok); service.Exit(null, null); break; case Command.TestError: Logger.Info("signal received: test error"); SendResponse(Response.Err); break; case Command.Alive: Logger.Info("signal received: request for running status"); SendResponse(Response.Ok); break; case Command.Light: Logger.Info("signal received: force light theme"); rtc.ForcedTheme = Theme.Light; ThemeManager.SwitchTheme(builder.Config, Theme.Light); SendResponse(Response.Ok); break; case Command.Dark: Logger.Info("signal received: force dark theme"); rtc.ForcedTheme = Theme.Dark; ThemeManager.SwitchTheme(builder.Config, Theme.Dark); SendResponse(Response.Ok); break; case Command.NoForce: Logger.Info("signal received: resetting forced modes"); rtc.ForcedTheme = Theme.Undefined; ThemeManager.TimedSwitch(builder); SendResponse(Response.Ok); break; default: Logger.Debug("unknown message received"); SendResponse(Response.Err); break; } }); }
/// <summary> /// Parses a command message and invokes a callback function delegate for status reporting /// </summary> /// <param name="msg">list of messages to parse</param> /// <param name="SendResponse">Callback taking a string as parameter to report return values back to sender</param> /// <param name="service">Service class for invoking application exit</param> public static void Parse(List <string> msg, Action <string> SendResponse, Service service) { AdmConfigBuilder Properties = AdmConfigBuilder.Instance(); RuntimeConfig rtc = RuntimeConfig.Instance(); msg.ForEach(message => { switch (message) { case Command.Switch: Logger.Info("signal received: time based theme switch"); ThemeManager.TimedSwitch(Properties); SendResponse(Command.Ok); break; case Command.Swap: Logger.Info("signal received: swap themes"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.SwitchTheme(Properties.Config, Theme.Dark); } else { ThemeManager.SwitchTheme(Properties.Config, Theme.Light); } SendResponse(Command.Ok); break; case Command.AddAutostart: Logger.Info("signal received: adding service to autostart"); RegistryHandler.AddAutoStart(); SendResponse(Command.Ok); break; case Command.RemoveAutostart: Logger.Info("signal received: removing service from autostart"); RegistryHandler.RemoveAutoStart(); SendResponse(Command.Ok); break; case Command.CreateTask: Logger.Info("signal received: creating win scheduler based time switch task"); try { DateTime sunrise = Convert.ToDateTime(Properties.Config.Sunrise); DateTime sunset = Convert.ToDateTime(Properties.Config.Sunset); if (Properties.Config.Location.Enabled) { LocationHandler.GetSunTimesWithOffset(Properties, out sunrise, out sunset); } TaskSchdHandler.CreateSwitchTask(sunrise.Hour, sunrise.Minute, sunset.Hour, sunset.Minute); SendResponse(Command.Ok); } catch (FormatException e) { Logger.Error(e, "could not create win scheduler tasks"); SendResponse(Command.Err); Console.WriteLine(e); } break; case Command.RemoveTask: Logger.Info("signal received: removing win tasks"); TaskSchdHandler.RemoveTasks(); SendResponse(Command.Ok); break; case Command.Location: Logger.Info("signal received: request location update"); Task <bool> geoTask = Task.Run(() => LocationHandler.UpdateGeoposition(AdmConfigBuilder.Instance())); geoTask.Wait(); var result = geoTask.Result; if (result) { SendResponse(Command.Ok); } else { SendResponse(Command.NoLocAccess); } break; case Command.UpdateConfig: Logger.Info("signal received: updating configuration files"); try { AdmConfigBuilder.Instance().Load(); AdmConfigBuilder.Instance().LoadLocationData(); SendResponse(Command.Ok); } catch (Exception e) { Logger.Error(e, "could not read config file"); SendResponse(Command.Err); } break; case Command.Update: Logger.Info("signal received: checking for update"); SendResponse(UpdateHandler.CheckNewVersion()); break; case Command.Shutdown: Logger.Info("signal received, exiting"); SendResponse(Command.Ok); service.Exit(null, null); break; case Command.TestError: Logger.Info("signal received: test error"); SendResponse(Command.Err); break; case Command.Alive: Logger.Info("signal received: request for running status"); SendResponse(Command.Ok); break; case Command.Light: Logger.Info("signal received: force light theme"); rtc.ForcedTheme = Theme.Light; ThemeManager.SwitchTheme(Properties.Config, Theme.Light); SendResponse(Command.Ok); break; case Command.Dark: Logger.Info("signal received: force dark theme"); rtc.ForcedTheme = Theme.Dark; ThemeManager.SwitchTheme(Properties.Config, Theme.Dark); SendResponse(Command.Ok); break; case Command.NoForce: Logger.Info("signal received: resetting forced modes"); rtc.ForcedTheme = Theme.Undefined; ThemeManager.TimedSwitch(Properties); SendResponse(Command.Ok); break; default: Logger.Debug("unknown message received"); SendResponse(Command.Err); break; } }); }