Skip to content

Commit

Permalink
Fixed several issues with context menu items:
Browse files Browse the repository at this point in the history
1. Double separator
2. Extra check for updates menu in sub instance menu
3. Inconsistent ordering of menu items.
  • Loading branch information
mscrivo committed Jul 3, 2015
1 parent c25b129 commit db0e78a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions OutlookDesktop/Forms/InstanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ public void LoadInstances()
{
_mainFormInstances[instanceName].TrayMenu.Items["LockPositionMenu"].Visible = false;
}
if (_mainFormInstances[instanceName].TrayMenu.Items.ContainsKey("CheckForUpdatesMenu"))
{
_mainFormInstances[instanceName].TrayMenu.Items["CheckForUpdatesMenu"].Visible = false;
}

_mainFormInstances[instanceName].TrayMenu.Items["Separator6"].Visible = false;
_mainFormInstances[instanceName].TrayMenu.Items["ExitMenu"].Visible = false;

Expand All @@ -194,8 +199,8 @@ public void LoadInstances()

trayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator());

trayIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.CheckForUpdates, null, CheckForUpdates_Click, "CheckForUpdatesMenu"));
trayIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.About, null, AboutMenu_Click, "AboutMenu"));
trayIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem(Resources.CheckForUpdates, null, CheckForUpdates_Click, "CheckForUpdatesMenu"));

trayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator());

Expand Down Expand Up @@ -243,6 +248,10 @@ public void LoadInstances()
{
_mainFormInstances[instanceName].TrayMenu.Items["LockPositionMenu"].Visible = true;
}
if (_mainFormInstances[instanceName].TrayMenu.Items.ContainsKey("CheckForUpdatesMenu"))
{
_mainFormInstances[instanceName].TrayMenu.Items["CheckForUpdatesMenu"].Visible = true;
}

// add global menu items that don't apply to the instance.
if (!trayIcon.ContextMenuStrip.Items.ContainsKey("AddInstanceMenu"))
Expand All @@ -264,14 +273,15 @@ public void LoadInstances()

if (!trayIcon.ContextMenuStrip.Items.ContainsKey("CheckForUpdatesMenu"))
{
trayIcon.ContextMenuStrip.Items.Insert(19, new ToolStripMenuItem(Resources.CheckForUpdates, null, CheckForUpdates_Click, "CheckForUpdatesMenu"));
trayIcon.ContextMenuStrip.Items.Insert(20, new ToolStripMenuItem(Resources.CheckForUpdates, null, CheckForUpdates_Click, "CheckForUpdatesMenu"));
}

if (!trayIcon.ContextMenuStrip.Items.ContainsKey("AboutMenu"))
{
trayIcon.ContextMenuStrip.Items.Insert(19, new ToolStripMenuItem(Resources.About, null, AboutMenu_Click, "AboutMenu"));
trayIcon.ContextMenuStrip.Items.Insert(20, new ToolStripMenuItem(Resources.About, null, AboutMenu_Click, "AboutMenu"));
}

_mainFormInstances[instanceName].TrayMenu.Items["Separator6"].Visible = true;
_mainFormInstances[instanceName].TrayMenu.Items["ExitMenu"].Visible = true;

if (newlyAdded)
Expand Down Expand Up @@ -326,7 +336,7 @@ private void ExitMenu_Click(object sender, EventArgs e)

private void AddInstanceMenu_Click(object sender, EventArgs e)
{
var result = InputBox.Show(this, "", Resources.NewInstanceName, String.Empty, InputBox_Validating);
var result = InputBox.Show(this, "", Resources.NewInstanceName, string.Empty, InputBox_Validating);
if (result.Ok)
{
// trigger the tray icon context menu to show the second instance
Expand Down

0 comments on commit db0e78a

Please sign in to comment.