mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed Game Shortcut Hotkeys
Fixed the Game Shortcut hotkeys so that they work properly. Some late code changes yesterday broke them :(. Sorry for the inconvenience! Also stopped the annoying 'bing' everytime the notification toasts were created by DisplayMagician when it did things. They are now silent except for the ones that actually require your attention, which should stop it all being quite so jarring.
This commit is contained in:
parent
d504ee0af1
commit
9ec7b58f89
@ -732,74 +732,6 @@ namespace DisplayMagician {
|
|||||||
|
|
||||||
logger.Debug($"Program/LoadGamesInBackground: Starting");
|
logger.Debug($"Program/LoadGamesInBackground: Starting");
|
||||||
// Now lets prepare loading all the Steam games we have installed
|
// Now lets prepare loading all the Steam games we have installed
|
||||||
|
|
||||||
/*Task loadSteamGamesTask = new Task(() =>
|
|
||||||
{
|
|
||||||
// Check if Steam is installed
|
|
||||||
GameLibrary steamLibrary = SteamLibrary.GetLibrary();
|
|
||||||
if (steamLibrary.IsGameLibraryInstalled)
|
|
||||||
{
|
|
||||||
// Load Steam library games
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loading Installed Steam Games");
|
|
||||||
if (!steamLibrary.LoadInstalledGames())
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Cannot load installed Steam Games!");
|
|
||||||
}
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loaded all Installed Steam Games (found {steamLibrary.InstalledGameCount})");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Steam not installed.");
|
|
||||||
Console.WriteLine("Steam not installed.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Now lets prepare loading all the Uplay games we have installed
|
|
||||||
Task loadUplayGamesTask = new Task(() =>
|
|
||||||
{
|
|
||||||
// Check if Uplay is installed
|
|
||||||
GameLibrary uplayLibrary = SteamLibrary.GetLibrary();
|
|
||||||
if (uplayLibrary.IsGameLibraryInstalled)
|
|
||||||
{
|
|
||||||
// Load Uplay library games
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loading Installed Uplay Games");
|
|
||||||
if (!uplayLibrary.LoadInstalledGames())
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Cannot load installed Uplay Games!");
|
|
||||||
}
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loaded all Installed Uplay Games (found {uplayLibrary.InstalledGameCount})");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Uplay not installed.");
|
|
||||||
Console.WriteLine("Uplay not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Now lets prepare loading all the Origin games we have installed
|
|
||||||
Task loadOriginGamesTask = new Task(() =>
|
|
||||||
{
|
|
||||||
// Check if Origin is installed
|
|
||||||
GameLibrary originLibrary = SteamLibrary.GetLibrary();
|
|
||||||
if (originLibrary.IsGameLibraryInstalled)
|
|
||||||
{
|
|
||||||
// Load Origin library games
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loading Installed Origin Games");
|
|
||||||
if (!originLibrary.LoadInstalledGames())
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Cannot load installed Origin Games!");
|
|
||||||
}
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Loaded all Installed Origin Games (found {originLibrary.InstalledGameCount})");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.Info($"Program/LoadGamesInBackground: Origin not installed.");
|
|
||||||
Console.WriteLine("Origin not installed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
});*/
|
|
||||||
|
|
||||||
Action loadSteamGamesAction = new Action(() =>
|
Action loadSteamGamesAction = new Action(() =>
|
||||||
{
|
{
|
||||||
// Check if Steam is installed
|
// Check if Steam is installed
|
||||||
|
@ -982,7 +982,8 @@ namespace DisplayMagician
|
|||||||
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=runningApplication", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=runningApplication", ToastActivationType.Foreground)
|
||||||
.AddText($"Running {processNameToLookFor}", hintMaxLines: 1)
|
.AddText($"Running {processNameToLookFor}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for all {processNameToLookFor} windows to exit...");
|
.AddText($"Waiting for all {processNameToLookFor} windows to exit...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"),false,true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
ToastContent toastContent = tcBuilder.Content;
|
ToastContent toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -990,6 +991,7 @@ namespace DisplayMagician
|
|||||||
doc.LoadXml(toastContent.GetContent());
|
doc.LoadXml(toastContent.GetContent());
|
||||||
// And create the toast notification
|
// And create the toast notification
|
||||||
var toast = new ToastNotification(doc);
|
var toast = new ToastNotification(doc);
|
||||||
|
toast.SuppressPopup = false;
|
||||||
// Remove any other Notifications from us
|
// Remove any other Notifications from us
|
||||||
DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
|
DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
|
||||||
// And then show this notification
|
// And then show this notification
|
||||||
@ -1028,7 +1030,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
||||||
.AddText($"{processNameToLookFor} was closed", hintMaxLines: 1)
|
.AddText($"{processNameToLookFor} was closed", hintMaxLines: 1)
|
||||||
.AddText($"All {processNameToLookFor} processes were shutdown and changes were reverted.");
|
.AddText($"All {processNameToLookFor} processes were shutdown and changes were reverted.")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
@ -1078,7 +1081,8 @@ namespace DisplayMagician
|
|||||||
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo($"notify=starting{gameLibraryToUse.GameLibraryName}", ToastActivationType.Foreground)
|
.AddToastActivationInfo($"notify=starting{gameLibraryToUse.GameLibraryName}", ToastActivationType.Foreground)
|
||||||
.AddText($"Starting {gameLibraryToUse.GameLibraryName}", hintMaxLines: 1)
|
.AddText($"Starting {gameLibraryToUse.GameLibraryName}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for {gameLibraryToUse.GameLibraryName} Game Library to start (and update if needed)...");
|
.AddText($"Waiting for {gameLibraryToUse.GameLibraryName} Game Library to start (and update if needed)...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
ToastContent toastContent = tcBuilder.Content;
|
ToastContent toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -1144,7 +1148,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo($"notify=updating{gameLibraryToUse.GameLibraryName}", ToastActivationType.Foreground)
|
.AddToastActivationInfo($"notify=updating{gameLibraryToUse.GameLibraryName}", ToastActivationType.Foreground)
|
||||||
.AddText($"Updating {gameLibraryToUse.GameLibraryName}", hintMaxLines: 1)
|
.AddText($"Updating {gameLibraryToUse.GameLibraryName}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for {gameLibraryToUse.GameLibraryName} Game Library to update itself...");
|
.AddText($"Waiting for {gameLibraryToUse.GameLibraryName} Game Library to update itself...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -1193,7 +1198,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo($"notify=updating{gameToRun.Name}", ToastActivationType.Foreground)
|
.AddToastActivationInfo($"notify=updating{gameToRun.Name}", ToastActivationType.Foreground)
|
||||||
.AddText($"Updating {gameToRun.Name}", hintMaxLines: 1)
|
.AddText($"Updating {gameToRun.Name}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for {gameToRun.Name} Game to update...");
|
.AddText($"Waiting for {gameToRun.Name} Game to update...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -1349,7 +1355,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
||||||
.AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
|
.AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
|
||||||
.AddText($"{shortcutToUse.GameName} game was exited.");
|
.AddText($"{shortcutToUse.GameName} game was exited.")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
@ -1374,7 +1381,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo($"notify=running{gameLibraryToUse.GameLibraryName}Game", ToastActivationType.Foreground)
|
.AddToastActivationInfo($"notify=running{gameLibraryToUse.GameLibraryName}Game", ToastActivationType.Foreground)
|
||||||
.AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
|
.AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for the {altGameProcessToMonitor} alternative game process to exit...");
|
.AddText($"Waiting for the {altGameProcessToMonitor} alternative game process to exit...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -1409,7 +1417,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
||||||
.AddText($"{altGameProcessToMonitor} was closed", hintMaxLines: 1)
|
.AddText($"{altGameProcessToMonitor} was closed", hintMaxLines: 1)
|
||||||
.AddText($"{altGameProcessToMonitor} alternative game executable was exited.");
|
.AddText($"{altGameProcessToMonitor} alternative game executable was exited.")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
@ -1438,7 +1447,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo($"notify=running{gameLibraryToUse.GameLibraryName}Game", ToastActivationType.Foreground)
|
.AddToastActivationInfo($"notify=running{gameLibraryToUse.GameLibraryName}Game", ToastActivationType.Foreground)
|
||||||
.AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
|
.AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
|
||||||
.AddText($"Waiting for the {gameLibraryToUse.GameLibraryName} Game {gameToRun.Name} to exit...");
|
.AddText($"Waiting for the {gameLibraryToUse.GameLibraryName} Game {gameToRun.Name} to exit...")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
@ -1518,7 +1528,8 @@ namespace DisplayMagician
|
|||||||
tcBuilder = new ToastContentBuilder()
|
tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
|
||||||
.AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
|
.AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
|
||||||
.AddText($"{shortcutToUse.GameName} game was exited.");
|
.AddText($"{shortcutToUse.GameName} game was exited.")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
toastContent = tcBuilder.Content;
|
toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
@ -1574,7 +1585,8 @@ namespace DisplayMagician
|
|||||||
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
ToastContentBuilder tcBuilder = new ToastContentBuilder()
|
||||||
.AddToastActivationInfo("notify=minimiseStart&action=open", ToastActivationType.Foreground)
|
.AddToastActivationInfo("notify=minimiseStart&action=open", ToastActivationType.Foreground)
|
||||||
.AddText("DisplayMagician is minimised", hintMaxLines: 1)
|
.AddText("DisplayMagician is minimised", hintMaxLines: 1)
|
||||||
.AddButton("Open", ToastActivationType.Background, "notify=minimiseStart&action=open");
|
.AddButton("Open", ToastActivationType.Background, "notify=minimiseStart&action=open")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
ToastContent toastContent = tcBuilder.Content;
|
ToastContent toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
|
@ -224,7 +224,8 @@ namespace DisplayMagician.UIForms
|
|||||||
.AddText("DisplayMagician is still running...", hintMaxLines: 1)
|
.AddText("DisplayMagician is still running...", hintMaxLines: 1)
|
||||||
.AddText("DisplayMagician will wait in the background until you need it.")
|
.AddText("DisplayMagician will wait in the background until you need it.")
|
||||||
.AddButton("Open DisplayMagician", ToastActivationType.Background, "notify=stillRunning&action=open")
|
.AddButton("Open DisplayMagician", ToastActivationType.Background, "notify=stillRunning&action=open")
|
||||||
.AddButton("Exit DisplayMagician", ToastActivationType.Background, "notify=stillRunning&action=exit");
|
.AddButton("Exit DisplayMagician", ToastActivationType.Background, "notify=stillRunning&action=exit")
|
||||||
|
.AddAudio(new Uri("ms-winsoundevent:Notification.Default"), false, true);
|
||||||
ToastContent toastContent = tcBuilder.Content;
|
ToastContent toastContent = tcBuilder.Content;
|
||||||
// Make sure to use Windows.Data.Xml.Dom
|
// Make sure to use Windows.Data.Xml.Dom
|
||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
|
@ -2021,10 +2021,13 @@ namespace DisplayMagician.UIForms
|
|||||||
displayHotkeyForm.ShowDialog(this);
|
displayHotkeyForm.ShowDialog(this);
|
||||||
if (displayHotkeyForm.DialogResult == DialogResult.OK)
|
if (displayHotkeyForm.DialogResult == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
// If the hotkey has changed, then set the unsaved warning to true
|
||||||
|
if (!_hotkey.Equals(displayHotkeyForm.Hotkey))
|
||||||
|
_isUnsaved = true;
|
||||||
// now we store the Hotkey to be saved later
|
// now we store the Hotkey to be saved later
|
||||||
_hotkey = displayHotkeyForm.Hotkey;
|
_hotkey = displayHotkeyForm.Hotkey;
|
||||||
// And if we get back and this is a Hotkey with a value, we need to show that in the UI
|
// And if we get back and this is a Hotkey with a value, we need to show that in the UI
|
||||||
UpdateHotkeyLabel(_shortcutToEdit.Hotkey);
|
UpdateHotkeyLabel(_hotkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user