diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-08-02 15:44:56 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-08-02 15:44:56 +0300 |
| commit | da1c997c138633c46daa8dc3c099b7164a536eb9 (patch) | |
| tree | b04bf3110ae27ebbea1b7aafe9d2efeec45fccff /Software/Visual_Studio/PPC/Tango.PPC.UI/Controls | |
| parent | 027f92e62bf5c3d018b6d789b54c5ce78af2b03b (diff) | |
| download | Tango-da1c997c138633c46daa8dc3c099b7164a536eb9.tar.gz Tango-da1c997c138633c46daa8dc3c099b7164a536eb9.zip | |
Job Running Progress - added inter segments to logic.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml | 72 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs | 54 |
2 files changed, 94 insertions, 32 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml index 4c39bded0..dfbd47514 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -12,6 +12,7 @@ d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}"> <UserControl.Resources> <converters:DoubleWidthConverter x:Key="DoubleWidthConverter" /> + <converters:ProgressBorderWidthConverter x:Key="ProgressBorderWidthConverter" /> </UserControl.Resources> <Grid> <touch:SliderContentControl x:Name="slider_control" ThumbColor="{StaticResource TangoPrimaryAccentColor}" @@ -37,28 +38,59 @@ </Border.Clip> <Grid> <Canvas x:Name="ColorCanvas" Width="{Binding ElementName=slider_control, Path=ActualWidth}" Height="{Binding ElementName=slider_control, Path=ActualHeight}" ClipToBounds="True" > - <Border x:Name="ItemsBorder" ClipToBounds="False" Margin="0 0 0 0" Height="{Binding ElementName=slider_control, Path=ActualHeight}" Width="{Binding ElementName=brush_border, Path=ActualWidth, Converter={StaticResource DoubleWidthConverter}}" > - <ItemsControl x:Name="SegmentsItemsControl" ClipToBounds="False" > - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> + <Border x:Name="ItemsBorder" ClipToBounds="False" Margin="0 0 0 0" Height="{Binding ElementName=slider_control, Path=ActualHeight}" > + <Grid ClipToBounds="False" HorizontalAlignment="Stretch" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> <Grid> - <Grid.Width> - <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress" Converter="{StaticResource DoubleWidthConverter}"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="LengthWithFactor"></Binding> - </MultiBinding> - </Grid.Width> - <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + <ItemsControl HorizontalAlignment="Left" x:Name="SegmentsItemsControl" Width="{Binding ElementName=brush_border, Path=ActualWidth, Converter={StaticResource DoubleWidthConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=local:RunningJobViewerEureka}" Path="JobUnitLength" Converter="{StaticResource DoubleWidthConverter}"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <Grid Grid.Column="1"> + <ItemsControl x:Name="LastSegmentsItemsControl" HorizontalAlignment="Right" Margin="0 0 0 0" Width="{Binding ElementName=brush_border, Path=ActualWidth}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress" ></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> + </Grid> </Border> </Canvas> <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="7" RadiusY="7" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index 95fe5cd10..c87c50db2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -17,6 +17,7 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Tango.BL.Entities; using Tango.Integration.Operation; +using Tango.Logging; namespace Tango.PPC.UI.Controls { @@ -26,9 +27,9 @@ namespace Tango.PPC.UI.Controls public partial class RunningJobViewerEureka : UserControl { List<Segment> _segments; + List<Segment> _lastsegments; + - - private double _prevOffset; private double _addOffset; private int _prevUnit; @@ -80,27 +81,36 @@ namespace Tango.PPC.UI.Controls { if(Job != null) { + JobUnitLength = Job.Length; _segments = Job.EffectiveSegments.ToList(); if (Job.NumberOfUnits > 1 && _segments.Count > 0 && (_segments.Count > 1 || _segments[0].BrushStops.Count > 1)) { - //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) - //{ - // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); - //} + if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + } _segments.AddRange(Job.EffectiveSegments.ToList()); - //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) - //{ - // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); - //}//without check if last segment and last unit + if(Job.NumberOfUnits > 2 && Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + JobUnitLength += Job.InterSegmentLength; + //_segments.AddRange(Job.EffectiveSegments.ToList());//third set to use in end printing without intersegment + } + _lastsegments = Job.EffectiveSegments.ToList();; + IsHasMultipleColorsSegments = true; } else + { IsHasMultipleColorsSegments = false; + } SegmentsItemsControl.ItemsSource = _segments; SegmentsItemsControl.InvalidateVisual(); + LastSegmentsItemsControl.ItemsSource = _lastsegments; + LastSegmentsItemsControl.InvalidateVisual(); _prevOffset = _addOffset = 0.0; _prevUnit = 0; @@ -188,6 +198,20 @@ namespace Tango.PPC.UI.Controls DependencyProperty.Register("IsHasMultipleColorsSegments", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(false)); + + public double JobUnitLength + { + get { return (double)GetValue(JobUnitLengthProperty); } + set { SetValue(JobUnitLengthProperty, value); } + } + + // Using a DependencyProperty as the backing store for JobUnitLength. This enables animation, styling, binding, etc... + public static readonly DependencyProperty JobUnitLengthProperty = + DependencyProperty.Register("JobUnitLength", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + + + + /// <summary> /// Initializes a new instance of the <see cref="RunningJobViewerEureka"/> class. /// </summary> @@ -228,14 +252,20 @@ namespace Tango.PPC.UI.Controls if(_prevUnit < currentUnit) { _addOffset = _prevOffset; + //Debug.WriteLine($"OnSliderValueChanged prevOffset: '{_prevOffset}' currentUnit = {currentUnit}, total:{total}"); } offset += _addOffset; - if (offset >= ControlWidth) + if (offset >= ControlWidth && currentUnit < (Job.NumberOfUnits - 2)) { - offset -= ControlWidth;//round + offset -= ControlWidth;//round + //Debug.WriteLine($"OnSliderValueChanged round!!! offset: '{offset}' currentUnit = {currentUnit}, total:{total}"); } + //if(currentUnit == (Job.NumberOfUnits - 1)) + //{ + // Debug.WriteLine($"OnSliderValueChanged offset: '{offset}' currentUnit = {currentUnit}. ControlWidth = {ControlWidth} total:{total}"); + //} _prevOffset = offset; _prevUnit = currentUnit; |
