aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs52
1 files changed, 6 insertions, 46 deletions
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
/// <summary>
- /// Handles the <see cref="ExternalBridgeService.FullControlSessionDisconnected"/> event.
+ /// Handles the <see cref="ExternalBridgeService.ClientDisconnected"/> event.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- 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
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="ExternalBridgeClientConnectedEventArgs"/> instance containing the event data.</param>
- 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.");
}
}