diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-04 21:24:11 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-04 21:24:11 +0300 |
| commit | 525cb05b5ab2c7168599d01d298d187a763d6b3c (patch) | |
| tree | 8135e3f41a3a5a015dd15cb8d715a480f17a62fc /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 965fe4a83f0d5915a177ba902be2616b52f69887 (diff) | |
| download | Tango-525cb05b5ab2c7168599d01d298d187a763d6b3c.tar.gz Tango-525cb05b5ab2c7168599d01d298d187a763d6b3c.zip | |
New Job Running control.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
4 files changed, 163 insertions, 136 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 559266d28..39c032145 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -11,60 +11,20 @@ <UserControl.Resources> </UserControl.Resources> - <Grid> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="Auto"/> - </Grid.ColumnDefinitions> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="1*" /> - </Grid.RowDefinitions> - - <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></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> + <touch:SliderContentControl x:Name="slider_control" ThumbColor="{StaticResource TangoPrimaryAccentColor}" + Height="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=HeightSlider}" + ThumbHeight="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=ThumbHeight}" + Width="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=Width}" + + Minimum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MinimumValue}" + Maximum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MaximumValue}" + MouseDown="SliderContentControl_MouseDown" TouchDown="SliderContentControl_TouchDown"> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Visible"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> - </TextBlock> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0" Background="{StaticResource TangoLightForegroundBrush}"> - <!--<Border.Background> - <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> - </Border.Background>--> - <Border.Clip> - <RectangleGeometry RadiusX="10" RadiusY="10"> + <Border x:Name="brush_border" ClipToBounds="False" CornerRadius="7" Margin="0 0 0 0" Background="{StaticResource TangoLightForegroundBrush}"> + <Border.Clip> + <RectangleGeometry RadiusX="7" RadiusY="7"> <RectangleGeometry.Rect> <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> <Binding ElementName="brush_border" Path="ActualWidth" /> @@ -73,54 +33,32 @@ </RectangleGeometry.Rect> </RectangleGeometry> </Border.Clip> - <Grid> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></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> - - <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" /> - </Grid> - </Border> - </Grid> - - <!--<Grid Grid.Column="1" VerticalAlignment="Bottom"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> - <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=IsActive}" Value="False" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Grid.Style> + <Grid> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments, Delay=100}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></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> - <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> - <Run Text="x"></Run><Run Text="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=Job.NumberOfUnits}"></Run> - </TextBlock> - </Grid>--> - </Grid> + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="7" RadiusY="7" /> + </Grid> + </Border> + </touch:SliderContentControl> </Grid> </UserControl> 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 db6a8c178..29efaad72 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 @@ -66,6 +66,62 @@ namespace Tango.PPC.UI.Controls public static readonly DependencyProperty RunningJobStatusProperty = DependencyProperty.Register("RunningJobStatus", typeof(RunningJobStatus), typeof(RunningJobViewerEureka), new PropertyMetadata(null)); + public double MinimumValue + { + get { return (double)GetValue(MinimumValueProperty); } + set { SetValue(MinimumValueProperty, value); } + } + /// <summary> + /// The minimum value property + /// </summary> + public static readonly DependencyProperty MinimumValueProperty = + DependencyProperty.RegisterAttached("MinimumValue", typeof(double), typeof(RunningJobViewerEureka), + new FrameworkPropertyMetadata(0.0)); + public double MaximumValue + { + get { return (double)GetValue(MaximumValueProperty); } + set + { + SetValue(MaximumValueProperty, value); + } + } + /// <summary> + /// The maximum value property + /// </summary> + public static readonly DependencyProperty MaximumValueProperty = + DependencyProperty.RegisterAttached("MaximumValue", typeof(double), typeof(RunningJobViewerEureka), + new FrameworkPropertyMetadata(100.0, 0)); + + public double SliderValue + { + get { return (double)GetValue(SliderValueProperty); } + set { SetValue(SliderValueProperty, value); } + } + + // Using a DependencyProperty as the backing store for SliderValue. This enables animation, styling, binding, etc... + public static readonly DependencyProperty SliderValueProperty = + DependencyProperty.Register("SliderValue", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata((double)0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => (d as RunningJobViewerEureka).OnSliderValueChanged())); + + public double HeightSlider + { + get { return (double)GetValue(HeightSliderProperty); } + set { SetValue(HeightSliderProperty, value); } + } + + // Using a DependencyProperty as the backing store for HeightSlider. This enables animation, styling, binding, etc... + public static readonly DependencyProperty HeightSliderProperty = + DependencyProperty.Register("HeightSlider", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + + public double ThumbHeight + { + get { return (double)GetValue(ThumbHeightProperty); } + set { SetValue(ThumbHeightProperty, value); } + } + + // Using a DependencyProperty as the backing store for ThumbHeight. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ThumbHeightProperty = + DependencyProperty.Register("ThumbHeight", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + /// <summary> /// Initializes a new instance of the <see cref="RunningJobViewerEureka"/> class. /// </summary> @@ -73,5 +129,21 @@ namespace Tango.PPC.UI.Controls { InitializeComponent(); } + + private void SliderContentControl_MouseDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } + + private void SliderContentControl_TouchDown(object sender, TouchEventArgs e) + { + e.Handled = true; + } + + private void OnSliderValueChanged() + { + if(slider_control != null) + slider_control.Value = SliderValue; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 2a851e007..fba49ced3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -6,8 +6,10 @@ using System.Threading.Tasks; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.Integration.Operation; using Tango.PPC.Common; +using Tango.PPC.Common.Diagnostics; using Tango.PPC.Jobs; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; @@ -19,7 +21,11 @@ namespace Tango.PPC.UI.ViewModels { #region Properties - private JobHandler _handler; + [TangoInject] + public IDiagnosticsFrameProvider DefaultDiagnosticsFrameProvider { get; set; } + + + private JobHandler _handler; private Job _job; /// <summary> @@ -230,8 +236,15 @@ namespace Tango.PPC.UI.ViewModels { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + + //DefaultDiagnosticsFrameProvider.FrameReceived += DefaultDiagnosticsFrameProvider_FrameReceived; } - + + private void DefaultDiagnosticsFrameProvider_FrameReceived(object sender, PMR.Diagnostics.StartDiagnosticsResponse e) + { + var frame = e; + } + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { _handler = e.JobHandler; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 1e528765e..66bc6f580 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -593,19 +593,18 @@ <TextBlock Text="Total Job Progress" FontWeight="DemiBold" Margin="15 10 0 0" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalAlignment="Top"></TextBlock> <Rectangle Height="2" Fill="{StaticResource TangoLightBorderBrush}" Width="1010" VerticalAlignment="Top" Margin="15 20 0 0"></Rectangle> </StackPanel> - <Grid Margin="0 10 0 0"> - <locaControls:RunningJobViewerEureka Height="14" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> - - + <Grid Margin="0 22 0 0"> + <locaControls:RunningJobViewerEureka ThumbHeight="16" HeightSlider="14" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" + RunningJobStatus="{Binding RunningJobStatus}" + MaximumValue="{Binding RunningJobStatus.TotalProgressMinusSettingUp, FallbackValue=100,TargetNullValue=100}" + MinimumValue="0" + SliderValue="{Binding RunningJobStatus.ProgressMinusSettingUp, TargetNullValue=0, FallbackValue=0}"/> + + <!--<TextBlock Margin="0 0 -50 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Right"> <Run Text="x"></Run><Run Text="{Binding RunningJobStatus.RemainingUnits}"></Run> </TextBlock>--> - </Grid> - <touch:MultiRangeSlider x:Name="PART_LowerSlider" Height="30" Margin="0 0 0 0" Foreground="{StaticResource TangoDarkForegroundBrush}" - IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" Maximum="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" Minimum="0" IsEnabled="False" - MaximumValue ="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" - Value ="{Binding RunningJobStatus.ProgressMinusSettingUp}"/> - + </Grid> <UniformGrid DockPanel.Dock="Bottom" Columns="4" Rows="1" HorizontalAlignment="Left" Margin="0 10 0 0" Height="Auto" VerticalAlignment="Top" Width="840"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_length.png" Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left"/> @@ -810,10 +809,34 @@ <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="100"></RowDefinition> </Grid.RowDefinitions> - <Grid> - <DockPanel Margin="0 10 0 0"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" DockPanel.Dock="Right" Margin="0 0 0 0"> - <Image Source="../Images/Job Issues/ttime_left.png" Stretch="Fill" VerticalAlignment="Top" Height="32" Width="32"/> + <Grid Margin="0 10 0 0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="400"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" > + <Image Margin="0 2 0 0" Source="../Images/Job Issues/job_length.png" Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left" Width="Auto" Height="32" /> + <TextBlock Margin="20 10 0 0" Width="50" FontWeight="SemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}" > + <TextBlock.Text> + <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> + <Binding Path="Job.Spools" Mode="OneWay"/> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + </StackPanel> + <!--<Grid Grid.Column="1" Margin="20 8 20 0" VerticalAlignment="Top" Height="20">--> + <locaControls:RunningJobViewerEureka Grid.Column="1" Margin="20 12 20 0" VerticalAlignment="Top" ThumbHeight="16" Height="14" HeightSlider="14" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" + RunningJobStatus="{Binding RunningJobStatus}" + MaximumValue="{Binding RunningJobStatus.TotalProgressMinusSettingUp, FallbackValue=100,TargetNullValue=100}" + MinimumValue="0" + SliderValue="{Binding RunningJobStatus.ProgressMinusSettingUp, TargetNullValue=0, FallbackValue=0, Delay=100}"/> + + <!--</Grid>--> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.Column="2" Margin="0 0 0 0"> + <Image Margin="0 2 0 0" Source="../Images/Job Issues/ttime_left.png" Stretch="Uniform" VerticalAlignment="Top" Height="32"/> <TextBlock Margin="15 10 0 0" FontWeight="Light" FontSize="{StaticResource TangoComboBoxItemFontSize}" HorizontalAlignment="Center"> <Run Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run> <Run FontSize="16" Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run> @@ -835,27 +858,8 @@ </touch:TouchButton> </StackPanel> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" DockPanel.Dock="Left"> - <Image Source="../Images/Job Issues/job_length.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Left" Width="32" Height="32"/> - <TextBlock Margin="20 10 0 0" Width="50" FontWeight="SemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}" > - <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> - <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> - <Binding Path="Job.Spools" Mode="OneWay"/> - </MultiBinding> - </TextBlock.Text> - </TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="30 8 30 0" > - <locaControls:RunningJobViewerEureka Height="16" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> - - <touch:MultiRangeSlider x:Name="PART_LowerSlider1" Height="26" Margin="0 0 0 0" Foreground="{StaticResource TangoDarkForegroundBrush}" - IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" Maximum="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" Minimum="0" IsEnabled="False" - MaximumValue ="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" Value ="{Binding RunningJobStatus.ProgressMinusSettingUp}"/> - - </StackPanel> - </DockPanel> - <Border Height="2" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 2 0 0" CornerRadius="2"></Border> + + <Border Height="2" Grid.ColumnSpan="012" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 2 0 0" CornerRadius="2"></Border> </Grid> <Grid Grid.Row="1" Margin="0 28 0 0"> <StackPanel Orientation="Vertical"> |
