aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2023-01-05 03:50:24 +0200
committerRoy <Roy.mail.net@gmail.com>2023-02-16 23:47:49 +0200
commitdaf4d915f4eb60ac54a6c9b2a680e8cf0b1f948a (patch)
treea820b23783c8b0207d5a5da78d9719bbb6b35b08 /Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
parent5ed883227020212c8c9faac1f43bc22b9be7dd30 (diff)
downloadTango-daf4d915f4eb60ac54a6c9b2a680e8cf0b1f948a.tar.gz
Tango-daf4d915f4eb60ac54a6c9b2a680e8cf0b1f948a.zip
Implemented TCP Firmware Client.
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
index c993be2d7..be77ee217 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
@@ -210,9 +210,12 @@ namespace Tango.MachineEM.UI.ViewModels
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ClientConnectedEventArgs"/> instance containing the event data.</param>
- private void TcpServer_ClientConnected(object sender, ClientConnectedEventArgs e)
+ private async void TcpServer_ClientConnected(object sender, ClientConnectedEventArgs e)
{
- Emulator.Transporter.Adapter = new TcpTransportAdapter(e.Socket);
+ Emulator.Transporter = new BasicTransporter(new TcpTransportAdapter(e.Socket));
+ await Emulator.Transporter.Connect();
+
+ InvalidateRelayCommands();
}
#endregion
@@ -224,17 +227,21 @@ namespace Tango.MachineEM.UI.ViewModels
/// </summary>
private async void Start()
{
+ var settings = SettingsManager.Default.GetOrCreate<Integration.IntegrationSettings>();
+
if (SelectedPort == Ports.First())
{
- TcpServer = new TcpServer(9999);
+ TcpServer = new TcpServer(settings.FirmwarePort);
TcpServer.ClientConnected += TcpServer_ClientConnected;
TcpServer.Start();
+ await Emulator.Start();
}
else
{
Emulator.Transporter.Adapter = new UsbTransportAdapter(SelectedPort);
+ await Emulator.Start();
}
- await Emulator.Start();
+
InvalidateRelayCommands();
}