Skip to content

Commit

Permalink
UI polishing, clearing windows during refresh and reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Rapp committed Dec 19, 2017
1 parent efde74d commit 3100f30
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Cinteros.XTB.PluginTraceViewer/Controls/ExceptionControl.cs
Expand Up @@ -23,5 +23,11 @@ internal void SetException(string text, string caption)
textException.SelectionStart = 0;
TabText = caption;
}

internal void Clear()
{
textException.Clear();
TabText = "Exception";
}
}
}
5 changes: 5 additions & 0 deletions Cinteros.XTB.PluginTraceViewer/Controls/StatsControl.cs
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace Cinteros.XTB.PluginTraceViewer.Controls
{
Expand Down Expand Up @@ -33,6 +34,10 @@ internal void Clear()
{
statistics.Clear();
}
foreach (var textBox in this.AllChildren<TextBox>())
{
textBox.Clear();
}
}

internal void ShowStatistics(Entity entity)
Expand Down
5 changes: 5 additions & 0 deletions Cinteros.XTB.PluginTraceViewer/Controls/TraceControl.cs
Expand Up @@ -22,5 +22,10 @@ internal void SetLogText(string log)
textMessage.Text = log;
textMessage.SelectionStart = 0;
}

internal void Clear()
{
textMessage.Clear();
}
}
}
22 changes: 22 additions & 0 deletions Cinteros.XTB.PluginTraceViewer/Extensions.cs
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Windows.Forms;

namespace Cinteros.XTB.PluginTraceViewer
{
public static class Extensions
{
public static List<T> AllChildren<T>(this Control control) where T : Control
{
var result = new List<T>();
if (control is T)
{
result.Add((T)control);
}
foreach (Control child in control.Controls)
{
result.AddRange(child.AllChildren<T>());
}
return result;
}
}
}
10 changes: 9 additions & 1 deletion Cinteros.XTB.PluginTraceViewer/PluginTraceViewer.cs
Expand Up @@ -186,6 +186,7 @@ private void PluginTraceViewer_ConnectionUpdated(object sender, ConnectionUpdate
LoadFilter();
var orgver = new Version(e.ConnectionDetail.OrganizationVersion);
LogInfo("Connected CRM version: {0}", orgver);
ClearControls();
var orgok = orgver >= new Version(7, 1);
gridControl.SetDataSource(orgok ? e.Service : null);
buttonRetrieveLogs.Enabled = orgok;
Expand Down Expand Up @@ -321,7 +322,7 @@ private void RefreshTraces(QueryExpression query)
{
return;
}
statsControl.Clear();
ClearControls();
LogUse("RetrieveLogs");
var asyncinfo = new WorkAsyncInfo()
{
Expand Down Expand Up @@ -352,6 +353,13 @@ private void RefreshTraces(QueryExpression query)
WorkAsync(asyncinfo);
}

private void ClearControls()
{
traceControl.Clear();
exceptionControl.Clear();
statsControl.Clear();
}

private void FriendlyfyCorrelationIds(EntityCollection entities)
{
var allCorrelationIds = new List<Guid>();
Expand Down

0 comments on commit 3100f30

Please sign in to comment.