public void SwitchMonitorMode(bool restore = false, bool disableMons = false, int x = 1920, int y = 1080) { if (restore) { for (int i = 0; i < monitorsToDisable.Count; i++) // for some reason loading the original config will only re-enable a single monitor so we must run this for each monitor we disabled { RunScript(multimonitortoolPath, "/loadConfig \"" + multimonitortoolConfigName + "\""); Thread.Sleep(3000); } MonitorModeMulti?.Invoke(this, new MonitorInfoEventArgs() { MonitorsToDisable = monitorsToDisable }); } else { if (disableMons) { RunScript(multimonitortoolPath, "/disable " + String.Join(" ", monitorsToDisable.ToArray())); Thread.Sleep(3000); } RunScript(nircmdPath, "setdisplay " + x + " " + y + " 32"); MonitorModeSingle?.Invoke(this, new MonitorInfoEventArgs() { MonitorsToDisable = monitorsToDisable }); } }
public void SwitchMonitorMode(bool restore = false) { if (restore) { foreach (string monitor in monitorsToDisable) // for some reason loading the original config will only re-enable a single monitor so we must run this for each monitor we disabled { RunScript(multimonitortoolPath, "/loadConfig \"" + multimonitortoolConfigName + "\""); } MonitorModeMulti?.Invoke(this, new MonitorInfoEventArgs() { MonitorsToDisable = monitorsToDisable }); } else { RunScript(multimonitortoolPath, "/disable " + String.Join(" ", monitorsToDisable.ToArray())); MonitorModeSingle?.Invoke(this, new MonitorInfoEventArgs() { MonitorsToDisable = monitorsToDisable }); } }