From b0ceb4f3b5f812d9577a8a1caa8e07e304c50432 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Thu, 15 Apr 2021 15:18:19 +0200 Subject: debug ObservableList, new Table widget --- .../DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 47 ++++++++++++++++++++-- Samples/DebugLogAnalyzer/src/Program.cs | 37 +---------------- Samples/DebugLogAnalyzer/ui/main.crow | 13 +++--- 3 files changed, 52 insertions(+), 45 deletions(-) (limited to 'Samples/DebugLogAnalyzer') diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index c6920ca5..2dba0601 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -47,7 +47,9 @@ namespace Crow public CommandGroup LoggerCommands => new CommandGroup( new Command("Get logs", () => getLog ()), - new Command("Reset logs", () => delResetDebugger ()) + new Command("Reset logs", () => delResetDebugger ()), + new Command("Save to file", () => saveLogToDebugLogFilePath ()), + new Command("Load from file", () => loadLogFromDebugLogFilePath ()) ); public string IMLSource { get => imlSource; @@ -128,7 +130,42 @@ namespace Crow NotifyValueChangedAuto (DebugLogToFile); } } + public string DebugLogFilePath { + get => Configuration.Global.Get ("DebugLogFilePath"); + set { + if (DebugLogFilePath == value) + return; + Configuration.Global.Set ("DebugLogFilePath", value); + NotifyValueChangedAuto (value); + } + } + int firstWidgetIndexToSave, lastWidgetIndexToSave; + public int FirstWidgetIndexToSave { + get => firstWidgetIndexToSave; + set { + if (firstWidgetIndexToSave == value) + return; + if (value > lastWidgetIndexToSave) + firstWidgetIndexToSave = lastWidgetIndexToSave; + else + firstWidgetIndexToSave = value; + NotifyValueChangedAuto (firstWidgetIndexToSave); + } + } + public int LastWidgetIndexToSave { + get => lastWidgetIndexToSave; + set { + if (lastWidgetIndexToSave == value) + return; + if (lastWidgetIndexToSave > widgets.Count) + lastWidgetIndexToSave = widgets.Count; + else + lastWidgetIndexToSave = value; + + NotifyValueChangedAuto (lastWidgetIndexToSave); + } + } protected override void onInitialized(object sender, EventArgs e) { @@ -373,8 +410,6 @@ namespace Crow widgets = new List(); events = new List(); miSave.Invoke(null, new object[] {dbgIFace, stream, firstWidgetIndexToGet, true}); - //debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}).Invoke(null, new object[] {dbgIFace, "debug.log"}); - //delSaveDebugLog(dbgIFace, "debug.log"); stream.Seek(0, SeekOrigin.Begin); DbgLogger.Load (stream, events, widgets); @@ -401,6 +436,12 @@ namespace Crow foreach (DbgEvent e in evt.Events) updateWidgetEvents (widgets, e); } + void saveLogToDebugLogFilePath () { + + } + void loadLogFromDebugLogFilePath () { + + } public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft; } diff --git a/Samples/DebugLogAnalyzer/src/Program.cs b/Samples/DebugLogAnalyzer/src/Program.cs index a2711dda..9c2e7117 100644 --- a/Samples/DebugLogAnalyzer/src/Program.cs +++ b/Samples/DebugLogAnalyzer/src/Program.cs @@ -125,10 +125,6 @@ namespace DebugLogAnalyzer } - - - - public string CrowDbgAssemblyLocation { get => Configuration.Global.Get("CrowDbgAssemblyLocation"); set { @@ -156,35 +152,6 @@ namespace DebugLogAnalyzer NotifyValueChanged (nameof (Widgets), widgets); } } - /*IEnumerable widgetEvents (DbgWidgetRecord wr, DbgEvent evt) { - if (evt is DbgWidgetEvent we && we.InstanceIndex == wr.InstanceIndex) - yield return we; - if (evt.Events != null) { - foreach (DbgEvent e in evt.Events) - foreach (DbgWidgetEvent ye in widgetEvents (wr, e)) - yield return ye; - } - } - IEnumerable currentWidgetEvents; - - public IEnumerable CurrentWidgetEvents { - get => currentWidgetEvents; - set { - currentWidgetEvents = value; - NotifyValueChanged (currentWidgetEvents); - curWidget.Events = new List (currentWidgetEvents); - } - } - IEnumerable getCurrentWidgetEvents () { - if (CurrentWidget == null) - yield return null; - else { - foreach (DbgEvent evt in Events) - foreach (DbgWidgetEvent dwe in widgetEvents (CurrentWidget, evt)) - yield return dwe; - } - }*/ - public DbgEvent CurrentEvent { get => curEvent; @@ -277,7 +244,7 @@ namespace DebugLogAnalyzer NotifyValueChanged(DebugLogToFile); } } - public string DebugLogFilePath { + /*public string DebugLogFilePath { get => Configuration.Global.Get (nameof (DebugLogFilePath)); set { if (CurrentFile == value) @@ -285,7 +252,7 @@ namespace DebugLogAnalyzer Configuration.Global.Set (nameof (DebugLogFilePath), value); NotifyValueChanged (DebugLogFilePath); } - } + }*/ public bool DebugLogRecording { get => debugLogRecording; set { diff --git a/Samples/DebugLogAnalyzer/ui/main.crow b/Samples/DebugLogAnalyzer/ui/main.crow index 22d0920d..16973e11 100644 --- a/Samples/DebugLogAnalyzer/ui/main.crow +++ b/Samples/DebugLogAnalyzer/ui/main.crow @@ -1,8 +1,8 @@ - - + + @@ -60,8 +60,7 @@ - - + - +