Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new "Values" tab in Timeline Visualizer #1682

Merged
merged 7 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Analogy.CommonControls/Forms/DataVisualizerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Windows.Forms;
using Analogy.Common.Interfaces;
using Analogy.CommonControls.Interfaces;
using Analogy.CommonControls.UserControls;
using Analogy.Interfaces;

Expand All @@ -11,27 +10,33 @@ namespace Analogy.CommonControls.Forms
public partial class DataVisualizerForm : DevExpress.XtraEditors.XtraForm
{
private readonly IUserSettingsManager _settingsManager;
private readonly DataVisualizerUC dataVisualizerUC;

public DataVisualizerForm()
{
InitializeComponent();
}
public DataVisualizerForm(IUserSettingsManager settingsManager, Func<List<IAnalogyLogMessage>> messages) : this()
public DataVisualizerForm(IUserSettingsManager settingsManager, Func<List<IAnalogyLogMessage>> messages, IAnalogyLogger analogyLogger) : this()
{
_settingsManager = settingsManager;
DataVisualizerUC uc = new DataVisualizerUC(_settingsManager, messages);
this.Controls.Add(uc);
uc.Dock = DockStyle.Fill;
}
public DataVisualizerForm(List<IAnalogyLogMessage> messages) : this()
{
DataVisualizerUC uc = new DataVisualizerUC(_settingsManager, messages);
this.Controls.Add(uc);
uc.Dock = DockStyle.Fill;
dataVisualizerUC = new DataVisualizerUC(_settingsManager, messages, analogyLogger);
Controls.Add(dataVisualizerUC);
dataVisualizerUC.Dock = DockStyle.Fill;
}

private void DataVisualizerUCForm_Load(object sender, EventArgs e)
{
Icon = _settingsManager.GetIcon();
}

public void AppendMessage(IAnalogyLogMessage message, string dataSource)
{
dataVisualizerUC?.AppendMessage(message, dataSource);
}

public void AppendMessages(List<IAnalogyLogMessage> messages, string dataSource)
{
dataVisualizerUC?.AppendMessages(messages, dataSource);
}
}
}
27 changes: 25 additions & 2 deletions Analogy.CommonControls/UserControls/DataVisualizerUC.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions Analogy.CommonControls/UserControls/DataVisualizerUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ public DataVisualizerUC()
InitializeComponent();
}

public DataVisualizerUC(IUserSettingsManager settings, Func<List<IAnalogyLogMessage>> messagesFunc) : this()
public DataVisualizerUC(IUserSettingsManager settings, Func<List<IAnalogyLogMessage>> messagesFunc, IAnalogyLogger analogyLogger) : this()
{
_settings = settings;
Messages = messagesFunc;
logStatisticsUC1.Statistics = new LogStatistics(messagesFunc.Invoke());
}
public DataVisualizerUC(IUserSettingsManager settings, List<IAnalogyLogMessage> messages) : this()
{
_settings = settings;
Messages = () => messages;
logStatisticsUC1.Statistics = new LogStatistics(messages);
valuesPlotterUC.Init(messagesFunc, analogyLogger);
}

private void DataVisualizerUC_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -219,5 +214,15 @@ private void tmrPlotting_Tick(object sender, EventArgs e)
Plot();
tmrPlotting.Enabled = true;
}

public void AppendMessage(IAnalogyLogMessage message, string dataSource)
{
valuesPlotterUC?.AppendMessage(message, dataSource);
}

public void AppendMessages(List<IAnalogyLogMessage> messages, string dataSource)
{
valuesPlotterUC?.AppendMessages(messages, dataSource);
}
}
}
2 changes: 2 additions & 0 deletions Analogy.CommonControls/UserControls/LogMessagesUC.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Analogy.CommonControls/UserControls/LogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public bool RealTimeMode
#region fields
private bool useSpecificColumnForJson;
private string jsonColumnForInlineJsonViewer;
private DataVisualizerForm frmDataVisualizer;

#endregion fields

private JsonTreeUC JsonTreeView { get; set; }
Expand Down Expand Up @@ -1768,6 +1770,9 @@ public void AppendMessage(IAnalogyLogMessage message, string dataSource)
return;
}

if (frmDataVisualizer != null)
frmDataVisualizer.AppendMessage(message, dataSource);

if (ExternalWindowsCount > 0)
{
foreach (XtraFormLogGrid grid in ExternalWindows)
Expand Down Expand Up @@ -1899,6 +1904,9 @@ public void AppendMessages(List<IAnalogyLogMessage> messages, string dataSource)
}
}

if (frmDataVisualizer != null)
frmDataVisualizer.AppendMessages(messages, dataSource);

foreach (var (dtr, message) in PagingManager.AppendMessages(messages, dataSource))
{
if (diffStartTime > DateTime.MinValue)
Expand Down Expand Up @@ -3375,8 +3383,8 @@ private void tsmiREmoveAllPreviousMessages_Click(object sender, EventArgs e)

private void bBtnDataVisualizer_ItemClick(object sender, ItemClickEventArgs e)
{
DataVisualizerForm sv = new DataVisualizerForm(Settings, () => Messages);
sv.Show(this);
frmDataVisualizer = new DataVisualizerForm(Settings, () => Messages, Logger);
frmDataVisualizer.Show(this);
}

private void bbiScreenshot_ItemClick(object sender, ItemClickEventArgs e)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Analogy.CommonControls/UserControls/ServerSideLogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public GridView LogGrid
}

private bool _realTimeMode;
private DataVisualizerForm frmDataVisualizer;

public bool RealTimeMode
{
set
Expand Down Expand Up @@ -1628,6 +1630,9 @@ public void AppendMessage(IAnalogyLogMessage message, string dataSource)
return;
}

if (frmDataVisualizer != null)
frmDataVisualizer.AppendMessage(message, dataSource);

if (ExternalWindowsCount > 0)
{
foreach (XtraFormLogGrid grid in ExternalWindows)
Expand Down Expand Up @@ -1746,6 +1751,8 @@ public void AppendMessages(List<IAnalogyLogMessage> messages, string dataSource)
grid.AppendMessages(messages, dataSource);
}
}
if (frmDataVisualizer != null)
frmDataVisualizer.AppendMessages(messages, dataSource);

foreach (var (dtr, message) in PagingManager.AppendMessages(messages, dataSource))
{
Expand Down Expand Up @@ -3138,8 +3145,8 @@ private void tsmiREmoveAllPreviousMessages_Click(object sender, EventArgs e)

private void bBtnDataVisualizer_ItemClick(object sender, ItemClickEventArgs e)
{
DataVisualizerForm sv = new DataVisualizerForm(Settings, () => Messages);
sv.Show(this);
frmDataVisualizer = new DataVisualizerForm(Settings, () => Messages, Logger);
frmDataVisualizer.Show(this);
}

private void bbiScreenshot_ItemClick(object sender, ItemClickEventArgs e)
Expand Down
Loading