removed unnecessary package,

removed unnecessary code
master
Jonas Arnold 3 years ago
parent 637eb20386
commit 82b8f4198d
  1. 1
      MultiTerm.Core.Tests/MultiTerm.Protocols.Tests.csproj
  2. 26
      MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs
  3. 2
      MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.xaml
  4. 4
      MultiTerm.Wpf/ValueConverters/ProtocolTypeToIconConverter.cs

@ -14,7 +14,6 @@
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.5.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
<ItemGroup>

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
@ -80,15 +81,6 @@ public class MultiFormatTextBox : Control
typeof(MultiFormatTextBox));
}
~MultiFormatTextBox()
{
// unregister events
if (this.CurrentMultiFormatString != null && this.CurrentMultiFormatString is INotifyCollectionChanged incc)
{
incc.CollectionChanged -= this.MultiFormatString_CollectionChanged;
}
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
@ -145,6 +137,10 @@ public class MultiFormatTextBox : Control
incc.CollectionChanged += mftb.MultiFormatString_CollectionChanged;
}
}
else if(mftb.CurrentMultiFormatString == null)
{
mftb.ResetTextBox();
}
}
/// <summary>
@ -170,8 +166,7 @@ public class MultiFormatTextBox : Control
case NotifyCollectionChangedAction.Reset:
// clear richtextbox add new paragraph
this.richTextBox!.Document.Blocks.Clear();
this.richTextBox!.Document.Blocks.Add(new Paragraph());
this.ResetTextBox();
break;
case NotifyCollectionChangedAction.Replace:
@ -270,6 +265,15 @@ public class MultiFormatTextBox : Control
this.SetRtbCaretPosition(indexCounter);
}
/// <summary>
/// Clear richtextbox adds new paragraph.
/// </summary>
private void ResetTextBox()
{
this.richTextBox!.Document.Blocks.Clear();
this.richTextBox!.Document.Blocks.Add(new Paragraph());
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
lock (lockObj) // lock so no richtextbox textchanged event can happen

@ -21,7 +21,7 @@
<DockPanel LastChildFill="True">
<ComboBox DockPanel.Dock="Left" x:Name="PART_ComboBox" Width="70"></ComboBox>
<RichTextBox DockPanel.Dock="Right" VerticalContentAlignment="Center" x:Name="PART_RichTextBox"
Style="{StaticResource TextFontStyle}"></RichTextBox>
Style="{StaticResource TextFontStyle}" Padding="0 5"></RichTextBox>
</DockPanel>
</ControlTemplate>
</Setter.Value>

@ -17,9 +17,7 @@ internal class ProtocolTypeToIconConverter : IValueConverter
{ 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",

Loading…
Cancel
Save