From c6b01f3e683b83fb0d6bf080efbd24a9a732b9f5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 15 Jul 2018 13:22:53 +0300 Subject: Implemented process parameters item on machine studio tech board. --- .../ViewModels/MachineTechViewVM.cs | 46 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 381101c7e..41fff94d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -52,7 +52,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private DateTime _lastDiagnosticsResponseUpdate; private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; private TechnicianModuleSettings _settings; - + #region Properties @@ -535,6 +535,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(bounds, Adapter.HardwareSpeedSensorTypes.FirstOrDefault()); } + else if (item is ProcessParametersItem) + { + var editor = CreateElement(bounds, null); + InitProcessParameterItem(editor.ProcessParametersItem); + } } /// @@ -654,6 +659,11 @@ namespace Tango.MachineStudio.Technician.ViewModels (item as SpeedSensorItem).HardwareSpeedSensorType = Adapter.HardwareSpeedSensorTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); CreateElement(item); } + else if (item is ProcessParametersItem) + { + var editor = CreateElement(item); + InitProcessParameterItem(editor.ProcessParametersItem); + } } /// @@ -1138,6 +1148,40 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the process parameter item. + /// + /// The item. + private void InitProcessParameterItem(ProcessParametersItem item) + { + item.PushParametersPressed += async (x, parameters) => + { + try + { + CheckMachineOperator(); + + using (_notification.PushTaskItem("Uploading process parameters...")) + { + try + { + await MachineOperator.UploadProcessParameters(parameters); + } + catch (Exception ex) + { + String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString(); + _eventLogger.Log(ex,msg); + LogManager.Log(ex, msg); + _notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message); + } + } + } + catch (Exception ex) + { + _notification.ShowError(ex.Message); + } + }; + } + /// /// Checks the machine operator. /// -- cgit v1.3.1 From b8566b704e0804239bcb58dfb90b32e5334ce446 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 15 Jul 2018 17:58:46 +0300 Subject: Implemented JobRunner on Tech Board !. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes Software/Graphics/rgb-big.png | Bin 0 -> 2649 bytes .../Converters/JobProgressToPositionConverter.cs | 3 +- .../Editors/JobRunnerElementEditor.xaml | 280 +++++++++++++++++++++ .../Editors/JobRunnerElementEditor.xaml.cs | 103 ++++++++ .../Editors/ProcessParametersElementEditor.xaml | 2 +- .../Images/rgb-big.png | Bin 0 -> 2649 bytes .../PropertiesTemplates/JobRunnerTemplate.xaml | 78 ++++++ .../PropertiesTemplates/JobRunnerTemplate.xaml.cs | 28 +++ .../Tango.MachineStudio.Technician.csproj | 18 ++ .../TechItems/JobRunnerItem.cs | 188 ++++++++++++++ .../TechItems/ProcessParametersItem.cs | 25 +- .../TechItems/TechItem.cs | 1 + .../ViewModels/MachineTechViewVM.cs | 53 ++++ .../Views/MachineTechView.xaml | 3 + .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Tango.BL/EntitiesExtensions/Job.cs | 1 + .../Tango.Integration/Operation/JobHandler.cs | 1 + .../Tango.Integration/Operation/MachineOperator.cs | 5 + 20 files changed, 777 insertions(+), 14 deletions(-) create mode 100644 Software/Graphics/rgb-big.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/rgb-big.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index cc6bc537c..25bb64505 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 86c960e43..ff30c99cf 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/rgb-big.png b/Software/Graphics/rgb-big.png new file mode 100644 index 000000000..cee14ae53 Binary files /dev/null and b/Software/Graphics/rgb-big.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs index 4212c6908..93ede05c3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using System.Windows.Data; using Tango.BL.Entities; @@ -15,7 +16,7 @@ namespace Tango.MachineStudio.Developer.Converters { try { - if (values.Length == 3) + if (values.Length == 3 && values[1] != DependencyProperty.UnsetValue) { double length = System.Convert.ToDouble(values[0]); double progress = System.Convert.ToDouble(values[1]); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml new file mode 100644 index 000000000..c481f1e1b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml @@ -0,0 +1,280 @@ + + + + + + + + + + + Transparent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + m + + | + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml.cs new file mode 100644 index 000000000..1daf2f6ca --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class JobRunnerElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public JobRunnerElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public JobRunnerElementEditor(JobRunnerItem jobRunnerItem) + : this() + { + JobRunnerItem = jobRunnerItem; + DataContext = JobRunnerItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public JobRunnerElementEditor(JobRunnerItem jobRunnerItem, Rect bounds) + : this(jobRunnerItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private JobRunnerItem _jobRunnerItem; + + public JobRunnerItem JobRunnerItem + { + get { return _jobRunnerItem; } + set { _jobRunnerItem = value; RaisePropertyChanged(nameof(JobRunnerItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = JobRunnerItem.Clone() as JobRunnerItem; + JobRunnerElementEditor cloned = new JobRunnerElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return JobRunnerItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml index c1a76fe8a..716ac0a2d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml @@ -38,7 +38,7 @@ - +