From 00a491d93733d4625ad329b2ba8237f445364b3f Mon Sep 17 00:00:00 2001 From: Mirta Date: Wed, 30 Dec 2020 16:39:52 +0200 Subject: merge --- .../ViewModels/ExternalBridgeViewVM.cs | 52 +++------------------- 1 file changed, 6 insertions(+), 46 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs index f10e84d05..f1127ebfe 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs @@ -12,7 +12,6 @@ using Tango.PMR.Integration; using Tango.PPC.Common; using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Navigation; -using Tango.PPC.UI.Dialogs; namespace Tango.PPC.UI.ViewModels { @@ -25,8 +24,6 @@ namespace Tango.PPC.UI.ViewModels { private bool _disconnecting; - private const int KEEP_SAFETY_AUTHENTICATION_MINUTES = 5; - #region Properties private ExternalBridgeClientConnectedEventArgs _connection; @@ -82,7 +79,7 @@ namespace Tango.PPC.UI.ViewModels LogManager.Log("Disconnecting current external bridge session."); _disconnecting = true; InvalidateRelayCommands(); - ExternalBridgeService.DisconnectFullControlSession(); + ExternalBridgeService.DisconnectSession(); } #endregion @@ -106,7 +103,7 @@ namespace Tango.PPC.UI.ViewModels public override void OnApplicationStarted() { ExternalBridgeService.ConnectionRequest += ExternalBridgeService_ConnectionRequest; - ExternalBridgeService.FullControlSessionDisconnected += ExternalBridgeService_FullControlSessionDisconnected; + ExternalBridgeService.ClientDisconnected += ExternalBridgeService_ClientDisconnected; } #endregion @@ -114,11 +111,11 @@ namespace Tango.PPC.UI.ViewModels #region Event Handlers /// - /// Handles the event. + /// Handles the event. /// /// The sender. /// The instance containing the event data. - private void ExternalBridgeService_FullControlSessionDisconnected(object sender, EventArgs e) + private void ExternalBridgeService_ClientDisconnected(object sender, EventArgs e) { if (IsVisible) { @@ -136,14 +133,13 @@ namespace Tango.PPC.UI.ViewModels /// /// The sender. /// The instance containing the event data. - private async void ExternalBridgeService_ConnectionRequest(object sender, ExternalBridgeClientConnectedEventArgs e) + private void ExternalBridgeService_ConnectionRequest(object sender, ExternalBridgeClientConnectedEventArgs e) { LogManager.Log($"External bridge connection request received.\n{e.ToJsonString()}"); if (!e.Request.Intent.RequiresPassword() || e.Request.Password == Settings.ExternalBridgePassword) { - e.ApplicationInformation.Version = ApplicationManager.Version.ToString(); - e.ApplicationInformation.StartupDate = ApplicationManager.StartUpDate.ToUniversalTime().ToString(); + e.Confirmed = true; Connection = e; @@ -154,41 +150,6 @@ namespace Tango.PPC.UI.ViewModels LogManager.Log($"External bridge connection user has been identified as {User.Contact.FullName}"); } - if (e.Request.RequireSafetyLevelOperations) - { - DateTime lastAuthenticationTime; - bool bypassSafetyConfirmation = false; - - if (ExternalBridgeReceiver.LastSafetyLevelContactsTimes.TryGetValue(e.Request.UserName, out lastAuthenticationTime)) - { - if (DateTime.Now < lastAuthenticationTime.AddMinutes(KEEP_SAFETY_AUTHENTICATION_MINUTES)) - { - bypassSafetyConfirmation = true; - e.Confirm(); - } - } - - if (!bypassSafetyConfirmation) - { - SafetyLevelOperationsConfirmationViewVM vm = new SafetyLevelOperationsConfirmationViewVM(e); - await NotificationProvider.ShowDialog(vm); - - if (vm.DialogResult) - { - e.Confirm(); - } - else - { - e.Decline("Safety level connection refused by the remote user."); - return; - } - } - } - else - { - e.Confirm(); - } - if (e.Request.Intent == ExternalBridgeLoginIntent.FullControl) { LogManager.Log("Navigating to external bridge view..."); @@ -200,7 +161,6 @@ namespace Tango.PPC.UI.ViewModels } else { - e.Decline("Connection password did not match the machine external bridge password."); LogManager.Log("Connection password did not match the machine external bridge password."); } } -- cgit v1.3.1