aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
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.cs39
1 files changed, 22 insertions, 17 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 6c44c8480..92c0afa21 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -124,33 +124,38 @@ namespace Tango.MachineStudio.UI.ViewModels
private void ConnectToMachine()
{
- _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) =>
+ _notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) =>
{
if (x.SelectedMachine != null)
{
- 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();
- 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;
- var response = await x.SelectedMachine.SendRequest<CalculateRequest, CalculateResponse>(new CalculateRequest() { A = 10, B = 5 });
- _notificationProvider.ShowInfo(response.ToString());
+ LogManager.Log(ex);
+ _notificationProvider.ShowError(ex.Message);
}
+
+ InvalidateRelayCommands();
}
- catch (Exception ex)
- {
- LogManager.Log(ex);
- _notificationProvider.ShowError(ex.Message);
- }
- }
+ });
+
+ InvalidateRelayCommands();
}
InvalidateRelayCommands();