Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
restart on resolution change
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Higgins committed Oct 5, 2020
1 parent 9830a48 commit a7163e8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CenterTaskbar/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ public void RemoveApplicationFromStartup()
}
}

private static void Exit(object sender, EventArgs e)
private void Exit(object sender, EventArgs e)
{
SystemEvents.DisplaySettingsChanging -= SystemEvents_DisplaySettingsChanged;
Application.ExitThread();
}

Expand Down Expand Up @@ -261,6 +262,13 @@ private void Start()
_uiaEventHandler = OnUIAutomationEvent;
Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, Desktop, TreeScope.Subtree, _uiaEventHandler);
Automation.AddAutomationEventHandler(WindowPattern.WindowClosedEvent, Desktop, TreeScope.Subtree, _uiaEventHandler);

SystemEvents.DisplaySettingsChanging += SystemEvents_DisplaySettingsChanged;
}

private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
{
Restart(sender, e);
}

private void OnUIAutomationEvent(object src, AutomationEventArgs e)
Expand Down

0 comments on commit a7163e8

Please sign in to comment.