diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-20 12:34:34 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-20 12:34:34 +0200 |
| commit | f70d2639099282432295c0949fe6da2c8dd4bb46 (patch) | |
| tree | 6c63696d5e225b06344b3246072dedd905dc70f8 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician | |
| parent | dd4b13d161d64b0e85b8bd5b55e6fd3a71952512 (diff) | |
| download | Tango-f70d2639099282432295c0949fe6da2c8dd4bb46.tar.gz Tango-f70d2639099282432295c0949fe6da2c8dd4bb46.zip | |
Improved Tech Single Value Controller!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician')
3 files changed, 67 insertions, 26 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml index 60b96bc9d..5cffffc90 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml @@ -30,12 +30,13 @@ <!--Content--> <Grid ClipToBounds="False" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> <Border> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*" /> - <ColumnDefinition Width="100" /> - </Grid.ColumnDefinitions> - <Viewbox> + <Viewbox> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*" /> + <ColumnDefinition Width="100" /> + </Grid.ColumnDefinitions> + <Grid> <gauge:CircularGaugeControl Margin="10" @@ -45,8 +46,8 @@ ScaleSweepAngle="300" PointerLength="85" PointerCapRadius="35" - MinValue="{Binding TechController.Min}" - MaxValue="{Binding TechController.Max}" + MinValue="{Binding TechController.Min,FallbackValue=0}" + MaxValue="{Binding TechController.Max,FallbackValue=100}" MajorDivisionsCount="10" MinorDivisionsCount="5" CurrentValue="{Binding EffectiveValue}" @@ -57,7 +58,7 @@ RangeIndicatorLightOffset="80" ScaleLabelRadius="90" ScaleLabelSize="40,20" - ScaleLabelFontSize="10" + ScaleLabelFontSize="16" ScaleLabelForeground="LightGray" MajorTickSize="10,3" MinorTickSize="3,1" @@ -66,30 +67,29 @@ ImageOffset="-50" GaugeBackgroundColor="Black" PointerThickness ="16" - OptimalRangeStartValue="300" - OptimalRangeEndValue="700" + OptimalRangeStartValue="{Binding OptimalRangeMinimum,FallbackValue=0}" + OptimalRangeEndValue="{Binding OptimalRangeMaximum,FallbackValue=100}" DialTextOffset="40" DialTextColor="Black" > </gauge:CircularGaugeControl> </Grid> - </Viewbox> - <Grid Grid.Column="1" HorizontalAlignment="Right"> - <Slider Orientation="Vertical" Margin="15" TickPlacement="None" Minimum="{Binding TechController.Min}" Maximum="{Binding TechController.Max}" Value="{Binding Value,Delay=1000}"> - <Slider.Foreground> - <SolidColorBrush Color="{Binding Color}" /> - </Slider.Foreground> - </Slider> - <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="../Fonts/#digital-7" TextAlignment="Right" Margin="-80 10 0 0" FontSize="30" Text="{Binding Value,StringFormat=0.00}"> - <TextBlock.Foreground> - <SolidColorBrush Color="{Binding Color}" /> - </TextBlock.Foreground> - </TextBlock> + <Grid Grid.Column="1" HorizontalAlignment="Right"> + <visuals:Fader x:Name="fader" FaderLightBrush="DodgerBlue" Margin="10" Minimum="{Binding TechController.Min}" Maximum="{Binding TechController.Max}" Value="{Binding Value,Delay=500}"> + + </visuals:Fader> + + <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="../Fonts/#digital-7" TextAlignment="Right" Margin="-50 10 0 0" FontSize="30" Text="{Binding ElementName=fader,Path=Value,StringFormat=0.0,FallbackValue=100}"> + <TextBlock.Foreground> + <SolidColorBrush Color="{Binding Color,FallbackValue=White}" /> + </TextBlock.Foreground> + </TextBlock> + </Grid> </Grid> - </Grid> + </Viewbox> </Border> <Border Margin="0 0 0 -23" VerticalAlignment="Bottom"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml index 57d807b09..ffc726abf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml @@ -34,6 +34,9 @@ <Viewbox Margin="0 5 0 0"> <colorPicker:ColorCanvas SelectedColor="{Binding Color,Mode=TwoWay}" Background="Transparent" /> </Viewbox> + + <TextBlock FontSize="10" Margin="0 20 0 0"><Run>Optimal Range:</Run> <Run Text="{Binding OptimalRangeMinimum,StringFormat=0.0}"></Run><Run> to </Run><Run Text="{Binding OptimalRangeMaximum,StringFormat=0.0}"></Run></TextBlock> + <mahapps:RangeSlider Margin="0 5 0 0" Minimum="{Binding TechController.Min}" Maximum="{Binding TechController.Max}" LowerValue="{Binding OptimalRangeMinimum}" UpperValue="{Binding OptimalRangeMaximum}"></mahapps:RangeSlider> </StackPanel> </GroupBox> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs index 67266ee66..8a9cba883 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs @@ -30,7 +30,19 @@ namespace Tango.MachineStudio.Technician.TechItems public TechController TechController { get { return _techController; } - set { _techController = value; RaisePropertyChangedAuto(); TechName = _techController != null ? _techController.Description : null; ItemGuid = value != null ? value.Guid : null; } + set + { + _techController = value; + RaisePropertyChangedAuto(); + TechName = _techController != null ? _techController.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_techController != null && !IsSetToDefault) + { + OptimalRangeMinimum = _techController.Min; + OptimalRangeMaximum = _techController.Min + ((_techController.Max - _techController.Min) * 0.7d); + IsSetToDefault = true; + } + } } private double _value; @@ -64,7 +76,6 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public DateTime LastUpdateTime { get; set; } - private double _effectiveValue; /// <summary> /// Gets or sets the effective value received from the embedded device. @@ -85,6 +96,29 @@ namespace Tango.MachineStudio.Technician.TechItems } } + private double _optimalRangeMinimum; + /// <summary> + /// Gets or sets the optimal range. + /// </summary> + public double OptimalRangeMinimum + { + get { return _optimalRangeMinimum; } + set + { + _optimalRangeMinimum = value; + RaisePropertyChangedAuto(); + } + } + + private double _optimalRangeMaximum; + public double OptimalRangeMaximum + { + get { return _optimalRangeMaximum; } + set { _optimalRangeMaximum = value; RaisePropertyChangedAuto(); } + } + + public bool IsSetToDefault { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="ControllerItem"/> class. /// </summary> @@ -115,6 +149,10 @@ namespace Tango.MachineStudio.Technician.TechItems { ControllerItem cloned = base.Clone() as ControllerItem; cloned.TechController = TechController; + cloned.OptimalRangeMinimum = OptimalRangeMinimum; + cloned.OptimalRangeMaximum = OptimalRangeMaximum; + cloned.IsSetToDefault = IsSetToDefault; + return cloned; } } |
