aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-15 12:29:05 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-15 12:29:05 +0200
commitd6f46df0e9ccd08276912bcdcded246de0bc4447 (patch)
tree12b743658b9ef5b48c4e938bc63633eed2465594 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
parent8356b90e200c1124e6dc89fe88f18f62c68b7623 (diff)
downloadTango-d6f46df0e9ccd08276912bcdcded246de0bc4447.tar.gz
Tango-d6f46df0e9ccd08276912bcdcded246de0bc4447.zip
Implemented virtual machine selection when connecting via USB.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs35
1 files changed, 23 insertions, 12 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 57f1d704c..84c4e2dd3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -26,6 +26,7 @@ using Tango.MachineStudio.UI.SupervisingController;
using Tango.MachineStudio.UI.Views;
using Tango.MachineStudio.UI.Windows;
using Tango.PMR.Stubs;
+using Tango.Settings;
using Tango.SharedUI;
using Tango.SharedUI.Helpers;
using Tango.Transport.Adapters;
@@ -333,21 +334,31 @@ namespace Tango.MachineStudio.UI.ViewModels
}
else
{
- using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.ToString() + "..."))
+ _notificationProvider.ShowModalDialog<MachineSerialViewVM>(async (vm) =>
{
- try
+ if (vm.SelectedMachine != null)
{
- await x.SelectedMachine.Connect();
- ApplicationManager.ConnectedMachine = x.SelectedMachine;
- }
- catch (Exception ex)
- {
- logManager.Log(ex);
- _notificationProvider.ShowError(ex.Message);
- }
+ using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.ToString() + "..."))
+ {
+ try
+ {
+ await x.SelectedMachine.Connect();
+ x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber;
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
- InvalidateRelayCommands();
- }
+ SettingsManager.Default.MachineStudio.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber;
+ SettingsManager.SaveDefaultSettings();
+ }
+ catch (Exception ex)
+ {
+ logManager.Log(ex);
+ _notificationProvider.ShowError(ex.Message);
+ }
+
+ InvalidateRelayCommands();
+ }
+ }
+ });
}
InvalidateRelayCommands();