aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
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.cs53
1 files changed, 49 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 8c7efd67e..24a0f6119 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
@@ -71,6 +71,25 @@ namespace Tango.MachineEM.UI.ViewModels
set { _selectedStub = value; RaisePropertyChanged(nameof(SelectedStub)); }
}
+ private List<String> _ports;
+ /// <summary>
+ /// Gets or sets the ports.
+ /// </summary>
+ public List<String> Ports
+ {
+ get { return _ports; }
+ set { _ports = value; RaisePropertyChanged(nameof(Ports)); }
+ }
+
+ private String _selectedPort;
+ /// <summary>
+ /// Gets or sets the selected port.
+ /// </summary>
+ public String SelectedPort
+ {
+ get { return _selectedPort; }
+ set { _selectedPort = value; RaisePropertyChanged(nameof(SelectedPort)); }
+ }
#endregion
@@ -143,6 +162,22 @@ namespace Tango.MachineEM.UI.ViewModels
ClearCommand = new RelayCommand(() => Log = String.Empty);
AvailableStubs = StubBase.GetAvailableStubs(StubDirection.ToMobile);
+
+ Ports = new List<string>()
+ {
+ "TCP",
+ "COM1",
+ "COM2",
+ "COM3",
+ "COM4",
+ "COM5",
+ "COM6",
+ "COM7",
+ "COM8",
+ "COM9",
+ };
+
+ SelectedPort = Ports.First();
}
#endregion
@@ -168,9 +203,16 @@ namespace Tango.MachineEM.UI.ViewModels
/// </summary>
private async void Start()
{
- TcpServer = new TcpServer(9999);
- TcpServer.ClientConnected += TcpServer_ClientConnected;
- TcpServer.Start();
+ if (SelectedPort == Ports.First())
+ {
+ TcpServer = new TcpServer(9999);
+ TcpServer.ClientConnected += TcpServer_ClientConnected;
+ TcpServer.Start();
+ }
+ else
+ {
+ Emulator.Transporter.Adapters.Add(new UsbTransportAdapter(SelectedPort));
+ }
await Emulator.Start();
InvalidateRelayCommands();
}
@@ -180,7 +222,10 @@ namespace Tango.MachineEM.UI.ViewModels
/// </summary>
private async void Stop()
{
- TcpServer.Stop();
+ if (TcpServer != null)
+ {
+ TcpServer.Stop();
+ }
await Emulator.Stop();
InvalidateRelayCommands();
}