aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-03-28 10:55:56 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-03-28 10:55:56 +0200
commit36f19301ac0cc27d74b73eb4b31fdecfd86f5060 (patch)
treee4f4a636f4a2dc03376e6eff2077ced4079429ed /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent1ea2a13900697e203658ff8c9489b70866792a49 (diff)
parentb62c4b8b67b3103c691564df80f65423a9c315a0 (diff)
downloadTango-36f19301ac0cc27d74b73eb4b31fdecfd86f5060.tar.gz
Tango-36f19301ac0cc27d74b73eb4b31fdecfd86f5060.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs27
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs37
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs16
3 files changed, 70 insertions, 10 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 a8faeea7b..80a95d1bf 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
@@ -7,6 +7,7 @@ using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.Core.DI;
using Tango.Integration.ExternalBridge;
+using Tango.PMR.Integration;
using Tango.PPC.Common;
using Tango.PPC.Common.ExternalBridge;
using Tango.PPC.Common.Navigation;
@@ -115,12 +116,15 @@ namespace Tango.PPC.UI.ViewModels
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ExternalBridgeService_ClientDisconnected(object sender, EventArgs e)
{
- LogManager.Log("External bridge client disconnected. Navigating to home module...");
-
- InvokeUI(() =>
+ if (IsVisible)
{
- NavigationManager.NavigateTo(NavigationView.HomeModule);
- });
+ LogManager.Log("External bridge client disconnected. Navigating to home module...");
+
+ InvokeUI(() =>
+ {
+ NavigationManager.NavigateTo(NavigationView.HomeModule);
+ });
+ }
}
/// <summary>
@@ -132,7 +136,7 @@ namespace Tango.PPC.UI.ViewModels
{
LogManager.Log($"External bridge connection request received.\n{e.ToJsonString()}");
- if (e.Request.Password == Settings.ExternalBridgePassword)
+ if (!e.Request.Intent.RequiresPassword() || e.Request.Password == Settings.ExternalBridgePassword)
{
e.Confirmed = true;
@@ -145,11 +149,14 @@ namespace Tango.PPC.UI.ViewModels
LogManager.Log($"External bridge connection user has been identified as {User.Contact.FullName}");
}
- LogManager.Log("Navigating to external bridge view...");
- InvokeUI(() =>
+ if (e.Request.Intent == ExternalBridgeLoginIntent.FullControl)
{
- NavigationManager.NavigateTo(NavigationView.ExternalBridgeView, false);
- });
+ LogManager.Log("Navigating to external bridge view...");
+ InvokeUI(() =>
+ {
+ NavigationManager.NavigateTo(NavigationView.ExternalBridgeView, false);
+ });
+ }
}
else
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
index 1c1eeca5e..9e8a9fe34 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
@@ -115,6 +115,12 @@ namespace Tango.PPC.UI.ViewModels
/// Gets or sets the power command.
/// </summary>
public RelayCommand PowerCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the restart application command.
+ /// </summary>
+ public RelayCommand RestartApplicationCommand { get; set; }
+
#endregion
#region Constructors
@@ -139,6 +145,7 @@ namespace Tango.PPC.UI.ViewModels
});
PowerCommand = new RelayCommand(() => IsPowerOpened = true);
+ RestartApplicationCommand = new RelayCommand(RestartApplication);
}
#endregion
@@ -221,6 +228,17 @@ namespace Tango.PPC.UI.ViewModels
}
}
+ /// <summary>
+ /// Restarts the application.
+ /// </summary>
+ private async void RestartApplication()
+ {
+ if (await NotificationProvider.ShowQuestion("Are you sure you want to restart the application?"))
+ {
+ ApplicationManager.Restart();
+ }
+ }
+
#endregion
#region Override Methods
@@ -244,6 +262,25 @@ namespace Tango.PPC.UI.ViewModels
#endregion
+ #region Public Methods
+
+ /// <summary>
+ /// Toggles the application technician mode.
+ /// </summary>
+ public void ToggleTechnicianMode()
+ {
+ if (!ApplicationManager.IsInTechnicianMode)
+ {
+ ApplicationManager.EnterTechnicianMode();
+ }
+ else
+ {
+ ApplicationManager.ExitTechnicianMode();
+ }
+ }
+
+ #endregion
+
#region Event Handlers
/// <summary>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
index b5b5f56bc..f265c5dbf 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -33,6 +33,7 @@ namespace Tango.PPC.UI.ViewModels
private MachineUpdateResult _update_result;
private DbCompareResult _db_compare_result;
+ private bool _isChecking;
#region Properties
@@ -132,10 +133,21 @@ namespace Tango.PPC.UI.ViewModels
{
await NavigateTo(MachineUpdateView.UpdateCheckView);
+ if (_isChecking) return;
+
try
{
+ _isChecking = true;
IsDbUpdate = false;
+ await Task.Delay(2000);
+ if (!await ConnectivityProvider.CheckInternetConnection())
+ {
+ _isChecking = false;
+ await NavigateTo(MachineUpdateView.UpdateCheckErrorView);
+ return;
+ }
+
var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber);
if (response.IsUpdateAvailable)
@@ -164,6 +176,10 @@ namespace Tango.PPC.UI.ViewModels
LogManager.Log(ex, "Error while trying to check for updates.");
await NavigateTo(MachineUpdateView.UpdateFailedView);
}
+ finally
+ {
+ _isChecking = false;
+ }
}
private async void Update()