Skip to content

Commit

Permalink
add option to disable timer debug msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiritreader committed Oct 4, 2021
1 parent 1a2995f commit d0c632e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions AutoDarkModeConfig/AdmConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public int BatterySliderDefaultValue
public bool DisableEnergySaverOnThemeSwitch { get; set; }
public bool UseLogonTask { get; set; }
public bool Debug { get; set; }
public bool DebugTimerMessage { get; set; }
public bool ShowTrayIcon { get; set; } = true;
}

Expand Down
8 changes: 7 additions & 1 deletion AutoDarkModeSvc/Timers/ModuleTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Timers;
using AutoDarkModeSvc.Config;
using AutoDarkModeConfig;

namespace AutoDarkModeSvc.Timers
{
Expand All @@ -13,6 +14,7 @@ class ModuleTimer
private Timer Timer { get; set; }
public string Name { get; }
private bool TickOnStart { get; }
AdmConfigBuilder builder = AdmConfigBuilder.Instance();

/// <summary>
/// A ModuleTimer runs with a preset interval and periodically call registered <see cref="IAutoDarkModeModule"/> modules
Expand All @@ -36,7 +38,11 @@ private void OnTimedEvent(object source, ElapsedEventArgs e)
{
// copying allows dynamic updates of the Module list since it can only be changed once every OnTimedEvent
List<IAutoDarkModeModule> ready = new(Modules);
Logger.Debug($"{Name}timer signal received");
if (builder.Config.Tunable.DebugTimerMessage)
{
Logger.Debug($"{Name}timer signal received");
}

ready.ForEach(t =>
{
t.Fire();
Expand Down

0 comments on commit d0c632e

Please sign in to comment.