evemon
evemon copied to clipboard
Badge on Pilots in Overview tab indicating # of notifications/pilot
Not very comfortable with pull requests so an old fashioned patch.
diff --git a/src/EVEMon/Controls/Overview.cs b/src/EVEMon/Controls/Overview.cs
index a5b6a388..1efb5594 100644
--- a/src/EVEMon/Controls/Overview.cs
+++ b/src/EVEMon/Controls/Overview.cs
@@ -11,6 +11,8 @@ using EVEMon.Common.Enumerations.UISettings;
using EVEMon.Common.Extensions;
using EVEMon.Common.Factories;
using EVEMon.Common.Models;
+using EVEMon.Common.Notifications;
+using EVEMon.Common.SettingsObjects;
namespace EVEMon.Controls
{
@@ -142,7 +144,7 @@ namespace EVEMon.Controls
characters.AddRange(EveMonClient.MonitoredCharacters);
int index = 0;
-
+
foreach (Character character in characters)
{
// Retrieve the current overview item, or null if we're past the limits
@@ -163,6 +165,18 @@ namespace EVEMon.Controls
overviewItems.Insert(index, overviewItem);
}
+ Int32 badgeCount = EveMonClient.Notifications.Where(p => character.Equals(p.SenderCharacter) && p.Category != NotificationCategory.MarketOrdersEnding).Distinct().Count();
+
+ System.Diagnostics.Debug.WriteLine($"{character.Name} - {badgeCount}");
+ Label badge = (Label)overviewItems[index].Controls.Find("badge", true)[0];
+
+ badge.Visible = badgeCount != 0;
+ badge.Text = $"{badgeCount}";
+
+ MainWindowSettings mainWindowSettings = Settings.UI.MainWindow;
+ PortraitSizes portraitSize = mainWindowSettings.OverviewItemSize;
+ badge.Left = portraitSize.GetDefaultValue() - badge.Width + 3;
+
// Remove processed character from the dictionary and move forward
if (character != null)
items.Remove(character);
@@ -311,9 +325,9 @@ namespace EVEMon.Controls
// Computes the vertical margin
height -= Pad;
-
+
// We put 1/3 at the top, 2/3 at the bottom
- int marginV = Math.Max(0, (clientHeight - height) / 3);
+ int marginV = Math.Max(0, (clientHeight - height) / 3);
// Adjust the controls bounds
rowIndex = 0;
diff --git a/src/EVEMon/Controls/OverviewItem.Designer.cs b/src/EVEMon/Controls/OverviewItem.Designer.cs
index 4ea9f2a2..3c6a8fa5 100644
--- a/src/EVEMon/Controls/OverviewItem.Designer.cs
+++ b/src/EVEMon/Controls/OverviewItem.Designer.cs
@@ -29,6 +29,7 @@ namespace EVEMon.Controls
private void InitializeComponent()
{
this.pbCharacterPortrait = new EVEMon.Common.Controls.CharacterPortrait();
+ this.badge = new System.Windows.Forms.Label();
this.lblTotalSkillPoints = new EVEMon.Controls.OverviewLabel();
this.lblExtraInfo = new EVEMon.Controls.OverviewLabel();
this.lblSkillQueueTrainingTime = new EVEMon.Controls.OverviewLabel();
@@ -49,6 +50,18 @@ namespace EVEMon.Controls
this.pbCharacterPortrait.TabIndex = 0;
this.pbCharacterPortrait.TabStop = false;
//
+ // badge
+ //
+ this.badge.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.badge.AutoSize = true;
+ this.badge.BackColor = System.Drawing.SystemColors.InactiveCaption;
+ this.badge.Location = new System.Drawing.Point(86, 86);
+ this.badge.Margin = new System.Windows.Forms.Padding(0);
+ this.badge.Name = "badge";
+ this.badge.Size = new System.Drawing.Size(13, 13);
+ this.badge.TabIndex = 9;
+ this.badge.Text = "0";
+ //
// lblTotalSkillPoints
//
this.lblTotalSkillPoints.AutoEllipsis = true;
@@ -61,14 +74,14 @@ namespace EVEMon.Controls
this.lblTotalSkillPoints.TabIndex = 4;
this.lblTotalSkillPoints.Text = "100,000,000 SP";
//
- // lblLocation
+ // lblExtraInfo
//
this.lblExtraInfo.AutoEllipsis = true;
this.lblExtraInfo.BackColor = System.Drawing.Color.Transparent;
this.lblExtraInfo.Enabled = false;
this.lblExtraInfo.ForeColor = System.Drawing.Color.DimGray;
this.lblExtraInfo.Location = new System.Drawing.Point(9, 101);
- this.lblExtraInfo.Name = "lblLocation";
+ this.lblExtraInfo.Name = "lblExtraInfo";
this.lblExtraInfo.Size = new System.Drawing.Size(92, 13);
this.lblExtraInfo.TabIndex = 1;
this.lblExtraInfo.Text = "Egghelende";
@@ -149,6 +162,7 @@ namespace EVEMon.Controls
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.badge);
this.Controls.Add(this.lblTotalSkillPoints);
this.Controls.Add(this.lblExtraInfo);
this.Controls.Add(this.lblSkillQueueTrainingTime);
@@ -162,6 +176,7 @@ namespace EVEMon.Controls
this.Name = "OverviewItem";
this.Size = new System.Drawing.Size(330, 120);
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -176,5 +191,6 @@ namespace EVEMon.Controls
private OverviewLabel lblCompletionTime;
private OverviewLabel lblSkillQueueTrainingTime;
private OverviewLabel lblExtraInfo;
+ private System.Windows.Forms.Label badge;
}
}
\ No newline at end of file
This is what it looks like:

Added in 102d982226a8502fe3857c1a92ae1628fb5c2a36, thanks for the patch!