aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-06-24 19:13:33 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-06-24 19:13:33 +0300
commita27ef72084d844ef703aaa9b1c6f4ec032ca182e (patch)
tree6899419d1dbce9e5509f7eec3c0415a3de232464 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
parent7e77e5877a6ab6a03c672199fd3edbe9395e4c45 (diff)
parent545f603c873cd026faf5560dae83da947f0a02a6 (diff)
downloadTango-a27ef72084d844ef703aaa9b1c6f4ec032ca182e.tar.gz
Tango-a27ef72084d844ef703aaa9b1c6f4ec032ca182e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs28
1 files changed, 26 insertions, 2 deletions
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()