You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
using Common;
|
|
using Common.AppSettings;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
using MultiTerm.Core.Model;
|
|
using MultiTerm.Core.Types;
|
|
using System.Diagnostics;
|
|
|
|
namespace MultiTerm.Core.ViewModel;
|
|
|
|
public partial class SendReceiveViewModel : TerminalViewModel
|
|
{
|
|
public override TerminalViewType ViewType => TerminalViewType.SendReceive;
|
|
|
|
/// <summary>
|
|
/// Send data model.
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
private MultiFormatString sendableData = new();
|
|
|
|
/// <summary>
|
|
/// Temporary sent data property, for testing purposes.
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
private string tempSentDataString = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Constructor.
|
|
/// </summary>
|
|
/// <param name="appSettings"></param>
|
|
public SendReceiveViewModel(IAppSettingsProvider appSettings, IMessenger messenger, IContext context) : base(appSettings, messenger, context) { }
|
|
|
|
/// <summary>
|
|
/// Send command.
|
|
/// </summary>
|
|
[RelayCommand]
|
|
private void Send()
|
|
{
|
|
// Temp
|
|
//var items = this.CommunicationData.SelectedReceivedData;
|
|
//Debugger.Break();
|
|
this.TempSentDataString = this.SendableData.ToAsciiEncodedString();
|
|
// send data
|
|
this.SendToCommunicationProtocol(this.SendableData.GetBytes());
|
|
|
|
// clear textbox
|
|
this.SendableData.Clear();
|
|
}
|
|
}
|
|
|