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-01-07 18:39:32 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-07 18:39:32 +0200
commite7a30d51c85b2d9be2f675769506c1faa8667c89 (patch)
tree43cbc5ee686f6aa9bb3894b4d5ded64b187ba710 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
parentc0e3c58693d59462398d0cae57923635f89ae47a (diff)
downloadTango-e7a30d51c85b2d9be2f675769506c1faa8667c89.tar.gz
Tango-e7a30d51c85b2d9be2f675769506c1faa8667c89.zip
Implemented External Bridge Client USB Connection.
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.cs44
1 files changed, 33 insertions, 11 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 061420037..f2beb7113 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -139,26 +139,48 @@ namespace Tango.MachineStudio.UI.ViewModels
private void ConnectToMachine()
{
- _notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) =>
+ _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) =>
{
if (x.SelectedMachine != null)
{
- _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
+ if (x.SelectedMachine.Type != Integration.Services.ExternalBridgeClientType.USB)
{
- using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
+ _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
{
- try
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
{
- await x.SelectedMachine.Connect();
- var authenticated = await x.SelectedMachine.Authenticate(login.Password);
- if (!authenticated)
+ try
{
- _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ await x.SelectedMachine.Connect();
+
+ var authenticated = await x.SelectedMachine.Authenticate(login.Password);
+ if (!authenticated)
+ {
+ _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ }
+ else
+ {
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ }
}
- else
+ catch (Exception ex)
{
- ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ LogManager.Log(ex);
+ _notificationProvider.ShowError(ex.Message);
}
+
+ InvalidateRelayCommands();
+ }
+ });
+ }
+ else
+ {
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.Device + "..."))
+ {
+ try
+ {
+ await x.SelectedMachine.Connect();
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
}
catch (Exception ex)
{
@@ -168,7 +190,7 @@ namespace Tango.MachineStudio.UI.ViewModels
InvalidateRelayCommands();
}
- });
+ }
InvalidateRelayCommands();
}