From 48f781d037a83c51fdd555fb6c9d1c2b4e424efe Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 11 Dec 2018 19:43:35 +0200 Subject: Working on PPC hotspot and external bridge. --- .../StudioApplication/DefaultStudioApplicationManager.cs | 6 ++++++ .../MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 7 +++++++ 2 files changed, 13 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 6303b1ac8..ccedde974 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -362,6 +362,12 @@ namespace Tango.MachineStudio.UI.StudioApplication if (connectedMachine != null) { Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == connectedMachine.SerialNumber); + + if (Machine == null) + { + throw new NullReferenceException($"The specified machine '{connectedMachine.SerialNumber}' could not be found on the database."); + } + ConnectedMachine = connectedMachine; ConnectedMachine.SetMachine(Machine); } 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 70378a4d5..d1f9cda64 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -453,6 +453,13 @@ namespace Tango.MachineStudio.UI.ViewModels if (x.SelectedMachine.RequiresAuthentication) { + //Check machine exist on my database first + if (!ObservablesStaticCollections.Instance.Machines.ToList().Exists(y => y.SerialNumber == x.SelectedMachine.SerialNumber)) + { + _notificationProvider.ShowError( $"The specified machine '{x.SelectedMachine.SerialNumber}' could not be found on the database."); + return; + } + _notificationProvider.ShowModalDialog(async (login) => { using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.ToString() + "...")) -- cgit v1.3.1