Added outlook style status labels showing the number of various types of notifications.

The labels are additionally clickable and navigate to the corresponding panel.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2020-03-24 02:07:15 +00:00 committed by Mihaela Stoica
parent 0fa374313f
commit fd497a1370
6 changed files with 189 additions and 26 deletions

View File

@ -218,7 +218,7 @@ namespace XenAdmin.Controls.MainWindowControls
buttonInfraBig.Checked = true;
}
private void SwitchToNotificationsView(NotificationsSubMode subMode)
public void SwitchToNotificationsView(NotificationsSubMode subMode)
{
//check the button if switching has been requested programmatically
if (!buttonNotifyBig.Checked)

View File

@ -280,6 +280,9 @@ namespace XenAdmin
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusProgressBar = new System.Windows.Forms.ToolStripProgressBar();
this.toolStripMenuItemInstallCertificate = new XenAdmin.Commands.CommandToolStripMenuItem();
this.statusLabelAlerts = new System.Windows.Forms.ToolStripStatusLabel();
this.statusLabelUpdates = new System.Windows.Forms.ToolStripStatusLabel();
this.statusLabelErrors = new System.Windows.Forms.ToolStripStatusLabel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -1879,8 +1882,11 @@ namespace XenAdmin
//
resources.ApplyResources(this.StatusStrip, "StatusStrip");
this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.statusProgressBar,
this.statusLabel,
this.statusProgressBar});
this.statusLabelAlerts,
this.statusLabelUpdates,
this.statusLabelErrors});
this.StatusStrip.Name = "StatusStrip";
this.StatusStrip.ShowItemToolTips = true;
//
@ -1905,6 +1911,42 @@ namespace XenAdmin
this.toolStripMenuItemInstallCertificate.Name = "toolStripMenuItemInstallCertificate";
resources.ApplyResources(this.toolStripMenuItemInstallCertificate, "toolStripMenuItemInstallCertificate");
//
// statusLabelAlerts
//
this.statusLabelAlerts.ActiveLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelAlerts.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelAlerts.IsLink = true;
this.statusLabelAlerts.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
this.statusLabelAlerts.LinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelAlerts.Name = "statusLabelAlerts";
resources.ApplyResources(this.statusLabelAlerts, "statusLabelAlerts");
this.statusLabelAlerts.VisitedLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelAlerts.Click += new System.EventHandler(this.statusLabelAlerts_Click);
//
// statusLabelUpdates
//
this.statusLabelUpdates.ActiveLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelUpdates.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelUpdates.IsLink = true;
this.statusLabelUpdates.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
this.statusLabelUpdates.LinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelUpdates.Name = "statusLabelUpdates";
resources.ApplyResources(this.statusLabelUpdates, "statusLabelUpdates");
this.statusLabelUpdates.VisitedLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelUpdates.Click += new System.EventHandler(this.statusLabelUpdates_Click);
//
// statusLabelErrors
//
this.statusLabelErrors.ActiveLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelErrors.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelErrors.IsLink = true;
this.statusLabelErrors.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
this.statusLabelErrors.LinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelErrors.Name = "statusLabelErrors";
resources.ApplyResources(this.statusLabelErrors, "statusLabelErrors");
this.statusLabelErrors.VisitedLinkColor = System.Drawing.SystemColors.ControlDarkDark;
this.statusLabelErrors.Click += new System.EventHandler(this.statusLabelErrors_Click);
//
// MainWindow
//
resources.ApplyResources(this, "$this");
@ -2177,6 +2219,9 @@ namespace XenAdmin
private XenAdmin.Commands.CommandToolStripMenuItem menuItemRemoveFromPool;
private XenAdmin.Commands.CommandToolStripMenuItem conversionToolStripMenuItem;
private XenAdmin.Commands.CommandToolStripMenuItem toolStripMenuItemInstallCertificate;
private System.Windows.Forms.ToolStripStatusLabel statusLabelAlerts;
private System.Windows.Forms.ToolStripStatusLabel statusLabelUpdates;
private System.Windows.Forms.ToolStripStatusLabel statusLabelErrors;
}
}

View File

@ -250,6 +250,8 @@ namespace XenAdmin
toolStripSeparator7.Visible = xenSourceOnTheWebToolStripMenuItem.Visible = xenCenterPluginsOnlineToolStripMenuItem.Visible = !HiddenFeatures.ToolStripMenuItemHidden;
healthCheckToolStripMenuItem1.Visible = !HiddenFeatures.HealthCheckHidden;
statusLabelAlerts.Visible = statusLabelUpdates.Visible = statusLabelErrors.Visible = false;
}
private void Default_SettingChanging(object sender, SettingChangingEventArgs e)
@ -442,13 +444,18 @@ namespace XenAdmin
}
}
int errors = ConnectionsManager.History.Count(a => a.IsCompleted && !a.Succeeded);
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Events, errors);
int errorCount = ConnectionsManager.History.Count(a => a.IsCompleted && !a.Succeeded);
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Events, errorCount);
statusLabelErrors.Text = errorCount == 1
? Messages.NOTIFICATIONS_SUBMODE_EVENTS_STATUS_ONE
: string.Format(Messages.NOTIFICATIONS_SUBMODE_EVENTS_STATUS_MANY, errorCount);
statusLabelErrors.Visible = errorCount > 0;
if (eventsPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Events, errors);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Events, errors);
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Events, errorCount);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Events, errorCount);
}
break;
}
@ -509,13 +516,19 @@ namespace XenAdmin
}
}
int errors = ConnectionsManager.History.Count(a => a.IsCompleted && !a.Succeeded && !(a is CancellingAction && ((CancellingAction)a).Cancelled));
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Events, errors);
int errorCount = ConnectionsManager.History.Count(a => a.IsCompleted && !a.Succeeded && !(a is CancellingAction && ((CancellingAction)a).Cancelled));
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Events, errorCount);
statusLabelErrors.Text = errorCount == 1
? Messages.NOTIFICATIONS_SUBMODE_EVENTS_STATUS_ONE
: string.Format(Messages.NOTIFICATIONS_SUBMODE_EVENTS_STATUS_MANY, errorCount);
statusLabelErrors.Visible = errorCount > 0;
if (eventsPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Events, errors);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Events, errors);
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Events, errorCount);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Events, errorCount);
}
}
@ -2543,6 +2556,9 @@ namespace XenAdmin
int updatesCount = Updates.UpdateAlertsCount;
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Updates, updatesCount);
statusLabelUpdates.Text = string.Format(Messages.NOTIFICATIONS_SUBMODE_UPDATES_STATUS, updatesCount);
statusLabelUpdates.Visible = updatesCount > 0;
if (updatesPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Updates, updatesCount);
@ -2921,19 +2937,22 @@ namespace XenAdmin
#endregion
void XenCenterAlerts_CollectionChanged(object sender, CollectionChangeEventArgs e)
private void XenCenterAlerts_CollectionChanged(object sender, CollectionChangeEventArgs e)
{
Program.BeginInvoke(Program.MainWindow, () =>
{
navigationPane.UpdateNotificationsButton(
NotificationsSubMode.Alerts, Alert.NonDismissingAlertCount);
{
var count = Alert.NonDismissingAlertCount;
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Alerts, count);
if (alertPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Alerts, Alert.NonDismissingAlertCount);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Alerts, Alert.NonDismissingAlertCount);
}
});
statusLabelAlerts.Text = string.Format(Messages.NOTIFICATIONS_SUBMODE_ALERTS_STATUS, count);
statusLabelAlerts.Visible = count > 0;
if (alertPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Alerts, count);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Alerts, count);
}
});
}
private void backButton_Click(object sender, EventArgs e)
@ -3199,5 +3218,20 @@ namespace XenAdmin
SetTitleLabelMaxWidth();
}
private void statusLabelAlerts_Click(object sender, EventArgs e)
{
navigationPane.SwitchToNotificationsView(NotificationsSubMode.Alerts);
}
private void statusLabelUpdates_Click(object sender, EventArgs e)
{
navigationPane.SwitchToNotificationsView(NotificationsSubMode.Updates);
}
private void statusLabelErrors_Click(object sender, EventArgs e)
{
navigationPane.SwitchToNotificationsView(NotificationsSubMode.Events);
}
}
}

View File

@ -2802,6 +2802,12 @@
<data name="StatusStrip.AutoSize" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="statusProgressBar.AutoSize" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="statusProgressBar.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 17</value>
</data>
<data name="statusLabel.ImageAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
@ -2809,16 +2815,28 @@
<value>None</value>
</data>
<data name="statusLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>883, 22</value>
<value>498, 22</value>
</data>
<data name="statusLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="statusProgressBar.AutoSize" type="System.Boolean, mscorlib">
<value>False</value>
<data name="statusLabelAlerts.Size" type="System.Drawing.Size, System.Drawing">
<value>118, 22</value>
</data>
<data name="statusProgressBar.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 17</value>
<data name="statusLabelAlerts.Text" xml:space="preserve">
<value>toolStripStatusLabel1</value>
</data>
<data name="statusLabelUpdates.Size" type="System.Drawing.Size, System.Drawing">
<value>118, 22</value>
</data>
<data name="statusLabelUpdates.Text" xml:space="preserve">
<value>toolStripStatusLabel2</value>
</data>
<data name="statusLabelErrors.Size" type="System.Drawing.Size, System.Drawing">
<value>118, 22</value>
</data>
<data name="statusLabelErrors.Text" xml:space="preserve">
<value>toolStripStatusLabel3</value>
</data>
<data name="StatusStrip.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 703</value>
@ -3975,10 +3993,28 @@
<data name="&gt;&gt;toolStripMenuItemInstallCertificate.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;statusLabelAlerts.Name" xml:space="preserve">
<value>statusLabelAlerts</value>
</data>
<data name="&gt;&gt;statusLabelAlerts.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;statusLabelUpdates.Name" xml:space="preserve">
<value>statusLabelUpdates</value>
</data>
<data name="&gt;&gt;statusLabelUpdates.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;statusLabelErrors.Name" xml:space="preserve">
<value>statusLabelErrors</value>
</data>
<data name="&gt;&gt;statusLabelErrors.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainWindow</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
</root>

View File

@ -28270,6 +28270,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Alerts: {0}.
/// </summary>
public static string NOTIFICATIONS_SUBMODE_ALERTS_STATUS {
get {
return ResourceManager.GetString("NOTIFICATIONS_SUBMODE_ALERTS_STATUS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Alerts ({0}).
/// </summary>
@ -28288,6 +28297,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Events: {0} errors.
/// </summary>
public static string NOTIFICATIONS_SUBMODE_EVENTS_STATUS_MANY {
get {
return ResourceManager.GetString("NOTIFICATIONS_SUBMODE_EVENTS_STATUS_MANY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Events: 1 error.
/// </summary>
public static string NOTIFICATIONS_SUBMODE_EVENTS_STATUS_ONE {
get {
return ResourceManager.GetString("NOTIFICATIONS_SUBMODE_EVENTS_STATUS_ONE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Events ({0} errors).
/// </summary>
@ -28315,6 +28342,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Updates: {0}.
/// </summary>
public static string NOTIFICATIONS_SUBMODE_UPDATES_STATUS {
get {
return ResourceManager.GetString("NOTIFICATIONS_SUBMODE_UPDATES_STATUS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Updates ({0}).
/// </summary>

View File

@ -9680,12 +9680,21 @@ It is strongly recommended that you Cancel and apply the latest version of the p
<data name="NOTIFICATIONS_SUBMODE_ALERTS_READ" xml:space="preserve">
<value>Alerts</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_ALERTS_STATUS" xml:space="preserve">
<value>Alerts: {0}</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_ALERTS_UNREAD" xml:space="preserve">
<value>Alerts ({0})</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_EVENTS_READ" xml:space="preserve">
<value>Events</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_EVENTS_STATUS_MANY" xml:space="preserve">
<value>Events: {0} errors</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_EVENTS_STATUS_ONE" xml:space="preserve">
<value>Events: 1 error</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_EVENTS_UNREAD_MANY" xml:space="preserve">
<value>Events ({0} errors)</value>
</data>
@ -9695,6 +9704,9 @@ It is strongly recommended that you Cancel and apply the latest version of the p
<data name="NOTIFICATIONS_SUBMODE_UPDATES_READ" xml:space="preserve">
<value>Updates</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_UPDATES_STATUS" xml:space="preserve">
<value>Updates: {0}</value>
</data>
<data name="NOTIFICATIONS_SUBMODE_UPDATES_UNREAD" xml:space="preserve">
<value>Updates ({0})</value>
</data>