aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-01-24 17:29:39 +0200
committerAvi Levkovich <avi@twine-s.com>2019-01-24 17:29:39 +0200
commit5af9cb60feeda4b1dd781c3358418798d828d086 (patch)
tree10d76fda2812077022d4ba459652f16fd08daafa /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
parentd1807ee5a17bada69c8062d7e218c006fe654a24 (diff)
parent6f56066c9d7bca42857792a43063b7eb5a9f47ef (diff)
downloadTango-5af9cb60feeda4b1dd781c3358418798d828d086.tar.gz
Tango-5af9cb60feeda4b1dd781c3358418798d828d086.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs23
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs23
2 files changed, 43 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
index c8e25e2d4..8b3747584 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
@@ -10,11 +10,13 @@ using Tango.BL;
using Tango.BL.Enumerations;
using Tango.Core.Commands;
using Tango.Core.Cryptography;
+using Tango.Core.DI;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.EventLogging;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.UI.Messages;
using Tango.Settings;
using Tango.SharedUI;
using Tango.Web;
@@ -150,11 +152,26 @@ namespace Tango.MachineStudio.UI.ViewModels
await Task.Factory.StartNew(() =>
{
-
-
_settings.DeploymentSlot = DeploymentSlot;
- _authenticationProvider.Login(Email, Password);
+ var result = _authenticationProvider.Login(Email, Password).Response;
+
+ if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck)
+ {
+ InvokeUI(() =>
+ {
+ if (_notificationProvider.ShowErrorQuestion($"Your version of Machine Studio is different from the version specified for the selected environment.\nMachine Studio must be changed to version '{result.RequiredVersion}' in order to continue.\nDo you wish to update your local version?"))
+ {
+ TangoMessenger.Default.Send(new ChangeVersionMessage()
+ {
+ LoginResponse = result,
+ });
+ _navigationManager.NavigateTo(NavigationView.UpdateView);
+ }
+ });
+
+ return;
+ }
_eventLogger.Log(EventTypes.APPLICATION_STARTED, "Application Started!");
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
index 60a023071..f671251f7 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
@@ -158,6 +158,29 @@ namespace Tango.MachineStudio.UI.ViewModels
IsRollbackAvailable = File.Exists(GetRollbackFile());
TangoMessenger.Default.Register<Messages.ForcedUpdateMessage>(HandleForcedUpdateMessage);
+ TangoMessenger.Default.Register<Messages.ChangeVersionMessage>(HandleChangeVersionMessage);
+ }
+
+ private async void HandleChangeVersionMessage(ChangeVersionMessage msg)
+ {
+ ForcedUpdate = true;
+ InvalidateRelayCommands();
+
+ Status = UpdateStatus.CheckingForUpdate;
+
+ var client = new MachineStudioUpdateService();
+
+ DownloadLatestVersionResponse response = await client.DownloadLatestVersion(new DownloadLatestVersionRequest()
+ {
+ AccessToken = _authentication.AccessToken,
+ });
+
+ _updateInfo = new CheckForUpdatesResponse();
+ _updateInfo.BlobAddress = response.BlobAddress;
+ _updateInfo.Version = response.Version;
+ LatestVersion = _updateInfo.Version;
+
+ StartUpdate();
}
private void HandleForcedUpdateMessage(ForcedUpdateMessage msg)