CP-6093: Update the header bar with the name of the notifications view currently selected.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-11-07 10:00:53 +00:00
parent 94aa7ac531
commit 15f9d34181
6 changed files with 416 additions and 700 deletions

View File

@ -89,7 +89,7 @@
resources.ApplyResources(this.notificationsView, "notificationsView");
this.notificationsView.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.notificationsView.Name = "notificationsView";
this.notificationsView.NotificationsSubModeChanged += new System.Action<XenAdmin.Controls.MainWindowControls.NotificationsSubMode>(this.notificationsView_NotificationsSubModeChanged);
this.notificationsView.NotificationsSubModeChanged += new System.Action<XenAdmin.Controls.MainWindowControls.NotificationsSubModeItem>(this.notificationsView_NotificationsSubModeChanged);
//
// toolStripBig
//

View File

@ -60,7 +60,7 @@ namespace XenAdmin.Controls.MainWindowControls
public event Action<NavigationMode> NavigationModeChanged;
[Browsable(true)]
public event Action<NotificationsSubMode> NotificationsSubModeChanged;
public event Action<NotificationsSubModeItem> NotificationsSubModeChanged;
[Browsable(true)]
public event Action TreeViewSelectionChanged;
@ -358,10 +358,10 @@ namespace XenAdmin.Controls.MainWindowControls
}
}
private void notificationsView_NotificationsSubModeChanged(NotificationsSubMode subMode)
private void notificationsView_NotificationsSubModeChanged(NotificationsSubModeItem subModeItem)
{
if (NotificationsSubModeChanged != null)
NotificationsSubModeChanged(subMode);
NotificationsSubModeChanged(subModeItem);
}
#endregion

View File

@ -44,7 +44,7 @@ namespace XenAdmin.Controls.MainWindowControls
class NotificationsView : FlickerFreeListBox
{
[Browsable(true)]
public event Action<NotificationsSubMode> NotificationsSubModeChanged;
public event Action<NotificationsSubModeItem> NotificationsSubModeChanged;
public NotificationsView()
{
@ -127,13 +127,13 @@ namespace XenAdmin.Controls.MainWindowControls
var item = Items[SelectedIndex] as NotificationsSubModeItem;
if (item != null && NotificationsSubModeChanged != null)
NotificationsSubModeChanged(item.SubMode);
NotificationsSubModeChanged(item);
}
}
public enum NotificationsSubMode { Alerts, Updates, Events }
class NotificationsSubModeItem
public class NotificationsSubModeItem
{
public readonly NotificationsSubMode SubMode;

View File

@ -125,6 +125,9 @@ namespace XenAdmin
this.pluginItemsPlaceHolderToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customTemplatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.templatesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.localStorageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ShowHiddenObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator24 = new System.Windows.Forms.ToolStripSeparator();
this.pluginItemsPlaceHolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -266,9 +269,6 @@ namespace XenAdmin
this.MainMenuBar = new XenAdmin.Controls.MenuStripEx();
this.securityGroupsToolStripMenuItem = new XenAdmin.Commands.CommandToolStripMenuItem();
this.MenuPanel = new System.Windows.Forms.Panel();
this.templatesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.customTemplatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.localStorageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@ -309,7 +309,7 @@ namespace XenAdmin
//
resources.ApplyResources(this.navigationPane, "navigationPane");
this.navigationPane.Name = "navigationPane";
this.navigationPane.NotificationsSubModeChanged += new System.Action<XenAdmin.Controls.MainWindowControls.NotificationsSubMode>(this.navigationPane_NotificationsSubModeChanged);
this.navigationPane.NotificationsSubModeChanged += new System.Action<XenAdmin.Controls.MainWindowControls.NotificationsSubModeItem>(this.navigationPane_NotificationsSubModeChanged);
this.navigationPane.TreeViewRefreshResumed += new System.Action(this.navigationPane_TreeViewRefreshResumed);
this.navigationPane.TreeViewRefreshSuspended += new System.Action(this.navigationPane_TreeViewRefreshSuspended);
this.navigationPane.TreeViewSelectionChanged += new System.Action(this.navigationPane_TreeViewSelectionChanged);
@ -764,6 +764,24 @@ namespace XenAdmin
resources.ApplyResources(this.viewToolStripMenuItem, "viewToolStripMenuItem");
this.viewToolStripMenuItem.DropDownOpening += new System.EventHandler(this.topLevelMenu_DropDownOpening);
//
// customTemplatesToolStripMenuItem
//
this.customTemplatesToolStripMenuItem.Name = "customTemplatesToolStripMenuItem";
resources.ApplyResources(this.customTemplatesToolStripMenuItem, "customTemplatesToolStripMenuItem");
this.customTemplatesToolStripMenuItem.Click += new System.EventHandler(this.customTemplatesToolStripMenuItem_Click);
//
// templatesToolStripMenuItem1
//
this.templatesToolStripMenuItem1.Name = "templatesToolStripMenuItem1";
resources.ApplyResources(this.templatesToolStripMenuItem1, "templatesToolStripMenuItem1");
this.templatesToolStripMenuItem1.Click += new System.EventHandler(this.templatesToolStripMenuItem1_Click);
//
// localStorageToolStripMenuItem
//
this.localStorageToolStripMenuItem.Name = "localStorageToolStripMenuItem";
resources.ApplyResources(this.localStorageToolStripMenuItem, "localStorageToolStripMenuItem");
this.localStorageToolStripMenuItem.Click += new System.EventHandler(this.localStorageToolStripMenuItem_Click);
//
// ShowHiddenObjectsToolStripMenuItem
//
this.ShowHiddenObjectsToolStripMenuItem.Name = "ShowHiddenObjectsToolStripMenuItem";
@ -1724,24 +1742,6 @@ namespace XenAdmin
resources.ApplyResources(this.MenuPanel, "MenuPanel");
this.MenuPanel.Name = "MenuPanel";
//
// templatesToolStripMenuItem1
//
this.templatesToolStripMenuItem1.Name = "templatesToolStripMenuItem1";
resources.ApplyResources(this.templatesToolStripMenuItem1, "templatesToolStripMenuItem1");
this.templatesToolStripMenuItem1.Click += new System.EventHandler(this.templatesToolStripMenuItem1_Click);
//
// customTemplatesToolStripMenuItem
//
this.customTemplatesToolStripMenuItem.Name = "customTemplatesToolStripMenuItem";
resources.ApplyResources(this.customTemplatesToolStripMenuItem, "customTemplatesToolStripMenuItem");
this.customTemplatesToolStripMenuItem.Click += new System.EventHandler(this.customTemplatesToolStripMenuItem_Click);
//
// localStorageToolStripMenuItem
//
this.localStorageToolStripMenuItem.Name = "localStorageToolStripMenuItem";
resources.ApplyResources(this.localStorageToolStripMenuItem, "localStorageToolStripMenuItem");
this.localStorageToolStripMenuItem.Click += new System.EventHandler(this.localStorageToolStripMenuItem_Click);
//
// MainWindow
//
resources.ApplyResources(this, "$this");

View File

@ -2430,6 +2430,9 @@ namespace XenAdmin
/// </summary>
private void UpdateHeader()
{
if (!TheTabControl.Visible)
return;
if (SearchMode && SearchPage.Search != null)
{
TitleLabel.Text = HelpersGUI.GetLocalizedSearchName(SearchPage.Search);
@ -2527,12 +2530,12 @@ namespace XenAdmin
UpdateHeader();
}
private void navigationPane_NotificationsSubModeChanged(NotificationsSubMode submode)
private void navigationPane_NotificationsSubModeChanged(NotificationsSubModeItem submodeItem)
{
TheTabControl.Visible = false;
alertPage.Visible = submode == NotificationsSubMode.Alerts;
updatesPage.Visible = submode == NotificationsSubMode.Updates;
eventsPage.Visible = submode == NotificationsSubMode.Events;
alertPage.Visible = submodeItem.SubMode == NotificationsSubMode.Alerts;
updatesPage.Visible = submodeItem.SubMode == NotificationsSubMode.Updates;
eventsPage.Visible = submodeItem.SubMode == NotificationsSubMode.Events;
if (alertPage.Visible)
alertPage.RefreshAlertList();
@ -2551,6 +2554,10 @@ namespace XenAdmin
eventsPage.RefreshDisplayedEvents();
RequestRefreshTreeView();
}
loggedInLabel1.Connection = null;
TitleLabel.Text = submodeItem.Text;
TitleIcon.Image = submodeItem.Image;
}
private void navigationPane_NavigationModeChanged(NavigationPane.NavigationMode mode)

File diff suppressed because it is too large Load Diff