From 3aa8d26fe59aeea616bda89ca325b9f9583fadc6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 8 Jan 2018 18:19:37 +0200 Subject: Added code comments for: Integration. Refactored ExternalBridgeClient to: IExternalBridgeSecureClient. ExternalBridgeTcpClient. ExternalBridgeUsbClient. Refactored MachineConnectionView to use the new external bridge clients by data template "data type". --- .../DefaultStudioApplicationManager.cs | 2 +- .../ViewModels/MainViewVM.cs | 9 +-- .../Views/MachineConnectionView.xaml | 68 ++++++++-------------- 3 files changed, 30 insertions(+), 49 deletions(-) (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 de8649c13..36b5074cb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -50,7 +50,7 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsMachineConnectedViaTCP { - get { return IsMachineConnected && ConnectedMachine.Type != ExternalBridgeClientType.USB; } + get { return IsMachineConnected && ConnectedMachine is ExternalBridgeTcpClient; } } private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e) 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 b08c259af..ceb81a66f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Integration.Services; using Tango.Logging; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; @@ -152,17 +153,17 @@ namespace Tango.MachineStudio.UI.ViewModels } } - if (x.SelectedMachine.Type != Integration.Services.ExternalBridgeClientType.USB) + if (x.SelectedMachine.RequiresAuthentication) { _notificationProvider.ShowModalDialog(async (login) => { - using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "...")) + using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.ToString() + "...")) { try { await x.SelectedMachine.Connect(); - var authenticated = await x.SelectedMachine.Authenticate(login.Password); + var authenticated = await x.SelectedMachine.As().Authenticate(login.Password); if (!authenticated) { _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine."); @@ -184,7 +185,7 @@ namespace Tango.MachineStudio.UI.ViewModels } else { - using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.Device + "...")) + using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.ToString() + "...")) { try { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 4208c2878..ccab634db 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -5,6 +5,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" @@ -52,58 +53,37 @@ - - - - - - - - - - + + + + + + S/N: - - + + IP Address: - - + + Organization: - - + - - - - - - - - + + + + + + + Port: - - + + Device: - - + - + - + -- cgit v1.3.1