From dd85aeb0f1c0783d95739429652ecd5f76eb56fb Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Wed, 4 Nov 2020 18:47:41 +1300 Subject: [PATCH] Fixed notification icon menu Also fixed console messages as well. The programme is just about working properly! I'm going to start creating branches now as it is nearly at ready for a v1.0! --- HeliosPlus/ShortcutItem.cs | 4 ++-- HeliosPlus/ShortcutRepository.cs | 10 ++++----- HeliosPlus/UIForms/MainForm.cs | 36 ++++++++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/HeliosPlus/ShortcutItem.cs b/HeliosPlus/ShortcutItem.cs index ccaead9..c7c5d2e 100644 --- a/HeliosPlus/ShortcutItem.cs +++ b/HeliosPlus/ShortcutItem.cs @@ -1218,7 +1218,7 @@ namespace HeliosPlus } else { - bm = IconFromFile.GetLargeBitmapFromFile(fileNameAndPath, true, true); + bm = IconFromFile.GetLargeBitmapFromFile(fileNameAndPath, true, false); } return bm; } @@ -1237,7 +1237,7 @@ namespace HeliosPlus } else { - bm = IconFromFile.GetSmallBitmapFromFile(fileNameAndPath, false, true, false); + bm = IconFromFile.GetSmallBitmapFromFile(fileNameAndPath, false, false, false); } return bm; } diff --git a/HeliosPlus/ShortcutRepository.cs b/HeliosPlus/ShortcutRepository.cs index 10e26a3..0b72c7e 100644 --- a/HeliosPlus/ShortcutRepository.cs +++ b/HeliosPlus/ShortcutRepository.cs @@ -499,14 +499,14 @@ namespace HeliosPlus // Now run the pre-start applications List startProgramsToStop = new List(); - if (shortcutToUse.StartPrograms is List && shortcutToUse.StartPrograms.Count > 0) + List startProgramsToStart = shortcutToUse.StartPrograms.Where(program => program.Enabled == true).OrderBy(program => program.Priority).ToList(); + if (startProgramsToStart.Count > 0) { - Console.WriteLine("Starting programs before main game/executable:"); - foreach (StartProgram processToStart in shortcutToUse.StartPrograms - .Where(program => program.Enabled == true) - .OrderBy(program => program.Priority)) + foreach (StartProgram processToStart in startProgramsToStart) { // Start the executable + Console.WriteLine("Starting programs before main game/executable:"); + Console.WriteLine($" - Starting process {processToStart.Executable}"); Process process = null; if (processToStart.ExecutableArgumentsRequired) diff --git a/HeliosPlus/UIForms/MainForm.cs b/HeliosPlus/UIForms/MainForm.cs index ebc290b..98fda4d 100644 --- a/HeliosPlus/UIForms/MainForm.cs +++ b/HeliosPlus/UIForms/MainForm.cs @@ -144,12 +144,44 @@ namespace HeliosPlus.UIForms private void runProfileToolStripMenuItem_Click(object sender, EventArgs e) { - this.Show(); + var menuItem = sender as ToolStripMenuItem; + ProfileItem profileToRun = null; + if (menuItem != null) + { + foreach (ProfileItem profile in ProfileRepository.AllProfiles) + { + if (profile.Name.Equals(menuItem.Text)) + { + profileToRun = profile; + break; + } + } + + // Run the shortcut if it's still there + if (profileToRun != null) + Program.ApplyProfile(profileToRun); + } } private void runShortcutToolStripMenuItem_Click(object sender, EventArgs e) { - this.Show(); + var menuItem = sender as ToolStripMenuItem; + ShortcutItem shortcutToRun = null; + if (menuItem != null) + { + foreach (ShortcutItem shortcut in ShortcutRepository.AllShortcuts) + { + if (shortcut.Name.Equals(menuItem.Text)) + { + shortcutToRun = shortcut; + break; + } + } + + // Run the shortcut if it's still there + if (shortcutToRun != null) + ShortcutRepository.RunShortcut(shortcutToRun); + } } private void openApplicationWindowToolStripMenuItem_Click(object sender, EventArgs e)