From da1c997c138633c46daa8dc3c099b7164a536eb9 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 2 Aug 2023 15:44:56 +0300 Subject: Job Running Progress - added inter segments to logic. --- .../Controls/RunningJobViewerEureka.xaml | 72 ++++++++++++++++------ .../Controls/RunningJobViewerEureka.xaml.cs | 54 ++++++++++++---- 2 files changed, 94 insertions(+), 32 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Controls') 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}"> + - - - - - - - - - + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + 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 _segments; + List _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)); + + + + /// /// Initializes a new instance of the class. /// @@ -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; -- cgit v1.3.1