Skip to content

Commit

Permalink
Started implementing support for binary data in send TextBox
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandKoenig committed Dec 3, 2020
1 parent 7e76421 commit 8dc9a00
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
Margin="3"
Command="{Binding Path=Command_SendMessage}"
CommandParameter="{Binding #TxtSendMessage.Text}" />
<ComboBox DockPanel.Dock="Right"
Width="60" Margin="3"
SelectedItem="{Binding Path=SendFormattingMode}"
Items="{Binding Path=SendFormattingModeList}" />
<TextBox Name="TxtSendMessage"
Margin="3" />
</DockPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Reactive;
using System.Text.RegularExpressions;
using MessageCommunicator.TestGui.Logic;
using ReactiveUI;

Expand Down Expand Up @@ -39,6 +39,10 @@ public bool IsRunning

public bool CanStop => this.IsRunning;

public SendFormattingMode SendFormattingMode { get; set; }

public SendFormattingMode[] SendFormattingModeList => (SendFormattingMode[])Enum.GetValues(typeof(SendFormattingMode));

public ConnectionState State
{
get => _connState;
Expand Down Expand Up @@ -96,7 +100,8 @@ public ConnectionProfileViewModel(ConnectionProfile connProfile)
try
{
if (message == null) { message = string.Empty; }
await this.Model.SendMessageAsync(message);
await this.Model.SendMessageAsync(
Regex.Unescape(message));
}
catch (Exception e)
{
Expand Down
15 changes: 15 additions & 0 deletions MessageCommunicator.TestGui/Views/_ConnectionProfile/_Misc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace MessageCommunicator.TestGui.Views
{
public enum SendFormattingMode
{
Plain,

Escaped,

Hex
}
}

0 comments on commit 8dc9a00

Please sign in to comment.