From b7a03c1a619a32dff9eb149bedd79725c1736022 Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Sun, 31 Oct 2021 09:27:20 +1300 Subject: [PATCH] Update the right-click icon menu more consistently This should ensure that the shortcut and profile menus available from right click of the DisplayMagician system tray icon are updated more reliably. They should apply properly now. --- DisplayMagician/UIForms/DisplayProfileForm.cs | 13 ++++++------- DisplayMagician/UIForms/MainForm.cs | 12 ++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/DisplayMagician/UIForms/DisplayProfileForm.cs b/DisplayMagician/UIForms/DisplayProfileForm.cs index 2d64d8b..0fa6c23 100644 --- a/DisplayMagician/UIForms/DisplayProfileForm.cs +++ b/DisplayMagician/UIForms/DisplayProfileForm.cs @@ -223,13 +223,6 @@ namespace DisplayMagician.UIForms } - // Also refresh the right-click menu (if we have a main form loaded) - if (Program.AppMainForm is Form) - { - Program.AppMainForm.RefreshNotifyIconMenus(); - } - - // Restart updating the saved_profiles listview ilv_saved_profiles.ResumeLayout(); } @@ -332,6 +325,12 @@ namespace DisplayMagician.UIForms // Refresh the image list view //RefreshImageListView(profile); + // Also refresh the right-click menu (if we have a main form loaded) + if (Program.AppMainForm is Form) + { + Program.AppMainForm.RefreshNotifyIconMenus(); + } + // And finally refresh the profile in the display view dv_profile.Profile = profile; dv_profile.Refresh(); diff --git a/DisplayMagician/UIForms/MainForm.cs b/DisplayMagician/UIForms/MainForm.cs index 1c1c378..5748e2c 100644 --- a/DisplayMagician/UIForms/MainForm.cs +++ b/DisplayMagician/UIForms/MainForm.cs @@ -407,6 +407,12 @@ namespace DisplayMagician.UIForms // Run the shortcut if it's still there if (profileToRun != null) ProfileRepository.ApplyProfile(profileToRun); + + // Also refresh the right-click menu (if we have a main form loaded) + if (Program.AppMainForm is Form) + { + Program.AppMainForm.RefreshNotifyIconMenus(); + } } } @@ -428,6 +434,12 @@ namespace DisplayMagician.UIForms // Run the shortcut if it's still there if (shortcutToRun != null) ShortcutRepository.RunShortcut(shortcutToRun, notifyIcon); + + // Also refresh the right-click menu (if we have a main form loaded) + if (Program.AppMainForm is Form) + { + Program.AppMainForm.RefreshNotifyIconMenus(); + } } }