aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 12:03:55 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 12:03:55 +0300
commitc9d3c1a7408f6f7a4814c1a8f5cf58a2d13e1694 (patch)
tree3b92b537099625fd2d29a4e08378194c3c62f3c4 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parent5ab2e8a2edf1ce487976da347a5e03d18ff307b1 (diff)
downloadTango-c9d3c1a7408f6f7a4814c1a8f5cf58a2d13e1694.tar.gz
Tango-c9d3c1a7408f6f7a4814c1a8f5cf58a2d13e1694.zip
Machine Studio.
Implemented upload hardware configuration from connected machine view. Implemented process parameters dragging through developer module settings :/
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs17
-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.cs27
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml12
4 files changed, 64 insertions, 11 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
index 10b05bc64..777c488d7 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
@@ -24,6 +24,7 @@ namespace Tango.MachineStudio.UI.Console
private INotificationProvider _notificatrion;
private TextBox _txtLog;
private String _currentFile;
+ private ScriptEngine _engine;
/// <summary>
@@ -160,22 +161,24 @@ namespace Tango.MachineStudio.UI.Console
private void Stop()
{
-
+ if (_engine != null)
+ {
+ _engine.Stop();
+ }
}
private async void Run()
{
- ScriptEngine engine = new ScriptEngine(new ConsoleOnExecuteParameters(new ConsoleManager(WriteLine)));
- engine.Stop();
- engine.ReferencedAssemblies.Add(this.GetType());
- engine.ReferencedAssemblies.Add(typeof(INotificationProvider));
+ _engine = new ScriptEngine(new ConsoleOnExecuteParameters(new ConsoleManager(WriteLine)));
+ _engine.ReferencedAssemblies.Add(this.GetType());
+ _engine.ReferencedAssemblies.Add(typeof(INotificationProvider));
foreach (var module in _moduleLoader.AllModules)
{
- engine.ReferencedAssemblies.Add(module.GetType());
+ _engine.ReferencedAssemblies.Add(module.GetType());
}
- await engine.Run(Code, null);
+ await _engine.Run(Code, null);
}
private void WriteLine(String text)
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..45ae68cc5 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -502,9 +502,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);
+ }
+ }
+ }
+ }
});
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml
index 45f1c9b26..a4f253de3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml
@@ -40,7 +40,7 @@
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
-
+
<TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock>
</StackPanel>
</Grid>
@@ -116,7 +116,15 @@
</Grid>
<Grid Grid.Row="1">
- <Button HorizontalAlignment="Right" Width="140" Command="{Binding DisconnectCommand}">DISCONNECT</Button>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="40" VerticalAlignment="Bottom">
+ <Button Height="Auto" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center">UPLOAD HW CONFIG</TextBlock>
+ <materialDesign:PackIcon Margin="10 0 0 0" Width="16" Height="16" VerticalAlignment="Center" Kind="ArrowRightBold"/>
+ </StackPanel>
+ </Button>
+ <Button Height="Auto" Width="140" Command="{Binding DisconnectCommand}" Margin="10 0 0 0">DISCONNECT</Button>
+ </StackPanel>
</Grid>
</Grid>
</Grid>