diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-24 13:56:53 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-24 13:56:53 +0300 |
| commit | 2485372366139f4f6bec48ab61e98ea1b6375b18 (patch) | |
| tree | 0805f42d20898bb661d133b5c3c95b6bdae69a7b /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels | |
| parent | 54802d8343dcb710ced4d009995a8cc796915039 (diff) | |
| download | Tango-2485372366139f4f6bec48ab61e98ea1b6375b18.tar.gz Tango-2485372366139f4f6bec48ab61e98ea1b6375b18.zip | |
Machine Studio v 1.0.0.5 !
Forced update.
Hashed passwords.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
3 files changed, 70 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 5c8fb80ba..26be2d16b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -17,6 +17,8 @@ using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.MachineStudio.UI.TFS; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Update; +using Tango.Core.DI; namespace Tango.MachineStudio.UI.ViewModels { @@ -77,6 +79,46 @@ namespace Tango.MachineStudio.UI.ViewModels { try { + LogManager.Log("Checking for forced update..."); + var service = UpdateServiceHelper.GetUpdateServiceChannel(); + var client = service.CreateChannel(); + + CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() + { + Email = "ForceUpdate", + Password = "ForceUpdate", + Version = ApplicationManager.Version, + }); + + if (response.IsUpdateAvailable && response.ForcedUpdate) + { + LogManager.Log("Forced update found, Navigating to update view!"); + + InvokeUI(() => + { + if (_notificationProvider.ShowQuestion("Machine Studio has detected a critical update which must be installed in order for the application to run properly. Do you wish to download and install this update?")) + { + TangoMessenger.Default.Send(new Messages.ForcedUpdateMessage() { UpdateResponse = response }); + _navigationManager.NavigateTo(NavigationView.UpdateView); + } + else + { + ApplicationManager.ShutDown(); + } + + IsLoading = false; + }); + + return; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error checking for forced update!"); + } + + try + { _tfs.Initialize(); } catch (Exception ex) 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 d3d90c0cc..aa0eedefb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -317,6 +317,8 @@ namespace Tango.MachineStudio.UI.ViewModels ReportIssueCommand = new RelayCommand(ReportIssue); OpenResolvedBugsCommand = new RelayCommand(OpenResolvedBugs); OpenDeveloperConsoleCommand = new RelayCommand(OpenDeveloperConsole); + + TangoMessenger.Default.Register<Messages.ForcedUpdateMessage>((x) => DisableCheckForUpdates = true); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) 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 c8b4b6adc..d7ce29b2e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -21,6 +21,7 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Update; using Tango.SharedUI; +using Tango.MachineStudio.UI.Messages; namespace Tango.MachineStudio.UI.ViewModels { @@ -48,6 +49,13 @@ namespace Tango.MachineStudio.UI.ViewModels private CheckForUpdatesResponse _updateInfo; private TemporaryFolder _newPackageTempFolder; + private bool _forcedUpdate; + public bool ForcedUpdate + { + get { return _forcedUpdate; } + set { _forcedUpdate = value; RaisePropertyChangedAuto(); } + } + private UpdateStatus _status; public UpdateStatus Status { @@ -104,14 +112,30 @@ namespace Tango.MachineStudio.UI.ViewModels LatestVersion = "1.0.0.2"; Status = UpdateStatus.CheckingForUpdate; UpdateCommand = new RelayCommand(StartUpdate, () => Status == UpdateStatus.UpdateAvailable); - BackCommand = new RelayCommand(BackToApplication, () => Status != UpdateStatus.Updating); + BackCommand = new RelayCommand(BackToApplication, () => Status != UpdateStatus.Updating && !ForcedUpdate); RestartCommand = new RelayCommand(RestartApplication, () => Status == UpdateStatus.UpdateCompleted); TryAgainCommand = new RelayCommand(TryAgain, () => Status == UpdateStatus.Error); + + TangoMessenger.Default.Register<Messages.ForcedUpdateMessage>(HandleForcedUpdateMessage); + } + + private void HandleForcedUpdateMessage(ForcedUpdateMessage msg) + { + ForcedUpdate = true; + InvalidateRelayCommands(); + + _updateInfo = msg.UpdateResponse; + Status = UpdateStatus.UpdateAvailable; + LatestVersion = _updateInfo.Version; + StartUpdate(); } public void OnNavigatedInto() { - CheckForUpdates(); + if (!ForcedUpdate) + { + CheckForUpdates(); + } } private void CheckForUpdates() |
