diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-02-19 01:50:58 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-02-19 01:50:58 +0200 |
| commit | 9736b8c8ede6a0d121dea8381f0abb561fad5631 (patch) | |
| tree | 1c38f3f5be82b923ffae40fae00a25487179ab54 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels | |
| parent | be3343cc0268179c7a6f628fa5e68f323a3335e5 (diff) | |
| download | Tango-9736b8c8ede6a0d121dea8381f0abb561fad5631.tar.gz Tango-9736b8c8ede6a0d121dea8381f0abb561fad5631.zip | |
Implemented auto generated web clients for PPC and machine studio.
Improved interactions with web clients across solutions.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
3 files changed, 17 insertions, 18 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 8b3747584..1165c0920 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -16,6 +16,7 @@ using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.Web; using Tango.MachineStudio.UI.Messages; using Tango.Settings; using Tango.SharedUI; @@ -35,6 +36,7 @@ namespace Tango.MachineStudio.UI.ViewModels private IEventLogger _eventLogger; private Rfc2898Cryptographer cryptographer; private MachineStudioSettings _settings; + private MachineStudioWebClient _machineStudioWebClient; private String _email; /// <summary> @@ -111,10 +113,11 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="authenticationProvider">The authentication provider.</param> /// <param name="navigationManager">The navigation manager.</param> /// <param name="notificationProvider">The notification provider.</param> - public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger) + public LoginViewVM(MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger) { EnableSlotSelection = true; + _machineStudioWebClient = machineStudioWebClient; _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); _notificationProvider = notificationProvider; 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 56ebb1e00..986bf483f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -55,6 +55,7 @@ namespace Tango.MachineStudio.UI.ViewModels private Thread _updateCheckThread; private IEventLogger _eventLogger; private MachineStudioSettings _settings; + private MachineStudioWebClient _machineStudioWebClient; /// <summary> /// Gets or sets the current loaded module. @@ -281,8 +282,10 @@ namespace Tango.MachineStudio.UI.ViewModels IEventLogger eventLogger, IDiagnosticsFrameProvider frameProvider, ISpeechProvider speechProvider, - TeamFoundationServiceExtendedClient tfs) : base() + TeamFoundationServiceExtendedClient tfs, + MachineStudioWebClient machineStudioWebClient) : base() { + _machineStudioWebClient = machineStudioWebClient; TFSClient = tfs; _eventLogger = eventLogger; _navigation = navigationManager; @@ -357,11 +360,8 @@ namespace Tango.MachineStudio.UI.ViewModels { if (_authenticationProvider.CurrentUser != null) { - var client = new MachineStudioWebService(); - - CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() + CheckForUpdatesResponse response = _machineStudioWebClient.CheckForUpdates(new CheckForUpdatesRequest() { - AccessToken = _authenticationProvider.AccessToken, Version = _applicationManager.Version.ToString(), }).Result; 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 57043df0e..17edf1dfd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -25,7 +25,6 @@ using Tango.MachineStudio.UI.Messages; using Tango.Settings; using Tango.MachineStudio.Common; using Tango.Transport.Web; -using Tango.MachineStudio.Common.Web; namespace Tango.MachineStudio.UI.ViewModels { @@ -56,6 +55,7 @@ namespace Tango.MachineStudio.UI.ViewModels private CheckForUpdatesResponse _updateInfo; private TemporaryFolder _newPackageTempFolder; private TemporaryFolder _previousPackageTempFolder; + private MachineStudioWebClient _machineStudioWebClient; private bool _forcedUpdate; public bool ForcedUpdate @@ -140,8 +140,9 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand TryRollbackAgainCommand { get; set; } - public UpdateViewVM(INotificationProvider notification, IAuthenticationProvider authentication, INavigationManager navigation, IStudioApplicationManager application) + public UpdateViewVM(MachineStudioWebClient machineStudioWebClient, INotificationProvider notification, IAuthenticationProvider authentication, INavigationManager navigation, IStudioApplicationManager application) { + _machineStudioWebClient = machineStudioWebClient; _notification = notification; _navigation = navigation; _application = application; @@ -169,11 +170,9 @@ namespace Tango.MachineStudio.UI.ViewModels Status = UpdateStatus.CheckingForUpdate; - var client = new MachineStudioWebService(); - - DownloadLatestVersionResponse response = await client.DownloadLatestVersion(new DownloadLatestVersionRequest() + DownloadLatestVersionResponse response = await _machineStudioWebClient.DownloadLatestVersion(new DownloadLatestVersionRequest() { - AccessToken = _authentication.AccessToken, + }); _updateInfo = new CheckForUpdatesResponse(); @@ -210,17 +209,14 @@ namespace Tango.MachineStudio.UI.ViewModels var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); - Task.Factory.StartNew(() => + Task.Factory.StartNew((Action)(() => { try { Thread.Sleep(2000); - var client = new MachineStudioWebService(); - - CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() + CheckForUpdatesResponse response = _machineStudioWebClient.CheckForUpdates(new CheckForUpdatesRequest() { - AccessToken = _authentication.AccessToken, Version = _application.Version.ToString(), }).Result; @@ -241,7 +237,7 @@ namespace Tango.MachineStudio.UI.ViewModels logManager.Log(ex, "Error while checking for version update!"); Status = UpdateStatus.Error; } - }); + })); } private void BackToApplication() |
