From 9c858b7b51be2eb5b2f515912d436224d7e6483c Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 29 Sep 2025 05:46:38 +0300 Subject: Process Parameters Visual Representation. Filter RML by machine type on Research module. --- .../ViewModels/AddLiquidFactorViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 18 +++++ .../Views/ProcessParametersView.xaml | 77 +++++++++++++++++----- .../Views/ProcessParametersView.xaml.cs | 21 ++++++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 9 +-- 5 files changed, 105 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs index f6fca0ac2..7b6b0b692 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs @@ -43,7 +43,7 @@ namespace Tango.MachineStudio.RML.ViewModels public async override void OnShow() { base.OnShow(); - LiquidTypes = (await _context.LiquidTypes.ToListAsync()).ToObservableCollection(); + LiquidTypes = (await _context.LiquidTypes.ToListAsync()).OrderBy(x => x.PreferredIndex).ToObservableCollection(); SelectedLiquidType = LiquidTypes.FirstOrDefault(); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 1da3723d1..2fcb87c59 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -29,6 +29,7 @@ using Google.Protobuf; using Tango.ColorConversion; using Tango.CSV; using Tango.Core; +using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.RML.ViewModels { @@ -282,6 +283,8 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand RemoveProcessParametersTableCommand { get; set; } + public RelayCommand CopyProcessParametersTableCommand { get; set; } + public RelayCommand AddLiquidFactorCommand { get; set; } public RelayCommand RemoveLiquidFactorCommand { get; set; } @@ -329,6 +332,7 @@ namespace Tango.MachineStudio.RML.ViewModels BackToRmlsCommand = new RelayCommand(BackToRmls, () => IsFree); AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable, () => IsFree); RemoveProcessParametersTableCommand = new RelayCommand(RemoveProcessParametersTable, () => IsFree); + CopyProcessParametersTableCommand = new RelayCommand(CopyProcessParametersTable, () => IsFree); AddLiquidFactorCommand = new RelayCommand(AddLiquidFactor, () => IsFree); RemoveLiquidFactorCommand = new RelayCommand(RemoveLiquidFactor, () => IsFree); CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate); @@ -481,6 +485,8 @@ namespace Tango.MachineStudio.RML.ViewModels { IsFree = false; + UIHelper.DoEvents(); + if (_active_context != null) { _active_context.Dispose(); @@ -1045,6 +1051,18 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private void CopyProcessParametersTable(ProcessParametersTable processParametersTable) + { + var nextTable = ActiveProcessParametersGroup.ProcessParametersTables.FirstOrDefault(x => x.TableIndex == processParametersTable.TableIndex + 1); + if (nextTable != null) + { + for (int i = 0; i < processParametersTable.VisualParameters.Count; i++) + { + nextTable.VisualParameters[i].Value = processParametersTable.VisualParameters[i].Value; + } + } + } + private void CreateCalibrationDataExcelTemplate() { SaveFileDialog dlg = new SaveFileDialog(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml index 03bf65522..b9e9f30c3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml @@ -11,6 +11,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" @@ -19,6 +20,8 @@ + + @@ -49,9 +52,27 @@ - + + + + + + + + + + @@ -59,22 +80,44 @@ - - - - - - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs index a6d03ca0e..29da7b293 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs @@ -23,6 +23,8 @@ namespace Tango.MachineStudio.RML.Views /// public partial class ProcessParametersView : UserControl { + private HashSet _processTablesViewers; + private MainViewVM _vm; public DraggingSurface DraggingSurface { @@ -46,6 +48,7 @@ namespace Tango.MachineStudio.RML.Views public ProcessParametersView() { InitializeComponent(); + _processTablesViewers = new HashSet(); DraggingSurface = draggingSurface; Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; } @@ -55,5 +58,23 @@ namespace Tango.MachineStudio.RML.Views ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; _vm.OnProcessParametersTableDropped(dragged, dropped); } + + private void ScrollViewer_Loaded(object sender, RoutedEventArgs e) + { + var viewer = sender as ScrollViewer; + if (!_processTablesViewers.Contains(viewer)) + { + viewer.ScrollChanged += Viewer_ScrollChanged; + _processTablesViewers.Add(viewer); + } + } + + private void Viewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + foreach (var viewer in _processTablesViewers.Where(x => x.IsLoaded && x.IsVisible && x != sender).ToList()) + { + viewer.ScrollToVerticalOffset(e.VerticalOffset); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index eee16a2df..ff341f5ed 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -6,6 +6,7 @@ xmlns:global="clr-namespace:Tango.MachineStudio.RML" xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" @@ -102,14 +103,14 @@ - - + + - + @@ -162,7 +163,7 @@ --> - + -- cgit v1.3.1