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.
This commit is contained in:
Terry MacDonald 2021-10-31 09:27:20 +13:00
parent 1ef9e5b818
commit b7a03c1a61
2 changed files with 18 additions and 7 deletions

View File

@ -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 // Restart updating the saved_profiles listview
ilv_saved_profiles.ResumeLayout(); ilv_saved_profiles.ResumeLayout();
} }
@ -332,6 +325,12 @@ namespace DisplayMagician.UIForms
// Refresh the image list view // Refresh the image list view
//RefreshImageListView(profile); //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 // And finally refresh the profile in the display view
dv_profile.Profile = profile; dv_profile.Profile = profile;
dv_profile.Refresh(); dv_profile.Refresh();

View File

@ -407,6 +407,12 @@ namespace DisplayMagician.UIForms
// Run the shortcut if it's still there // Run the shortcut if it's still there
if (profileToRun != null) if (profileToRun != null)
ProfileRepository.ApplyProfile(profileToRun); 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 // Run the shortcut if it's still there
if (shortcutToRun != null) if (shortcutToRun != null)
ShortcutRepository.RunShortcut(shortcutToRun, notifyIcon); 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();
}
} }
} }