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.
58 lines
1.5 KiB
58 lines
1.5 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 string Title
|
|
{
|
|
get
|
|
{
|
|
return $"{ViewType} {ProtocolType}";
|
|
}
|
|
}
|
|
|
|
public override TerminalViewType ViewType => TerminalViewType.SendReceive;
|
|
|
|
/// <summary>
|
|
/// Send data model.
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
private MultiFormatString sendData = new();
|
|
|
|
/// <summary>
|
|
/// Temporary sent data property, for testing purposes.
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
private string sentData = 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.SentData = this.SendData.ToString();
|
|
// send data
|
|
this.SendToCommunicationProtocol(this.SendData.ToString());
|
|
|
|
// clear textbox
|
|
this.SendData = new MultiFormatString();
|
|
}
|
|
}
|
|
|