aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-29 05:46:38 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-29 05:46:38 +0300
commit9c858b7b51be2eb5b2f515912d436224d7e6483c (patch)
tree46f854bfd37026967ef2dfa8f28a70cd8c8f7727 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views
parent103bd3c1c825e4ecbb1c714e293a5c9d97a09c8c (diff)
downloadTango-9c858b7b51be2eb5b2f515912d436224d7e6483c.tar.gz
Tango-9c858b7b51be2eb5b2f515912d436224d7e6483c.zip
Process Parameters Visual Representation.
Filter RML by machine type on Research module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml77
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml9
3 files changed, 86 insertions, 21 deletions
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 @@
<UserControl.Resources>
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
+ <converters:LastItemInContainerToBooleanConverter x:Key="LastItemInContainerToBooleanConverter" />
+ <commonConverters:ProcessParameterToVisibilityConverter x:Key="ProcessParameterToVisibilityConverter"></commonConverters:ProcessParameterToVisibilityConverter>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -49,9 +52,27 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel>
- <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}">
- <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" />
- </Button>
+ <StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom">
+ <Grid>
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter},Converter={StaticResource LastItemInContainerToBooleanConverter}}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Copy table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyProcessParametersTableCommand}" CommandParameter="{Binding}">
+ <materialDesign:PackIcon Kind="ChevronDoubleRight" Width="24" Height="24" Foreground="{StaticResource GreenBrush}" />
+ </Button>
+ </Grid>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}">
+ <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" />
+ </Button>
+ </StackPanel>
+
<Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped">
<Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush100}">
@@ -59,22 +80,44 @@
<DockPanel Width="300">
<TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5">
- <editors:ParameterizedEditor ParameterizedObject="{Binding}">
- <editors:ParameterizedEditor.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel IsItemsHost="True" />
- </ItemsPanelTemplate>
- </editors:ParameterizedEditor.ItemsPanel>
- <editors:ParameterizedEditor.DoubleTemplate>
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5" Loaded="ScrollViewer_Loaded">
+ <ItemsControl ItemsSource="{Binding ParametersGroups}">
+ <ItemsControl.ItemTemplate>
<DataTemplate>
- <DockPanel>
- <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11"></TextBlock>
- <mahapps:NumericUpDown HorizontalAlignment="Right" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Right" Maximum="10000" StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown>
- </DockPanel>
+ <StackPanel>
+ <TextBlock Margin="0 10 0 0" Text="{Binding Name}" FontWeight="SemiBold" FontSize="10" Foreground="{StaticResource AccentColorBrush}"></TextBlock>
+ <ItemsControl ItemsSource="{Binding Parameters}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <DockPanel>
+ <DockPanel.Visibility>
+ <MultiBinding Converter="{StaticResource ProcessParameterToVisibilityConverter}">
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveRML.ForMachineType" />
+ <Binding Path="MachineTypes" />
+ </MultiBinding>
+ </DockPanel.Visibility>
+ <TextBlock VerticalAlignment="Center" Text="{Binding Name}"></TextBlock>
+ <mahapps:NumericUpDown StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalAlignment="Right" Width="80" Minimum="0" Maximum="10000" Value="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
+ <mahapps:NumericUpDown.Style>
+ <Style TargetType="mahapps:NumericUpDown" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}">
+ <Setter Property="FontWeight" Value="Normal"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HasDiff}" Value="True">
+ <Setter Property="FontWeight" Value="Bold"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </mahapps:NumericUpDown.Style>
+ </mahapps:NumericUpDown>
+ </DockPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
</DataTemplate>
- </editors:ParameterizedEditor.DoubleTemplate>
- </editors:ParameterizedEditor>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+
</ScrollViewer>
</DockPanel>
</Grid>
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
/// </summary>
public partial class ProcessParametersView : UserControl
{
+ private HashSet<ScrollViewer> _processTablesViewers;
+
private MainViewVM _vm;
public DraggingSurface DraggingSurface
{
@@ -46,6 +48,7 @@ namespace Tango.MachineStudio.RML.Views
public ProcessParametersView()
{
InitializeComponent();
+ _processTablesViewers = new HashSet<ScrollViewer>();
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 @@
</StackPanel>
</Grid>
<Grid>
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled" EnableRowVirtualization="False">
- <DataGrid.CellStyle>
+ <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding ManageRmlCommand}" Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled" EnableRowVirtualization="False">
+ <controls:DoubleClickDataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
</Style>
- </DataGrid.CellStyle>
+ </controls:DoubleClickDataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="NAME" Width="220">
<DataGridTemplateColumn.CellTemplate>
@@ -162,7 +163,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
- </DataGrid>
+ </controls:DoubleClickDataGrid>
<Grid Background="#19000000" Visibility="{Binding LoadingRmls,Converter={StaticResource BooleanToVisibilityConverter}}">
<mahapps:ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height="100"></mahapps:ProgressRing>