diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-09-26 19:29:21 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-09-26 19:29:21 +0300 |
| commit | 7b22fc549089ea11a90486bcef0afbaba4efe3fa (patch) | |
| tree | 67d93bd62570b58d2e44835dd3e5553f9fc0859f | |
| parent | 118436fbb6553e81cfeae70aa3c3a4576fce2b1c (diff) | |
| download | Tango-7b22fc549089ea11a90486bcef0afbaba4efe3fa.tar.gz Tango-7b22fc549089ea11a90486bcef0afbaba4efe3fa.zip | |
Fixed issue with BypassVersionCheck not loading modules.
Added ForceVersionUpdate setting.
6 files changed, 32 insertions, 13 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs index 4958cb0f4..74969fd27 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs @@ -4,13 +4,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.MachineStudio.Common.Web; -namespace Tango.MachineStudio.Common.Authentication +namespace Tango.MachineStudio.Common.Authentication { /// <summary> /// Represents the Machine Studio user authentication provider responsible for the current logged-in user. /// </summary> - public interface IAuthenticationProvider + public interface IAuthenticationProvider { /// <summary> /// Occurs when the current logged-in user has changed. @@ -28,7 +29,7 @@ namespace Tango.MachineStudio.Common.Authentication /// <param name="email">The email.</param> /// <param name="password">The password.</param> /// <returns></returns> - AuthenticationLoginResult Login(String email, String password); + AuthenticationLoginResult Login(String email, String password, bool bypassVersionCheck = false); /// <summary> /// Logs-out the current logged-in user. diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 219b6faf0..781e034e8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -115,6 +115,11 @@ namespace Tango.MachineStudio.Common public bool ByPassEnvironmentVersionCheck { get; set; } /// <summary> + /// Gets or sets a value indicating whether to force the application version update. + /// </summary> + public bool ForceVersionUpdate { get; set; } + + /// <summary> /// Gets or sets a value indicating whether to enable database entity caching. /// </summary> public ObservablesContextInMemoryCachingMode CachingMode { get; set; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index 2de61fd75..7fe1ae36a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -66,12 +66,19 @@ namespace Tango.MachineStudio.UI.Authentication /// <param name="password">The password.</param> /// <returns></returns> /// <exception cref="AuthenticationException">Login failed for user " + email</exception> - public AuthenticationLoginResult Login(string email, string password) + public AuthenticationLoginResult Login(string email, string password, bool bypassVersionCheck = false) { var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); _client.Environment = settings.DeploymentSlot; + var appVersion = AssemblyHelper.GetCurrentAssemblyVersion().ToString(); + + if (settings.ForceVersionUpdate) + { + appVersion = "1.0.0.0"; + } + LoginResponse response = null; try @@ -81,7 +88,7 @@ namespace Tango.MachineStudio.UI.Authentication Email = email, Password = password, - Version = AssemblyHelper.GetCurrentAssemblyVersion().ToString(), + Version = appVersion, }).Result; } @@ -90,12 +97,17 @@ namespace Tango.MachineStudio.UI.Authentication throw new AggregateException(new AuthenticationException("Error logging in to machine service."), ex); } + if (bypassVersionCheck) + { + response.VersionChangeRequired = false; + } + if (settings.Environment == MachineStudioSettings.WorkingEnvironment.Remote) { ObservablesContext.OverrideSettingsDataSource(response.DataSource); } - if (response.VersionChangeRequired) + if (response.VersionChangeRequired && !bypassVersionCheck) { return new AuthenticationLoginResult() { @@ -121,10 +133,7 @@ namespace Tango.MachineStudio.UI.Authentication throw new AuthenticationException("Invalid credentials for " + email); } - if (!response.VersionChangeRequired) - { - CurrentUser = user; - } + CurrentUser = user; return new AuthenticationLoginResult() { 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 c181d7b9d..cf34764d9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -158,7 +158,7 @@ namespace Tango.MachineStudio.UI.ViewModels { _settings.DeploymentSlot = DeploymentSlot; - LoginResponse result = _authenticationProvider.Login(Email, Password).Response; + LoginResponse result = _authenticationProvider.Login(Email, Password, _settings.ByPassEnvironmentVersionCheck).Response; if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck) { 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 c40f91005..4a94322fb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -218,7 +218,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = _machineStudioWebClient.CheckForUpdates(new CheckForUpdatesRequest() { - Version = _application.Version.ToString(), + Version = settings.ForceVersionUpdate ? "1.0.0.0" : _application.Version.ToString(), }).Result; if (response.IsUpdateAvailable) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs index c636e3125..8ac3d7c71 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs @@ -143,7 +143,11 @@ namespace Tango.MachineStudio.Updater if (appProcess != null) { tries++; - appProcess.Kill(); + try + { + appProcess.Kill(); + } + catch { } try { |
