diff options
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.cs | 15 |
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(); } |
