From 795444f234f6b45bc83d5c7b28725bd7ebc7ee89 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 24 Dec 2018 17:39:01 +0200 Subject: Working on machine service and machine studio. --- .../DefaultAuthenticationProvider.cs | 7 ++++ .../ViewModels/LoadingViewVM.cs | 42 ---------------------- .../ViewModels/MainViewVM.cs | 5 ++- .../ViewModels/UpdateViewVM.cs | 3 +- 4 files changed, 10 insertions(+), 47 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') 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 450756705..4acc76c25 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -63,6 +63,8 @@ namespace Tango.MachineStudio.UI.Authentication }).Result; + AccessToken = response.Token; + ObservablesContext.OverrideSettingsDataSource(response.DataSource); ObservablesStaticCollections.Instance.Initialize(); @@ -107,5 +109,10 @@ namespace Tango.MachineStudio.UI.Authentication { CurrentUser = null; } + + /// + /// Gets the access token that was retrieved at the last login. + /// + public string AccessToken { get; private set; } } } 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 6e8d0488b..283ea3637 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -89,48 +89,6 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - try - { - Status = "Checking for critical updates..."; - - LogManager.Log("Checking for forced update..."); - - var client = new MachineStudioUpdateService(); - - CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() - { - Email = "ForceUpdate", - Password = "ForceUpdate", - Version = ApplicationManager.Version.ToString(), - }).Result; - - 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 { Status = "Connecting to Team Foundation Services..."; 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 befad162c..818d507ae 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -363,8 +363,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { - Email = _authenticationProvider.CurrentUser.Email, - Password = _authenticationProvider.CurrentUser.Password, + Token = _authenticationProvider.AccessToken, Version = _applicationManager.Version.ToString(), AcceptBetaRelease = _settings.AcceptBetaRelease, }).Result; @@ -455,7 +454,7 @@ namespace Tango.MachineStudio.UI.ViewModels //Check machine exist on my database first if (x.SelectedMachine.Machine == null) { - _notificationProvider.ShowError( $"The specified machine '{x.SelectedMachine.SerialNumber}' could not be found on the database. Aborting connection."); + _notificationProvider.ShowError($"The specified machine '{x.SelectedMachine.SerialNumber}' could not be found on the database. Aborting connection."); return; } 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 3fec96629..e19dcdbe5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -196,8 +196,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { - Email = _authentication.CurrentUser.Email, - Password = _authentication.CurrentUser.Password, + Token = _authentication.AccessToken, Version = _application.Version.ToString(), AcceptBetaRelease = settings.AcceptBetaRelease, }).Result; -- cgit v1.3.1