aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-07-09 13:32:33 +0300
committerAvi Levkovich <avi@twine-s.com>2018-07-09 13:32:33 +0300
commit6b755271ed4ef5f1b1d09d96e54fe081920f4f41 (patch)
tree51f6bb96aefb3666c827d1dd06ef6d76cf81a44a /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
parent042a453f826da5c8a600ab4ae8b3d611044168de (diff)
parent47396728e782e433a11768904cda94c47dc02933 (diff)
downloadTango-6b755271ed4ef5f1b1d09d96e54fe081920f4f41.tar.gz
Tango-6b755271ed4ef5f1b1d09d96e54fe081920f4f41.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs20
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs19
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs42
3 files changed, 79 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs
new file mode 100644
index 000000000..5fe3b06b8
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.MachineStudio.Common.StudioApplication;
+using Tango.SharedUI;
+
+namespace Tango.MachineStudio.UI.ViewModels
+{
+ public class AboutViewVM : DialogViewVM
+ {
+ public IStudioApplicationManager ApplicationManager { get; set; }
+
+ public AboutViewVM(IStudioApplicationManager applicationManager)
+ {
+ ApplicationManager = applicationManager;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs
index 9f84cfb53..76e138e0e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs
@@ -13,6 +13,13 @@ namespace Tango.MachineStudio.UI.ViewModels
{
public class ConnectedMachineViewVM : DialogViewVM
{
+ public enum ConnectedMachineVMResult
+ {
+ Cancel,
+ Disconnect,
+ UploadHardwareConfig,
+ }
+
private IStudioApplicationManager _applicationManager;
public IStudioApplicationManager ApplicationManager
{
@@ -20,16 +27,28 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _applicationManager = value; RaisePropertyChangedAuto(); }
}
+ public ConnectedMachineVMResult Result { get; set; }
+
public RelayCommand DisconnectCommand { get; set; }
+ public RelayCommand UploadHardwareConfigurationCommand { get; set; }
+
public ConnectedMachineViewVM(IStudioApplicationManager application)
{
ApplicationManager = application;
DisconnectCommand = new RelayCommand(Disconnect);
+ UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration);
+ }
+
+ private void UploadHardwareConfiguration()
+ {
+ Result = ConnectedMachineVMResult.UploadHardwareConfig;
+ Accept();
}
private void Disconnect()
{
+ Result = ConnectedMachineVMResult.Disconnect;
Accept();
}
}
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 aa0eedefb..8eaa1f360 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -159,6 +159,11 @@ namespace Tango.MachineStudio.UI.ViewModels
/// </summary>
public RelayCommand OpenDeveloperConsoleCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the about command.
+ /// </summary>
+ public RelayCommand AboutCommand { get; set; }
+
private IAuthenticationProvider _authenticationProvider;
/// <summary>
/// Gets or sets the authentication provider.
@@ -319,6 +324,8 @@ namespace Tango.MachineStudio.UI.ViewModels
OpenDeveloperConsoleCommand = new RelayCommand(OpenDeveloperConsole);
TangoMessenger.Default.Register<Messages.ForcedUpdateMessage>((x) => DisableCheckForUpdates = true);
+
+ AboutCommand = new RelayCommand(ShowAboutDialog);
}
private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e)
@@ -502,9 +509,32 @@ namespace Tango.MachineStudio.UI.ViewModels
}
else
{
- _notificationProvider.ShowModalDialog<ConnectedMachineViewVM>((x) =>
+ _notificationProvider.ShowModalDialog<ConnectedMachineViewVM>(async (x) =>
{
- DisconnectFromMachine();
+ if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.Disconnect)
+ {
+ DisconnectFromMachine();
+ }
+ else if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.UploadHardwareConfig)
+ {
+ if (NotificationProvider.ShowQuestion("This will reset the machine hardware configuration to the database configuration. Are you sure?"))
+ {
+ using (NotificationProvider.PushTaskItem("Uploading hardware configuration..."))
+ {
+ try
+ {
+ var configuration = ApplicationManager.ConnectedMachine.Machine.Configuration;
+ await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(configuration.HardwareVersion, configuration);
+ NotificationProvider.ShowInfo("Hardware configuration uploaded successfully.");
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error upload hardware configuration.");
+ NotificationProvider.ShowError("Error upload hardware configuration." + Environment.NewLine + ex.Message);
+ }
+ }
+ }
+ }
});
}
@@ -660,6 +690,14 @@ namespace Tango.MachineStudio.UI.ViewModels
}
}
+ /// <summary>
+ /// Shows the about dialog.
+ /// </summary>
+ private void ShowAboutDialog()
+ {
+ NotificationProvider.ShowModalDialog<AboutViewVM>((x) => { });
+ }
+
private void ReportIssue()
{
_notificationProvider.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(TFSClient.Project, TFSClient.CreateBug()), async (vm) =>