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/Controls | |
| 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/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml | 136 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs | 72 |
2 files changed, 109 insertions, 99 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; + } } } |
