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 | |
| parent | 965fe4a83f0d5915a177ba902be2616b52f69887 (diff) | |
| download | Tango-525cb05b5ab2c7168599d01d298d187a763d6b3c.tar.gz Tango-525cb05b5ab2c7168599d01d298d187a763d6b3c.zip | |
New Job Running control.
Diffstat (limited to 'Software')
10 files changed, 399 insertions, 143 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index 5782d77a2..e52433cfb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -1350,13 +1350,13 @@ </Style> </touch:TouchIconButton.Style> </touch:TouchIconButton>--> - <touch:TouchTextBox Margin="20 0 40 0" MaxWidth="410" Text="{Binding JobModel.Name,FallbackValue='Job Name'}" ToolTip="{Binding JobModel.Name}" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold"></touch:TouchTextBox> - <touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" Width="50" Height="50" HorizontalAlignment="Left" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding EditJobDetailsCommand}" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" + <touch:TouchTextBox Margin="20 6 240 0" Text="{Binding JobModel.Name,FallbackValue='Job Name'}" ToolTip="{Binding JobModel.Name}" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold"></touch:TouchTextBox> + <!--<touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" Width="50" Height="50" HorizontalAlignment="Left" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding EditJobDetailsCommand}" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" components:TransformationHelper.TransformWhenPressed ="False"> <Border Height="24" Width="24" Margin="0 0 0 0" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center"> <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/job_details.png"/> </Border> - </touch:TouchButton> + </touch:TouchButton>--> </DockPanel> <Canvas ClipToBounds="False" HorizontalAlignment="Right" Width="200"> 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"> diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs index 25d7c7579..c7215ad99 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/WidthHeightToRectConverter.cs @@ -13,9 +13,16 @@ namespace Tango.SharedUI.Converters { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - double width = (double)values[0]; - double height = (double)values[1]; - return new Rect(new Size(width, height)); + try + { + double width = (double)values[0]; + double height = (double)values[1]; + return new Rect(new Size(width, height)); + } + catch( Exception ex) + { + return null; + } } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.cs new file mode 100644 index 000000000..a6b05f472 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Touch.Controls +{ + [ContentProperty(nameof(Content))] + public class SliderContentControl : Slider + { + private bool m_isBlocked; + + #region DependencyProperties + + public UIElement Content + { + get { return (UIElement)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register("Content", typeof(UIElement), typeof(SliderContentControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, (d, e) => (d as SliderContentControl).OnContentChanged())); + + public static readonly DependencyProperty ThumbHeightProperty = + DependencyProperty.Register("ThumbHeight", typeof(double), typeof(SliderContentControl), new FrameworkPropertyMetadata((double)32, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + + public double ThumbHeight + { + get { return (double)GetValue(ThumbHeightProperty); } + set { SetValue(ThumbHeightProperty, value); } + } + + public Color ThumbColor + { + get { return (Color)GetValue(ThumbColorProperty); } + set { SetValue(ThumbColorProperty, value); } + } + + + + /// <summary> + /// The thumb color property + /// </summary> + public static readonly DependencyProperty ThumbColorProperty = + DependencyProperty.Register("ThumbColor", typeof(Color), typeof(SliderContentControl), new UIPropertyMetadata(Colors.LightGray, null)); + + + + #endregion + + static SliderContentControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(SliderContentControl), new FrameworkPropertyMetadata(typeof(SliderContentControl))); + } + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + TouchDown -= TouchDownSlider; + TouchDown += TouchDownSlider; + OnValueChanged(Double.NaN, Value); + IsMoveToPointEnabled = true; + } + + private void TouchDownSlider(object sender, TouchEventArgs e) + { + e.Handled = true; + } + + private double ValidateValue(double value) + { + if (value >= Minimum && value <= Maximum) + return value; + if ((value) > Maximum) + return Maximum; + if ((value) < Minimum) + return Minimum; + return double.NaN; + } + + private void OnContentChanged() + { + RemoveLogicalChild(Content); + AddLogicalChild(Content); + } + + protected override void OnValueChanged(double oldValue, double newValue) + { + if (m_isBlocked) return; + + m_isBlocked = true; + + var validatedValue = ValidateValue(newValue); + + if (!double.IsNaN(validatedValue)) + { + Value = validatedValue; + + } + + m_isBlocked = false; + + + } + + protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) + { + e.Handled = true; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.xaml b/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.xaml new file mode 100644 index 000000000..9e2b85c60 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/SliderContentControl.xaml @@ -0,0 +1,92 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.Touch.Controls" + > + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <Style x:Key="RepeatButtonTransparent" TargetType="{x:Type RepeatButton}"> + <Setter Property="OverridesDefaultStyle" Value="true"/> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="Focusable" Value="false"/> + <Setter Property="IsTabStop" Value="false"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type RepeatButton}"> + <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ThumbSlider" Style.TargetType="{x:Type Thumb}" > + <Setter Setter.Property="SnapsToDevicePixels" Setter.Value="True" /> + <Setter Setter.Property="OverridesDefaultStyle" Setter.Value="True" /> + <Setter Setter.Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Thumb}"> + <Grid x:Name="grip" HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center"> + <Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" + Height="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" + Width="{Binding ThumbHeight, RelativeSource={RelativeSource AncestorType=local:SliderContentControl}}" > + <Ellipse.Fill> + <SolidColorBrush Color="{Binding ThumbColor, RelativeSource={RelativeSource AncestorType=local:SliderContentControl}}"/> + </Ellipse.Fill> + </Ellipse> + + <!--<Ellipse x:Name="knob" Grid.Column="0" Grid.Row="1" Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="0" Fill="{StaticResource TangoPrimaryAccentBrush}" Opacity="0.5"></Ellipse>--> + <Grid.Effect> + <DropShadowEffect BlurRadius="10" RenderingBias="Quality" ShadowDepth="1" Color="{StaticResource TangoDropShadowColor}"/> + </Grid.Effect> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type local:SliderContentControl}"> + <Setter Property="Background" Value="{StaticResource TangoNotificationBarMaskBrush}"/> + + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:SliderContentControl}"> + <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="6"> + <Grid> + <!--<ContentPresenter Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" />--> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border x:Name="PART_ColorPickerDisplay" Grid.Row="1" Background="Transparent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" + MinHeight="14" Margin="5 0 0 0" VerticalAlignment="center" CornerRadius="6" > + <ContentPresenter Panel.ZIndex="1" Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" /> + </Border> + + <Track Track.Name="PART_Track" Grid.Row="0" Margin="0 -2 0 0" VerticalAlignment="Center" Grid.RowSpan="3"> + <!--<Track.DecreaseRepeatButton> + <RepeatButton Style="{StaticResource RepeatButtonTransparent}" /> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Style="{StaticResource RepeatButtonTransparent}" /> + </Track.IncreaseRepeatButton>--> + <Track.Thumb> + <Thumb Thumb.Name="PART_Thumb" UIElement.Focusable="False" Height="Auto" Style="{StaticResource ThumbSlider}" VerticalAlignment="Top" Width="Auto" VerticalContentAlignment="Top"/> + </Track.Thumb> + </Track> + </Grid> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 1096ec112..a0a42f3b6 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -67,6 +67,7 @@ <Compile Include="Controls\FocusSelectionMode.cs" /> <Compile Include="Controls\IValueControl.cs" /> <Compile Include="Controls\MessageBoxVM.cs" /> + <Compile Include="Controls\SliderContentControl.cs" /> <Compile Include="Controls\TouchArcProgress.cs" /> <Compile Include="Controls\TouchAutoComplete.cs" /> <Compile Include="Controls\TouchCalendar.cs" /> @@ -133,6 +134,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\SliderContentControl.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Controls\TouchArcProgress.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -502,7 +507,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index 8b49ccc6b..14231fb3a 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -67,6 +67,8 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchPanel.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchPanelEureka.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/SliderContentControl.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/TouchColorPickerSlider.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/TouchColorPickerControl.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/TouchColorPickerHSBControl.xaml"/> @@ -75,6 +77,7 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/MultiRangeSlider.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/TouchColorPickerControls/TouchSliderThreeThumbs.xaml"/> + </ResourceDictionary.MergedDictionaries> </ResourceDictionary> |
