aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-19 11:19:21 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-19 11:19:21 +0200
commit93e6a6bfa7238826dcdea989e279ec3450067f83 (patch)
tree212b5023935862346a7de311e37cf1ef727efcd5 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parente99efd9d9b7b67a76db82a9a40525f96bcf064c0 (diff)
parent3fcd0dbc6650749421f0390a60154c52254682e6 (diff)
downloadTango-93e6a6bfa7238826dcdea989e279ec3450067f83.tar.gz
Tango-93e6a6bfa7238826dcdea989e279ec3450067f83.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs24
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ChangeVersionMessage.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ForcedUpdateMessage.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs12
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml8
10 files changed, 43 insertions, 38 deletions
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 9be938fb7..e07952f29 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
@@ -15,6 +15,7 @@ using Tango.Settings;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.Core.Helpers;
+using Tango.MachineStudio.Common.Web;
namespace Tango.MachineStudio.UI.Authentication
{
@@ -25,6 +26,8 @@ namespace Tango.MachineStudio.UI.Authentication
/// <seealso cref="Tango.MachineStudio.Common.Authentication.IAuthenticationProvider" />
public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider
{
+ private MachineStudioWebClient _client;
+
private User _currentUser;
/// <summary>
/// Gets the current logged-in user.
@@ -46,6 +49,15 @@ namespace Tango.MachineStudio.UI.Authentication
public event EventHandler<User> CurrentUserChanged;
/// <summary>
+ /// Initializes a new instance of the <see cref="DefaultAuthenticationProvider"/> class.
+ /// </summary>
+ /// <param name="machineStudioWebClient">The machine studio web client.</param>
+ public DefaultAuthenticationProvider(MachineStudioWebClient machineStudioWebClient)
+ {
+ _client = machineStudioWebClient;
+ }
+
+ /// <summary>
/// Performs a user login by the specified email and password.
/// </summary>
/// <param name="email">The email.</param>
@@ -56,9 +68,8 @@ namespace Tango.MachineStudio.UI.Authentication
{
var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
-
- IWebTransportClient service = new WebTransportClient();
- var response = service.PostJson<LoginRequest, LoginResponse>(settings.GetMachineServiceAddress() + "/api/MachineStudio/Login", new LoginRequest()
+ _client.Environment = settings.DeploymentSlot;
+ var response = _client.Login(new LoginRequest()
{
Email = email,
@@ -67,8 +78,6 @@ namespace Tango.MachineStudio.UI.Authentication
}).Result;
- AccessToken = response.Token;
-
if (settings.Environment == MachineStudioSettings.WorkingEnvironment.Remote)
{
ObservablesContext.OverrideSettingsDataSource(response.DataSource);
@@ -113,10 +122,5 @@ namespace Tango.MachineStudio.UI.Authentication
{
CurrentUser = null;
}
-
- /// <summary>
- /// Gets the access token that was retrieved at the last login.
- /// </summary>
- public string AccessToken { get; private set; }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ChangeVersionMessage.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ChangeVersionMessage.cs
index fc616f359..a0fdec8ed 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ChangeVersionMessage.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ChangeVersionMessage.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.MachineStudio.Common.Authentication;
-using Tango.MachineStudio.Common.Update;
+using Tango.MachineStudio.Common.Web;
namespace Tango.MachineStudio.UI.Messages
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ForcedUpdateMessage.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ForcedUpdateMessage.cs
index 38bc82b6e..54b43c6d3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ForcedUpdateMessage.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Messages/ForcedUpdateMessage.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Tango.MachineStudio.Common.Update;
+using Tango.MachineStudio.Common.Web;
namespace Tango.MachineStudio.UI.Messages
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
index 951b80ab4..bceaaf956 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
@@ -4,5 +4,5 @@ using System.Runtime.InteropServices;
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyTitle("Tango - Machine Studio")]
-[assembly: AssemblyVersion("4.0.6.0")]
+[assembly: AssemblyVersion("4.0.7.0")]
[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
index b0a3a8c11..7fbb0008c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
@@ -14,6 +14,7 @@ using Tango.MachineStudio.Common.Speech;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Common.Threading;
using Tango.MachineStudio.Common.Video;
+using Tango.MachineStudio.Common.Web;
using Tango.MachineStudio.UI.Authentication;
using Tango.MachineStudio.UI.Console;
using Tango.MachineStudio.UI.FirmwareUpgrade;
@@ -68,8 +69,10 @@ namespace Tango.MachineStudio.UI
TangoIOC.Default.Unregister<ITeamFoundationServiceClient>();
TangoIOC.Default.Unregister<IDispatcherProvider>();
TangoIOC.Default.Unregister<IFirmwareUpgrader>();
+ TangoIOC.Default.Unregister<MachineStudioWebClient>();
+ TangoIOC.Default.Register<MachineStudioWebClient, MachineStudioWebClient>(new MachineStudioWebClient());
TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher));
TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>();
TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>();
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 283ea3637..e55d0534e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -17,7 +17,7 @@ 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.MachineStudio.Common.Web;
using Tango.Core.DI;
using Tango.Settings;
using Tango.Core;
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 1d03dd389..986bf483f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -27,7 +27,7 @@ using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.Common.Speech;
using Tango.MachineStudio.Common.StudioApplication;
-using Tango.MachineStudio.Common.Update;
+using Tango.MachineStudio.Common.Web;
using Tango.MachineStudio.UI.StudioApplication;
using Tango.MachineStudio.UI.SupervisingController;
using Tango.MachineStudio.UI.TFS;
@@ -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 MachineStudioUpdateService();
-
- 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 63cff2242..17edf1dfd 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
@@ -19,7 +19,7 @@ using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.Common.StudioApplication;
-using Tango.MachineStudio.Common.Update;
+using Tango.MachineStudio.Common.Web;
using Tango.SharedUI;
using Tango.MachineStudio.UI.Messages;
using Tango.Settings;
@@ -55,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
@@ -139,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;
@@ -168,11 +170,9 @@ namespace Tango.MachineStudio.UI.ViewModels
Status = UpdateStatus.CheckingForUpdate;
- var client = new MachineStudioUpdateService();
-
- DownloadLatestVersionResponse response = await client.DownloadLatestVersion(new DownloadLatestVersionRequest()
+ DownloadLatestVersionResponse response = await _machineStudioWebClient.DownloadLatestVersion(new DownloadLatestVersionRequest()
{
- AccessToken = _authentication.AccessToken,
+
});
_updateInfo = new CheckForUpdatesResponse();
@@ -209,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 MachineStudioUpdateService();
-
- CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest()
+ CheckForUpdatesResponse response = _machineStudioWebClient.CheckForUpdates(new CheckForUpdatesRequest()
{
- AccessToken = _authentication.AccessToken,
Version = _application.Version.ToString(),
}).Result;
@@ -240,7 +237,7 @@ namespace Tango.MachineStudio.UI.ViewModels
logManager.Log(ex, "Error while checking for version update!");
Status = UpdateStatus.Error;
}
- });
+ }));
}
private void BackToApplication()
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
index 696cc051f..640c3c1df 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
@@ -50,18 +50,16 @@
<TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.CoreVersion,Mode=OneWay}"></Run></TextBlock>
<TextBlock FontWeight="SemiBold">Build Date:</TextBlock>
<TextBlock Text="{Binding ApplicationManager.BuildDate,Mode=OneWay}"></TextBlock>
- <TextBlock FontWeight="SemiBold">Environment Mode:</TextBlock>
+ <TextBlock FontWeight="SemiBold">Data Mode:</TextBlock>
<TextBlock Text="{Binding MachineStudioSettings.Environment,Mode=OneWay}"></TextBlock>
- <TextBlock FontWeight="SemiBold">Environment Slot:</TextBlock>
+ <TextBlock FontWeight="SemiBold">Environment:</TextBlock>
<TextBlock Text="{Binding MachineStudioSettings.DeploymentSlot,Mode=OneWay}"></TextBlock>
<TextBlock FontWeight="SemiBold">Machine Service:</TextBlock>
- <TextBlock Text="{Binding MachineStudioSettings.DeploymentSlot,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay}"></TextBlock>
+ <TextBlock Text="{Binding MachineStudioSettings.MachineServiceAddress}"></TextBlock>
<TextBlock FontWeight="SemiBold">Data Source:</TextBlock>
<TextBlock><Run Text="{Binding DataSource.Address,Mode=OneWay}"></Run>
<Run>(</Run><Run Foreground="Gray" Text="{Binding DataSource.Catalog,Mode=OneWay}"></Run><Run>)</Run>
</TextBlock>
- <TextBlock FontWeight="SemiBold">Allow BETA Updates:</TextBlock>
- <ToggleButton IsChecked="{Binding MachineStudioSettings.AcceptBetaRelease,Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Bottom"></ToggleButton>
</controls:TableGrid>
<DockPanel Margin="0 0 0 0">