diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-15 15:10:08 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-15 15:10:08 +0300 |
| commit | b90acacb7dbef7d088d57a200cc4d71148bffd1e (patch) | |
| tree | ca3ae211da23ac1352d1aaa4d43b7947eddee916 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | de5700549a5fe01862f71d452f2abe4a74996605 (diff) | |
| download | Tango-b90acacb7dbef7d088d57a200cc4d71148bffd1e.tar.gz Tango-b90acacb7dbef7d088d57a200cc4d71148bffd1e.zip | |
Implemented custom min max on single and multiple graphs on tech board.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
6 files changed, 126 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml index bae36e665..a1197b9d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml @@ -30,7 +30,20 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphMultiControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <controls:RealTimeGraphMultiControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}"> + <controls:RealTimeGraphMultiControl.Style> + <Style TargetType="controls:RealTimeGraphMultiControl"> + <Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter> + <Setter Property="Maximum" Value="{Binding TechMonitor.Max}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding UseMinMax}" Value="True"> + <Setter Property="Minimum" Value="{Binding Min}"></Setter> + <Setter Property="Maximum" Value="{Binding Max}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:RealTimeGraphMultiControl.Style> + </controls:RealTimeGraphMultiControl> <!--</Viewbox>--> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml index fc7b02870..c9e4c244b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -30,7 +30,20 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=OneWay}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=OneWay}" SensorUnits="{Binding TechMonitor.Units}"> + <controls:RealTimeGraphControl.Style> + <Style TargetType="controls:RealTimeGraphControl"> + <Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter> + <Setter Property="Maximum" Value="{Binding TechMonitor.Max}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding UseMinMax}" Value="True"> + <Setter Property="Minimum" Value="{Binding Min}"></Setter> + <Setter Property="Maximum" Value="{Binding Max}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:RealTimeGraphControl.Style> + </controls:RealTimeGraphControl> <!--</Viewbox>--> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml index 8602b4a1d..6583e96e8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:MonitorsToMultiChannleMonitorsConverter x:Key="MonitorsToMultiChannleMonitorsConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> @@ -28,6 +30,22 @@ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechMonitors,Converter={StaticResource MonitorsToMultiChannleMonitorsConverter}}" SelectedItem="{Binding TechMonitor,Mode=TwoWay}" DisplayMemberPath="Description" /> </StackPanel> </GroupBox> + + <GroupBox Header="RANGE" Margin="0 10 0 0"> + <StackPanel Margin="0 10"> + <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}"> + <StackPanel Margin="0 0 5 0"> + <TextBlock>Minimum</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Min}"></mahapps:NumericUpDown> + </StackPanel> + <StackPanel Margin="5 0 0 0"> + <TextBlock>Maximum</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Max}"></mahapps:NumericUpDown> + </StackPanel> + </UniformGrid> + <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default</CheckBox> + </StackPanel> + </GroupBox> </StackPanel> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml index 4546c0a75..9e78eae0d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml @@ -6,6 +6,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" mc:Ignorable="d" @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> @@ -29,6 +31,22 @@ </StackPanel> </GroupBox> + <GroupBox Header="RANGE" Margin="0 10 0 0"> + <StackPanel Margin="0 10"> + <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}"> + <StackPanel Margin="0 0 5 0"> + <TextBlock>Minimum</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Min}"></mahapps:NumericUpDown> + </StackPanel> + <StackPanel Margin="5 0 0 0"> + <TextBlock>Maximum</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Max}"></mahapps:NumericUpDown> + </StackPanel> + </UniformGrid> + <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default</CheckBox> + </StackPanel> + </GroupBox> + <GroupBox Margin="0 10 0 0" Header="COLOR"> <StackPanel> <Viewbox Margin="0 5 0 0"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index bd165623a..029580a10 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -51,11 +51,42 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public MultiGraphElementEditor Editor { get; set; } + private double _min; + /// <summary> + /// Gets or sets the minimum graph value. + /// </summary> + public double Min + { + get { return _min; } + set { _min = value; RaisePropertyChangedAuto(); } + } + + private double _max; + /// <summary> + /// Gets or sets the maximum graph value. + /// </summary> + public double Max + { + get { return _max; } + set { _max = value; RaisePropertyChangedAuto(); } + } + + private bool _useMinMax; + /// <summary> + /// Gets or sets a value indicating whether [use minimum maximum]. + /// </summary> + public bool UseMinMax + { + get { return _useMinMax; } + set { _useMinMax = value; RaisePropertyChangedAuto(); } + } + /// <summary> /// Initializes a new instance of the <see cref="MultiGraphItem"/> class. /// </summary> public MultiGraphItem() : base() { + Max = 100; Name = "Multi Channel Graph"; Description = "Multi channel real-time graph"; Image = ResourceHelper.GetImageFromResources("Images/multi-graph.png"); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 19cbab426..148368881 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -51,11 +51,42 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public SingleGraphElementEditor Editor { get; set; } + private double _min; + /// <summary> + /// Gets or sets the minimum graph value. + /// </summary> + public double Min + { + get { return _min; } + set { _min = value; RaisePropertyChangedAuto(); } + } + + private double _max; + /// <summary> + /// Gets or sets the maximum graph value. + /// </summary> + public double Max + { + get { return _max; } + set { _max = value; RaisePropertyChangedAuto(); } + } + + private bool _useMinMax; + /// <summary> + /// Gets or sets a value indicating whether [use minimum maximum]. + /// </summary> + public bool UseMinMax + { + get { return _useMinMax; } + set { _useMinMax = value; RaisePropertyChangedAuto(); } + } + /// <summary> /// Initializes a new instance of the <see cref="SingleGraphItem"/> class. /// </summary> public SingleGraphItem() : base() { + Max = 100; Name = "Single Channel Graph"; Description = "Single channel real-time graph"; Image = ResourceHelper.GetImageFromResources("Images/single-graph.png"); |
