Skip to content

Commit

Permalink
peformance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Sep 25, 2023
1 parent ea3b255 commit 6089f18
Showing 1 changed file with 27 additions and 38 deletions.
65 changes: 27 additions & 38 deletions Analogy.CommonControls/UserControls/LogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
using DevExpress.XtraBars;
using DevExpress.XtraBars.Alerter;
using DevExpress.XtraBars.Docking;
using DevExpress.XtraCharts;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Mask;
Expand Down Expand Up @@ -205,7 +204,7 @@ public bool ServerSideModeEnabled
private bool useSpecificColumnForJson;
private string jsonColumnForInlineJsonViewer;
private DataVisualizerForm frmDataVisualizer;

private MarkdownPipeline pipeline;
#endregion fields

private JsonTreeUC JsonTreeView { get; set; }
Expand All @@ -222,6 +221,7 @@ public LogMessagesUC()
{
return;
}
pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
Id = Guid.NewGuid();
SetupDependencies();

Expand Down Expand Up @@ -2474,50 +2474,39 @@ private void ClearLogs(bool raiseEvent)

private void LoadTextBoxes(AnalogyLogMessage m)
{
switch (m.RawTextType)
{
case AnalogyRowTextType.None:
case AnalogyRowTextType.Unknown:
case AnalogyRowTextType.PlainText:
case AnalogyRowTextType.RichText:
case AnalogyRowTextType.XML:
case AnalogyRowTextType.HTML:
case AnalogyRowTextType.Markdown:
bbtnRawMessageViewer.Visibility = string.IsNullOrEmpty(m.RawText) ? BarItemVisibility.Never : BarItemVisibility.Always;
bbtnRawMessageViewer.Caption = "View Raw Data";
break;
case AnalogyRowTextType.JSON:
bbtnRawMessageViewer.Visibility = BarItemVisibility.Always;
bbtnRawMessageViewer.Caption = "View in Json Visualizer";
bbtnRawMessageViewer.ImageOptions.Image = Resources.json16x16;
break;
default:
throw new ArgumentOutOfRangeException();
}
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions()
.Build();
if (InvokeRequired)
meMessageDetails.InvokeIfRequired((_) =>
{
BeginInvoke(new MethodInvoker(() =>
if (!meMessageDetails.Visible)
{
bbtnRawMessageViewer.Tag = m;
recMessageDetails.Tag = m;
recMessageDetails.Text = Utils.ProcessLinuxMessage(m.Text, Settings.SupportLinuxFormatting);
meMessageDetails.Tag = m;
meMessageDetails.Text = Utils.ProcessLinuxMessage(m.Text, Settings.SupportLinuxFormatting); ;
recMessageDetails.HtmlText = Markdown.ToHtml(m.Text, pipeline);
}));
}
else
{
return;
}
switch (m.RawTextType)
{
case AnalogyRowTextType.None:
case AnalogyRowTextType.Unknown:
case AnalogyRowTextType.PlainText:
case AnalogyRowTextType.RichText:
case AnalogyRowTextType.XML:
case AnalogyRowTextType.HTML:
case AnalogyRowTextType.Markdown:
bbtnRawMessageViewer.Visibility = string.IsNullOrEmpty(m.RawText) ? BarItemVisibility.Never : BarItemVisibility.Always;
bbtnRawMessageViewer.Caption = "View Raw Data";
break;
case AnalogyRowTextType.JSON:
bbtnRawMessageViewer.Visibility = BarItemVisibility.Always;
bbtnRawMessageViewer.Caption = "View in Json Visualizer";
bbtnRawMessageViewer.ImageOptions.Image = Resources.json16x16;
break;
default:
throw new ArgumentOutOfRangeException();
}
bbtnRawMessageViewer.Tag = m;
recMessageDetails.Tag = m;
recMessageDetails.Text = Utils.ProcessLinuxMessage(m.Text, Settings.SupportLinuxFormatting); ;
meMessageDetails.Tag = m;
meMessageDetails.Text = Utils.ProcessLinuxMessage(m.Text, Settings.SupportLinuxFormatting); ;
recMessageDetails.HtmlText = Markdown.ToHtml(m.Text, pipeline);
}

});
}

#region Log grid Event Handlers
Expand Down

0 comments on commit 6089f18

Please sign in to comment.