diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.Designer.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.Designer.cs
index 624e6de..6113b5b 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.Designer.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.Designer.cs
@@ -36,6 +36,7 @@
System.Windows.Forms.ColumnHeader columnCount;
System.Windows.Forms.ColumnHeader columnId;
System.Windows.Forms.ColumnHeader columnEvents;
+ System.Windows.Forms.ColumnHeader columnSubject;
this.tableMain = new System.Windows.Forms.TableLayoutPanel();
this.flowButtons = new System.Windows.Forms.FlowLayoutPanel();
this.buttonGC = new System.Windows.Forms.Button();
@@ -59,6 +60,9 @@
this._layoutItemEvents = new System.Windows.Forms.TableLayoutPanel();
this.listItemEventDetails = new System.Windows.Forms.ListView();
this.listItemEvents = new System.Windows.Forms.ListView();
+ this._layoutEventsButtons = new System.Windows.Forms.FlowLayoutPanel();
+ this.buttonCleanGC = new System.Windows.Forms.Button();
+ this.columnProperties = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
columnMethod = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
columnFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
columnLine = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -66,6 +70,7 @@
columnCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
columnId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
columnEvents = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ columnSubject = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tableMain.SuspendLayout();
this.flowButtons.SuspendLayout();
this._tabs.SuspendLayout();
@@ -75,6 +80,7 @@
this._layoutLocations.SuspendLayout();
this._tabItemEvents.SuspendLayout();
this._layoutItemEvents.SuspendLayout();
+ this._layoutEventsButtons.SuspendLayout();
this.SuspendLayout();
//
// columnMethod
@@ -101,6 +107,14 @@
//
resources.ApplyResources(columnId, "columnId");
//
+ // columnEvents
+ //
+ resources.ApplyResources(columnEvents, "columnEvents");
+ //
+ // columnSubject
+ //
+ resources.ApplyResources(columnSubject, "columnSubject");
+ //
// tableMain
//
resources.ApplyResources(this.tableMain, "tableMain");
@@ -262,13 +276,15 @@
resources.ApplyResources(this._layoutItemEvents, "_layoutItemEvents");
this._layoutItemEvents.Controls.Add(this.listItemEventDetails, 0, 1);
this._layoutItemEvents.Controls.Add(this.listItemEvents, 0, 0);
+ this._layoutItemEvents.Controls.Add(this._layoutEventsButtons, 0, 2);
this._layoutItemEvents.Name = "_layoutItemEvents";
//
// listItemEventDetails
//
this.listItemEventDetails.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
columnEvent,
- columnCount});
+ columnCount,
+ this.columnProperties});
resources.ApplyResources(this.listItemEventDetails, "listItemEventDetails");
this.listItemEventDetails.FullRowSelect = true;
this.listItemEventDetails.MultiSelect = false;
@@ -281,7 +297,8 @@
//
this.listItemEvents.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
columnId,
- columnEvents});
+ columnEvents,
+ columnSubject});
resources.ApplyResources(this.listItemEvents, "listItemEvents");
this.listItemEvents.FullRowSelect = true;
this.listItemEvents.HideSelection = false;
@@ -293,9 +310,22 @@
this.listItemEvents.View = System.Windows.Forms.View.Details;
this.listItemEvents.SelectedIndexChanged += new System.EventHandler(this.listItemEvents_SelectedIndexChanged);
//
- // columnEvents
+ // _layoutEventsButtons
//
- resources.ApplyResources(columnEvents, "columnEvents");
+ resources.ApplyResources(this._layoutEventsButtons, "_layoutEventsButtons");
+ this._layoutEventsButtons.Controls.Add(this.buttonCleanGC);
+ this._layoutEventsButtons.Name = "_layoutEventsButtons";
+ //
+ // buttonCleanGC
+ //
+ resources.ApplyResources(this.buttonCleanGC, "buttonCleanGC");
+ this.buttonCleanGC.Name = "buttonCleanGC";
+ this.buttonCleanGC.UseVisualStyleBackColor = true;
+ this.buttonCleanGC.Click += new System.EventHandler(this.buttonCleanGC_Click);
+ //
+ // columnProperties
+ //
+ resources.ApplyResources(this.columnProperties, "columnProperties");
//
// DebugDialog
//
@@ -317,6 +347,9 @@
this._layoutLocations.ResumeLayout(false);
this._tabItemEvents.ResumeLayout(false);
this._layoutItemEvents.ResumeLayout(false);
+ this._layoutItemEvents.PerformLayout();
+ this._layoutEventsButtons.ResumeLayout(false);
+ this._layoutEventsButtons.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -347,5 +380,8 @@
private System.Windows.Forms.TableLayoutPanel _layoutItemEvents;
private System.Windows.Forms.ListView listItemEventDetails;
private System.Windows.Forms.ListView listItemEvents;
+ private System.Windows.Forms.FlowLayoutPanel _layoutEventsButtons;
+ private System.Windows.Forms.Button buttonCleanGC;
+ private System.Windows.Forms.ColumnHeader columnProperties;
}
}
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.cs
index a5e710f..f869b2a 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.cs
@@ -158,6 +158,7 @@ namespace Acacia.Features.DebugSupport
ListViewItem item = new ListViewItem(events.Id);
item.Tag = events;
item.SubItems.Add(string.Join(", ", events.GetEvents()));
+ item.SubItems.Add(events.Subject);
listItemEvents.Items.Add(item);
}
@@ -175,6 +176,10 @@ namespace Acacia.Features.DebugSupport
{
ListViewItem item = new ListViewItem(evt.ToString());
item.SubItems.Add(debug.GetEventCount(evt).ToString());
+
+ if (evt == MailEvents.DebugEvent.PropertyChange)
+ item.SubItems.Add(string.Join(", ", debug.Properties));
+
listItemEventDetails.Items.Add(item);
}
}
@@ -182,6 +187,12 @@ namespace Acacia.Features.DebugSupport
header.Width = -2;
}
+ private void buttonCleanGC_Click(object sender, EventArgs e)
+ {
+ MailEvents.MailEventsDebugClean();
+ RefreshItemEvents();
+ }
+
#endregion
#region Cycling
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.resx b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.resx
index 940093e..191a93d 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.resx
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DebugSupport/DebugDialog.resx
@@ -166,6 +166,18 @@
44
+
+ False
+
+
+ Events
+
+
+ False
+
+
+ Subject
+
Top, Bottom, Left, Right
@@ -576,14 +588,17 @@
1
+
+ Properties
+
Fill
- 3, 328
+ 3, 305
- 597, 320
+ 597, 296
3
@@ -600,12 +615,6 @@
0
-
- False
-
-
- Events
-
Fill
@@ -613,7 +622,7 @@
3, 3
- 597, 319
+ 597, 296
2
@@ -630,6 +639,66 @@
1
+
+ True
+
+
+ GrowAndShrink
+
+
+ True
+
+
+ 465, 3
+
+
+ 129, 35
+
+
+ 0
+
+
+ Remove GC
+
+
+ buttonCleanGC
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ _layoutEventsButtons
+
+
+ 0
+
+
+ Fill
+
+
+ RightToLeft
+
+
+ 3, 607
+
+
+ 597, 41
+
+
+ 4
+
+
+ _layoutEventsButtons
+
+
+ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ _layoutItemEvents
+
+
+ 2
+
Fill
@@ -637,7 +706,7 @@
3, 3
- 2
+ 3
603, 651
@@ -658,7 +727,7 @@
0
- <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="listItemEventDetails" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="listItemEvents" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,Absolute,20" /><Rows Styles="Percent,50,Percent,50" /></TableLayoutSettings>
+ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="listItemEventDetails" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="listItemEvents" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_layoutEventsButtons" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,50,Percent,50,AutoSize,0" /></TableLayoutSettings>
4, 33
@@ -798,6 +867,18 @@
System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ columnEvents
+
+
+ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ columnSubject
+
+
+ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
columnHeader1
@@ -822,10 +903,10 @@
System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- columnEvents
+
+ columnProperties
-
+
System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/MailEvents.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/MailEvents.cs
index a68e50c..1933fd6 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/MailEvents.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/MailEvents.cs
@@ -1,4 +1,4 @@
-/// Copyright 2016 Kopano b.v.
+/// Copyright 2017 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
@@ -380,8 +380,10 @@ namespace Acacia.Utils
public interface MailEventDebug
{
string Id { get; }
+ string Subject { get; }
int GetEventCount(DebugEvent which);
IEnumerable GetEvents();
+ IEnumerable Properties { get; }
}
public static IEnumerable MailEventsDebug
@@ -389,6 +391,18 @@ namespace Acacia.Utils
get { return _hookers?.Values; }
}
+ public static void MailEventsDebugClean()
+ {
+ foreach (MailEventDebugImpl impl in _hookers.Values)
+ {
+ if (impl.GetEventCount(DebugEvent.GC) > 0)
+ {
+ MailEventDebugImpl dummy;
+ _hookers.TryRemove(impl._id, out dummy);
+ }
+ }
+ }
+
private static readonly ConcurrentDictionary _hookers =
GlobalOptions.INSTANCE.WrapperTrace ? new ConcurrentDictionary() : null;
private static int _nextHookerId;
@@ -423,14 +437,13 @@ namespace Acacia.Utils
if (_debug != null)
{
_debug.RecordEvent(DebugEvent.Dispose);
- MailEventDebugImpl dummy;
- _hookers.TryRemove(_debug._id, out dummy);
}
}
~MailEventHooker()
{
_debug?.RecordEvent(DebugEvent.GC);
+ _debug?.Finished();
}
private void HookEvents(bool add)
@@ -478,13 +491,17 @@ namespace Acacia.Utils
private void HandlePropertyChange(string name)
{
- _debug?.RecordEvent(DebugEvent.PropertyChange);
+ _debug?.RecordEvent(DebugEvent.PropertyChange, name);
_events.OnPropertyChange(_item, name);
}
private void HandleRead()
{
- _debug?.RecordEvent(DebugEvent.Read);
+ if (_debug != null)
+ {
+ _debug.RecordEvent(DebugEvent.Read);
+ _debug.Subject = _item.Subject;
+ }
// TODO: should this not be simply an IItem?
_events.OnRead(_item as IMailItem);
}
@@ -521,8 +538,14 @@ namespace Acacia.Utils
private class MailEventDebugImpl : MailEventDebug
{
private readonly ConcurrentDictionary _eventCounts = new ConcurrentDictionary();
+ private readonly List _properties = new List();
public readonly int _id;
+ public DateTime? GCTime
+ {
+ get;
+ private set;
+ }
public MailEventDebugImpl(int id)
{
@@ -536,9 +559,11 @@ namespace Acacia.Utils
return count;
}
- public void RecordEvent(DebugEvent which)
+ public void RecordEvent(DebugEvent which, string property = null)
{
_eventCounts.AddOrUpdate(which, 1, (i, value) => value + 1);
+ if (property != null)
+ _properties.Add(property);
}
public IEnumerable GetEvents()
@@ -546,7 +571,18 @@ namespace Acacia.Utils
return _eventCounts.Keys;
}
+ public IEnumerable Properties
+ {
+ get { return _properties; }
+ }
+
+ public void Finished()
+ {
+ GCTime = DateTime.Now;
+ }
+
public string Id { get { return _id.ToString(); } }
+ public string Subject { get; set; }
}
#endregion