diff --git a/PostCodeSerialMonitor/Assets/Resources.Designer.cs b/PostCodeSerialMonitor/Assets/Resources.Designer.cs
index 04d1779..2d2dcb8 100644
--- a/PostCodeSerialMonitor/Assets/Resources.Designer.cs
+++ b/PostCodeSerialMonitor/Assets/Resources.Designer.cs
@@ -571,12 +571,34 @@ public static string LogSettings {
///
/// In Views/ConfigurationDialog.axaml
///
- public static string ShowTimestamps {
- get {
+ public static string ShowTimestamps
+ {
+ get
+ {
return ResourceManager.GetString("ShowTimestamps", resourceCulture);
}
}
+ ///
+ /// In Views/ConfigurationDialog.axaml
+ ///
+ public static string DescriptionDisplaySettings
+ {
+ get
+ {
+ return ResourceManager.GetString("DescriptionDisplaySettings", resourceCulture);
+ }
+ }
+
+ ///
+ /// In Views/MainWindow.axaml
+ ///
+ public static string TimestampLabel {
+ get {
+ return ResourceManager.GetString("TimestampLabel", resourceCulture);
+ }
+ }
+
///
/// In Views/MainWindow.axaml
///
diff --git a/PostCodeSerialMonitor/Assets/Resources.pt-BR.resx b/PostCodeSerialMonitor/Assets/Resources.pt-BR.resx
index 3ef5923..6ba45a0 100644
--- a/PostCodeSerialMonitor/Assets/Resources.pt-BR.resx
+++ b/PostCodeSerialMonitor/Assets/Resources.pt-BR.resx
@@ -341,6 +341,10 @@
Mostrar timestamps
In Views/ConfigurationDialog.axaml
+
+ Hora:
+ In Views/MainWindow.axaml
+
URL de atualização do firmware
In Views/ConfigurationDialog.axaml
diff --git a/PostCodeSerialMonitor/Assets/Resources.resx b/PostCodeSerialMonitor/Assets/Resources.resx
index 922ad32..0ff1d4d 100644
--- a/PostCodeSerialMonitor/Assets/Resources.resx
+++ b/PostCodeSerialMonitor/Assets/Resources.resx
@@ -345,6 +345,14 @@
Show timestamps
In Views/ConfigurationDialog.axaml
+
+ Description display
+ In Views/ConfigurationDialog.axaml
+
+
+ Time:
+ In Views/MainWindow.axaml
+
Firmware update URL
In Views/ConfigurationDialog.axaml
diff --git a/PostCodeSerialMonitor/Models/AppConfiguration.cs b/PostCodeSerialMonitor/Models/AppConfiguration.cs
index d4d92b0..8e01d2d 100644
--- a/PostCodeSerialMonitor/Models/AppConfiguration.cs
+++ b/PostCodeSerialMonitor/Models/AppConfiguration.cs
@@ -14,6 +14,9 @@ public class AppConfiguration
public bool CheckForFwUpdates { get; set; } = true;
public bool ShowTimestamps { get; set; } = false;
+ [Required]
+ public string DescriptionDisplayMode { get; set; } = "NewLine";
+
[Required]
public string Theme { get; set; } = "Dark";
diff --git a/PostCodeSerialMonitor/Models/LogEntry.cs b/PostCodeSerialMonitor/Models/LogEntry.cs
index a77b325..714ba8d 100644
--- a/PostCodeSerialMonitor/Models/LogEntry.cs
+++ b/PostCodeSerialMonitor/Models/LogEntry.cs
@@ -1,9 +1,24 @@
using System;
+using System.ComponentModel;
namespace PostCodeSerialMonitor.Models;
// Simple model to hold log entry data
-public class LogEntry
+public class LogEntry : INotifyPropertyChanged
{
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ private bool isSelected;
+ public bool IsSelected
+ {
+ get => isSelected;
+ set
+ {
+ if (isSelected == value) return;
+ isSelected = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
+ }
+ }
+
public string RawText { get; set; } = string.Empty;
public DateTime Timestamp { get; set; } = DateTime.Now;
public string TimestampText => Timestamp.ToString("HH:mm:ss.fff");
@@ -14,8 +29,18 @@ public class LogEntry
public string FormattedText => FormatText();
// Flavor, index and code (hex)
public string CodeText => FormatCodeText();
+ // Individual fields, for column-aligned display
+ public string FlavorText => DecodedCode.Flavor.ToString();
+ public string IndexText => $"({DecodedCode.Index}):";
+ public string CodeHexText => $"{DecodedCode.Code:X4}";
+ public string NameText => string.IsNullOrEmpty(DecodedCode?.Name) ? string.Empty : $"[{DecodedCode.Name}]";
+ // Name + description on one line, for the truncated inline preview
+ public string InlinePreviewText => string.IsNullOrEmpty(Description)
+ ? NameText
+ : string.IsNullOrEmpty(NameText) ? Description : $"{NameText} {Description}";
// Description or null
public string? Description => string.IsNullOrEmpty(DecodedCode.Description) ? null : DecodedCode?.Description;
+ public bool HasDescription => !string.IsNullOrEmpty(Description);
public bool IsWarning => SeverityLevel == CodeSeverity.Warning;
public bool IsError => SeverityLevel == CodeSeverity.Error;
public CodeSeverity SeverityLevel => DecodedCode.SeverityLevel;
diff --git a/PostCodeSerialMonitor/ViewModels/ConfigurationDialogViewModel.cs b/PostCodeSerialMonitor/ViewModels/ConfigurationDialogViewModel.cs
index d8ab65a..7d5aabf 100644
--- a/PostCodeSerialMonitor/ViewModels/ConfigurationDialogViewModel.cs
+++ b/PostCodeSerialMonitor/ViewModels/ConfigurationDialogViewModel.cs
@@ -32,6 +32,12 @@ public partial class ConfigurationDialogViewModel : ViewModelBase
[ObservableProperty]
private bool showTimestamps;
+ [ObservableProperty]
+ private ObservableCollection descriptionDisplayModes = new(["Inline", "NewLine", "BottomPanel"]);
+
+ [ObservableProperty]
+ private string selectedDescriptionDisplayMode;
+
[ObservableProperty]
private string codesMetaBaseUrl;
@@ -66,6 +72,7 @@ public ConfigurationDialogViewModel(ConfigurationService configurationService)
CheckForCodeUpdates = _originalConfiguration.CheckForCodeUpdates;
CheckForFwUpdates = _originalConfiguration.CheckForFwUpdates;
ShowTimestamps = _originalConfiguration.ShowTimestamps;
+ SelectedDescriptionDisplayMode = _originalConfiguration.DescriptionDisplayMode;
CodesMetaBaseUrl = _originalConfiguration.CodesMetaBaseUrl.ToString();
SelectedLanguage = _originalConfiguration.Language;
SelectedTheme = _originalConfiguration.Theme;
@@ -85,6 +92,7 @@ await _configurationService.UpdateConfigurationAsync(config =>
config.CheckForCodeUpdates = CheckForCodeUpdates;
config.CheckForFwUpdates = CheckForFwUpdates;
config.ShowTimestamps = ShowTimestamps;
+ config.DescriptionDisplayMode = SelectedDescriptionDisplayMode;
config.CodesMetaBaseUrl = new Uri(CodesMetaBaseUrl);
config.Language = SelectedLanguage;
config.Theme = SelectedTheme;
diff --git a/PostCodeSerialMonitor/ViewModels/MainWindowViewModel.cs b/PostCodeSerialMonitor/ViewModels/MainWindowViewModel.cs
index a01d280..dbbc458 100644
--- a/PostCodeSerialMonitor/ViewModels/MainWindowViewModel.cs
+++ b/PostCodeSerialMonitor/ViewModels/MainWindowViewModel.cs
@@ -80,6 +80,16 @@ public partial class MainWindowViewModel : ViewModelBase
[ObservableProperty]
private bool showTimestamps;
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(IsDescriptionInlineMode))]
+ [NotifyPropertyChangedFor(nameof(IsDescriptionNewLineMode))]
+ [NotifyPropertyChangedFor(nameof(IsDescriptionBottomPanelMode))]
+ private string descriptionDisplayMode = "NewLine";
+
+ public bool IsDescriptionInlineMode => DescriptionDisplayMode == "Inline";
+ public bool IsDescriptionNewLineMode => DescriptionDisplayMode == "NewLine";
+ public bool IsDescriptionBottomPanelMode => DescriptionDisplayMode == "BottomPanel";
+
[ObservableProperty]
private string i2cScanOutput = Assets.Resources.ScanButtonText;
@@ -98,6 +108,9 @@ public partial class MainWindowViewModel : ViewModelBase
[ObservableProperty]
private bool debugModeUnlocked;
+ [ObservableProperty]
+ private LogEntry? selectedLogEntry;
+
private int _appVersionClickCount;
public IStorageProvider? StorageProvider
@@ -137,6 +150,7 @@ public MainWindowViewModel(
}
SelectedConsoleModel = ConsoleModels.FirstOrDefault();
ShowTimestamps = _configurationService.Config.ShowTimestamps;
+ DescriptionDisplayMode = _configurationService.Config.DescriptionDisplayMode;
RefreshPorts();
_serialService.DataReceived += OnDataReceived;
@@ -243,6 +257,24 @@ private void ClearLog()
{
LogEntries.Clear();
RawLogEntries.Clear();
+ SelectedLogEntry = null;
+ }
+
+ [RelayCommand]
+ private void SelectLogEntry(LogEntry entry)
+ {
+ if (SelectedLogEntry == entry)
+ {
+ entry.IsSelected = false;
+ SelectedLogEntry = null;
+ return;
+ }
+
+ if (SelectedLogEntry != null)
+ SelectedLogEntry.IsSelected = false;
+
+ entry.IsSelected = true;
+ SelectedLogEntry = entry;
}
[RelayCommand]
@@ -420,6 +452,7 @@ private async Task ShowConfigurationAsync()
await dialog.ShowDialog(GetParentWindow());
ShowTimestamps = _configurationService.Config.ShowTimestamps;
+ DescriptionDisplayMode = _configurationService.Config.DescriptionDisplayMode;
}
[RelayCommand]
diff --git a/PostCodeSerialMonitor/Views/ConfigurationDialog.axaml b/PostCodeSerialMonitor/Views/ConfigurationDialog.axaml
index 3a11b24..bd64c62 100644
--- a/PostCodeSerialMonitor/Views/ConfigurationDialog.axaml
+++ b/PostCodeSerialMonitor/Views/ConfigurationDialog.axaml
@@ -44,6 +44,11 @@
+
+
+
diff --git a/PostCodeSerialMonitor/Views/Converters/NullFontSizeConverter.cs b/PostCodeSerialMonitor/Views/Converters/NullFontSizeConverter.cs
deleted file mode 100644
index e1547ab..0000000
--- a/PostCodeSerialMonitor/Views/Converters/NullFontSizeConverter.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Avalonia.Data.Converters;
-using System;
-using System.Globalization;
-
-namespace PostCodeSerialMonitor.Views.Converters;
-
-public class NullFontSizeConverter : IValueConverter
-{
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- return value == null ? 0d : parameter;
- }
-
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
-}
\ No newline at end of file
diff --git a/PostCodeSerialMonitor/Views/MainWindow.axaml b/PostCodeSerialMonitor/Views/MainWindow.axaml
index 85f80aa..79774e7 100644
--- a/PostCodeSerialMonitor/Views/MainWindow.axaml
+++ b/PostCodeSerialMonitor/Views/MainWindow.axaml
@@ -5,20 +5,54 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:assets="clr-namespace:PostCodeSerialMonitor.Assets"
xmlns:converters="clr-namespace:PostCodeSerialMonitor.Views.Converters"
+ xmlns:objconv="clr-namespace:Avalonia.Data.Converters;assembly=Avalonia.Base"
xmlns:models="using:PostCodeSerialMonitor.Models"
mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="900"
x:Class="PostCodeSerialMonitor.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico"
Title="{x:Static assets:Resources.XboxPostCodeSerialMonitor}"
+ FontFamily="Consolas,Menlo,Monospace"
Width="850" Height="900">
-
+
+
+
+
+
+
+
+
+
+
+
@@ -149,60 +183,140 @@
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file