diff --git a/MultiTerm.Core/ViewModel/TerminalViewModel.cs b/MultiTerm.Core/ViewModel/TerminalViewModel.cs
index c3045ba..f3a5c69 100644
--- a/MultiTerm.Core/ViewModel/TerminalViewModel.cs
+++ b/MultiTerm.Core/ViewModel/TerminalViewModel.cs
@@ -48,11 +48,11 @@ public abstract partial class TerminalViewModel : ObservableObject, ITerminalVie
{
if(this.CommunicationProtocol == null)
{
- this.Title = $"{ProtocolType}";
+ this.Title = $"new";
}
else
{
- this.Title = $"{ProtocolType} {this.CommunicationProtocol?.InstanceIdentifier}";
+ this.Title = $"{this.CommunicationProtocol?.InstanceIdentifier}";
}
}
#endregion
diff --git a/MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.cs b/MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.cs
index c9be7b0..32b17be 100644
--- a/MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.cs
+++ b/MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.cs
@@ -155,6 +155,8 @@ public class MultiFormatDataView : Control
{
// extract instance and guard null
if (d is not MultiFormatDataView mfdv) { return; }
+ // guard DataSource is null
+ if (mfdv.DataSource == null) { return; }
// manually create collection view
ICollectionView cv = CollectionViewSource.GetDefaultView(mfdv.DataSource.Data);
diff --git a/MultiTerm.Wpf/Assets/mdi-keyboard.png b/MultiTerm.Wpf/Assets/mdi-keyboard.png
new file mode 100644
index 0000000..c7323cd
Binary files /dev/null and b/MultiTerm.Wpf/Assets/mdi-keyboard.png differ
diff --git a/MultiTerm.Wpf/Assets/mdi-network.png b/MultiTerm.Wpf/Assets/mdi-network.png
new file mode 100644
index 0000000..7dca505
Binary files /dev/null and b/MultiTerm.Wpf/Assets/mdi-network.png differ
diff --git a/MultiTerm.Wpf/Assets/mdi-serial-port.png b/MultiTerm.Wpf/Assets/mdi-serial-port.png
new file mode 100644
index 0000000..78a0523
Binary files /dev/null and b/MultiTerm.Wpf/Assets/mdi-serial-port.png differ
diff --git a/MultiTerm.Wpf/MultiTerm.Wpf.csproj b/MultiTerm.Wpf/MultiTerm.Wpf.csproj
index 8352f12..2090a4c 100644
--- a/MultiTerm.Wpf/MultiTerm.Wpf.csproj
+++ b/MultiTerm.Wpf/MultiTerm.Wpf.csproj
@@ -7,6 +7,13 @@
true
+
+
+
+
+
+
+
@@ -21,7 +28,9 @@
-
+
+
+
diff --git a/MultiTerm.Wpf/ValueConverters/MessageImportanceToBrushConverter.cs b/MultiTerm.Wpf/ValueConverters/MessageImportanceToBrushConverter.cs
index 389d1ea..a3302d4 100644
--- a/MultiTerm.Wpf/ValueConverters/MessageImportanceToBrushConverter.cs
+++ b/MultiTerm.Wpf/ValueConverters/MessageImportanceToBrushConverter.cs
@@ -1,7 +1,6 @@
using Common.Messaging;
using System;
using System.Globalization;
-using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
@@ -19,7 +18,7 @@ internal class MessageImportanceToBrushConverter : IValueConverter
return msgImportance switch
{
MessageImportance.Normal => Brushes.Black,
- MessageImportance.Medium => Brushes.DarkSalmon,
+ MessageImportance.Medium => Brushes.DarkOrange,
MessageImportance.High => Brushes.Red,
MessageImportance.HighAndRequiresConfirmation => throw new NotImplementedException(),
_ => throw new NotImplementedException(),
diff --git a/MultiTerm.Wpf/ValueConverters/MessageImportanceToFontWeightConverter.cs b/MultiTerm.Wpf/ValueConverters/MessageImportanceToFontWeightConverter.cs
new file mode 100644
index 0000000..18642dc
--- /dev/null
+++ b/MultiTerm.Wpf/ValueConverters/MessageImportanceToFontWeightConverter.cs
@@ -0,0 +1,32 @@
+using Common.Messaging;
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace MultiTerm.Wpf.ValueConverters;
+
+[ValueConversion(typeof(MessageImportance), typeof(FontWeight))]
+
+internal class MessageImportanceToFontWeightConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if(value is not MessageImportance msgImportance)
+ { throw new ArgumentException($"Wrong object provided, can only convert from type {nameof(MessageImportance)}"); }
+
+ return msgImportance switch
+ {
+ MessageImportance.Normal => FontWeights.Normal,
+ MessageImportance.Medium => FontWeights.Medium,
+ MessageImportance.High => FontWeights.Bold,
+ MessageImportance.HighAndRequiresConfirmation => throw new NotImplementedException(),
+ _ => throw new NotImplementedException(),
+ };
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/MultiTerm.Wpf/ValueConverters/ProtocolTypeToIconConverter.cs b/MultiTerm.Wpf/ValueConverters/ProtocolTypeToIconConverter.cs
new file mode 100644
index 0000000..9450e09
--- /dev/null
+++ b/MultiTerm.Wpf/ValueConverters/ProtocolTypeToIconConverter.cs
@@ -0,0 +1,40 @@
+using MultiTerm.Protocols.Types;
+using System;
+using System.Globalization;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Media.Imaging;
+
+namespace MultiTerm.Wpf.ValueConverters;
+
+[ValueConversion(typeof(ProtocolType), typeof(Image))]
+
+internal class ProtocolTypeToIconConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if(value is not ProtocolType protocolType)
+ { throw new ArgumentException($"Wrong object provided, can only convert from type {nameof(ProtocolType)}"); }
+
+ string resourceFolderPath = "pack://application:,,,/Assets/";
+ //string path = $"{typeof(MainWindow).FullName};component/Assets/";
+ //string packUri = "pack://application:,,,/Assets/";
+
+ string fileName = protocolType switch
+ {
+ ProtocolType.Serial => "mdi-serial-port.png",
+ ProtocolType.UsbHid => "mdi-keyboard.png",
+ ProtocolType.Tcp => "mdi-network.png",
+ ProtocolType.Udp => "mdi-network.png",
+ _ => throw new NotImplementedException(),
+ };
+
+ var uriSource = new Uri(resourceFolderPath + fileName);
+ return new BitmapImage(uriSource);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/MultiTerm.Wpf/View/SettingsView/UsbHidSettingsView.xaml b/MultiTerm.Wpf/View/SettingsView/UsbHidSettingsView.xaml
index 08cf7a4..c949989 100644
--- a/MultiTerm.Wpf/View/SettingsView/UsbHidSettingsView.xaml
+++ b/MultiTerm.Wpf/View/SettingsView/UsbHidSettingsView.xaml
@@ -17,7 +17,7 @@
-
+
@@ -87,13 +87,16 @@
-
+
-
-
+
+
-
-
+
+
+
+
+
diff --git a/MultiTerm.Wpf/View/ShellView.xaml b/MultiTerm.Wpf/View/ShellView.xaml
index f5875ca..b93566f 100644
--- a/MultiTerm.Wpf/View/ShellView.xaml
+++ b/MultiTerm.Wpf/View/ShellView.xaml
@@ -12,13 +12,15 @@
xmlns:types="clr-namespace:MultiTerm.Core.Types;assembly=MultiTerm.Core"
xmlns:protocol_types="clr-namespace:MultiTerm.Protocols.Types;assembly=MultiTerm.Protocols"
xmlns:helpers="clr-namespace:MultiTerm.Wpf.Helpers"
- mc:Ignorable="d"
+ mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="1200">
-
+
+
+
-