Added additional places to refresh notification icons

This should hopefully cover all the instances of when we need to update the notification icons to refresh the correct profiles and game shortcuts.
This commit is contained in:
Terry MacDonald 2021-10-31 09:50:34 +13:00
parent b7a03c1a61
commit 340e1a6db0
2 changed files with 43 additions and 6 deletions

View File

@ -69,6 +69,12 @@ namespace DisplayMagician.UIForms
{ {
logger.Warn($"DisplayProfileForm/Apply_Click: Error applying the Profile {_selectedProfile.Name}. Unable to change the display layout."); logger.Warn($"DisplayProfileForm/Apply_Click: Error applying the Profile {_selectedProfile.Name}. Unable to change the display layout.");
} }
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
@ -124,6 +130,12 @@ namespace DisplayMagician.UIForms
} }
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private void Save_Click(object sender, EventArgs e) private void Save_Click(object sender, EventArgs e)
@ -178,6 +190,7 @@ namespace DisplayMagician.UIForms
{ {
MessageBox.Show(ex.Message, Language.Shortcut, MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(ex.Message, Language.Shortcut, MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
} }
} }
@ -431,6 +444,12 @@ namespace DisplayMagician.UIForms
// now update the profiles image listview // now update the profiles image listview
RefreshDisplayProfileUI(); RefreshDisplayProfileUI();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private void ilv_saved_profiles_ItemClick(object sender, ItemClickEventArgs e) private void ilv_saved_profiles_ItemClick(object sender, ItemClickEventArgs e)

View File

@ -102,12 +102,6 @@ namespace DisplayMagician.UIForms
// Restart updating the saved_profiles listview // Restart updating the saved_profiles listview
ilv_saved_shortcuts.ResumeLayout(); ilv_saved_shortcuts.ResumeLayout();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private ShortcutItem GetShortcutFromName(string shortcutName) private ShortcutItem GetShortcutFromName(string shortcutName)
@ -207,6 +201,7 @@ namespace DisplayMagician.UIForms
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.Warn(ex, $"ShortcutLibraryForm/btn_save_Click: Exception saving shortcut to {dialog_save.FileName}.");
MessageBox.Show(ex.Message, Language.Shortcut, MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(ex.Message, Language.Shortcut, MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
} }
@ -282,6 +277,11 @@ namespace DisplayMagician.UIForms
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
RemoveWarningIfShortcuts(); RemoveWarningIfShortcuts();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private void btn_edit_Click(object sender, EventArgs e) private void btn_edit_Click(object sender, EventArgs e)
@ -328,6 +328,12 @@ namespace DisplayMagician.UIForms
} }
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
} }
@ -365,6 +371,12 @@ namespace DisplayMagician.UIForms
ShortcutRepository.IsValidRefresh(); ShortcutRepository.IsValidRefresh();
RefreshShortcutLibraryUI(); RefreshShortcutLibraryUI();
RemoveWarningIfShortcuts(); RemoveWarningIfShortcuts();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private void btn_run_Click(object sender, EventArgs e) private void btn_run_Click(object sender, EventArgs e)
@ -437,6 +449,12 @@ namespace DisplayMagician.UIForms
lbl_mask.Visible = false; lbl_mask.Visible = false;
lbl_mask.SendToBack(); lbl_mask.SendToBack();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
} }
private void ilv_saved_shortcuts_ItemHover(object sender, ItemHoverEventArgs e) private void ilv_saved_shortcuts_ItemHover(object sender, ItemHoverEventArgs e)