diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs')
30 files changed, 364 insertions, 1220 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml index 16c6a42be..cdc28335d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml @@ -5,12 +5,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.Jobs.AppBarItems" - mc:Ignorable="d" - d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:JobProgressAppBarItem, IsDesignTimeCreatable=False}"> + mc:Ignorable="d" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:JobProgressAppBarItem, IsDesignTimeCreatable=False}"> <Grid> <touch:TouchButton Style="{StaticResource TangoFlatButton}" Command="{Binding PressedCommand}" Padding="0"> <StackPanel VerticalAlignment="Center"> - <TextBlock Text="{Binding MachineProvider.MachineOperator.RunningJob.Name,FallbackValue='Job Name'}" FontSize="{StaticResource TangoTitleFontSize}" TextTrimming="CharacterEllipsis"></TextBlock> + <TextBlock Text="{Binding MachineProvider.MachineOperator.RunningJob.Name,FallbackValue='Job Name'}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> <ProgressBar Maximum="{Binding MachineProvider.MachineOperator.RunningJobStatus.TotalProgressMinusSettingUp}" Value="{Binding MachineProvider.MachineOperator.RunningJobStatus.ProgressMinusSettingUp}" Margin="0 10 0 5" Background="{StaticResource TangoGrayBrush}" Height="5" Foreground="{StaticResource TangoPrimaryAccentBrush}" BorderThickness="0" /> <DockPanel LastChildFill="False"> <TextBlock DockPanel.Dock="Left"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs index 4d6050639..001888c92 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs @@ -15,12 +15,12 @@ namespace Tango.PPC.Jobs.AppButtons { op.StatusChanged += Op_StatusChanged; - Op_StatusChanged(op, op.Status); + Op_StatusChanged(this, op.Status); } private void Op_StatusChanged(object sender, MachineStatuses status) { - IsEnabled = (sender as IMachineOperator).CanPrint; + IsEnabled = status == MachineStatuses.ReadyToDye; } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs deleted file mode 100644 index 78f8c90a1..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Shapes; -using Tango.PMR.Printing; -using Tango.Touch.Controls; - -namespace Tango.PPC.Jobs -{ - public class JobOutlineControl : Control - { - #region Members - - private Size _sizeControl = new Size(0, 0); - ScrollViewer _parentScrollViewer = null; - public struct LevelOffset - { - public const double level_0 = 0.0; - public const double level_1 = 10.0; - public const double level_2 = 20.0; - public const double level_3 = 37.0; - public const double level_4 = 50.0; - public const double level_5 = 60.0; - public const double level_6 = 77.0; - public const double level_7 = 90.0; - public const double level_8 = 100.0; - } - private double _verticalOffset = 0; - private double _viewportHeight = 0; - private const double HEADER_FONT_HEIGHT = 35; - private const double TITLE_FONT_HEIGHT = 22; - private const double SUB_TITLE_FONT_HEIGHT = 19; - private const double NORMAL_FONT_HEIGHT = 17; - private const double WIDTH = 330; - - #endregion members - - public JobOutlineControl() : base() - { - Unloaded += JobOutlineControl_Unloaded; - DataContextChanged += JobOutlineControl_DataContextChanged; - Width = WIDTH; - } - - private void JobOutlineControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - if (DataContext == null) - { - return; - } - - if (_parentScrollViewer != null) - { - _parentScrollViewer.ScrollToTop(); - } - - InvalidateVisual(); - } - - #region events - private void JobOutlineControl_Unloaded(object sender, RoutedEventArgs e) - { - if (_parentScrollViewer != null) - { - _parentScrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged; - } - } - - private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) - { - if (e.VerticalChange == 0.0) - return; - - _verticalOffset = _parentScrollViewer.VerticalOffset; - _viewportHeight = _parentScrollViewer.ViewportHeight; - InvalidateVisual(); - } - #endregion events - - #region render - protected override void OnRender(DrawingContext drawingContext) - { - base.OnRender(drawingContext); - - if (!(DataContext is JobTicket job)) return; - if (_parentScrollViewer == null) - { - _parentScrollViewer = this.FindAncestor<ScrollViewer>(); - _parentScrollViewer.ScrollChanged += ScrollViewer_ScrollChanged; - } - else if (_viewportHeight == 0) - { - _viewportHeight = _parentScrollViewer.ActualHeight; - } - _sizeControl = new Size(); - _sizeControl.Height += 10; - DrawHeaderText(drawingContext, "JOB OUTLINE", 30, LevelOffset.level_0); - _sizeControl.Height += HEADER_FONT_HEIGHT; - - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "BASIC", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 5.0; - var basicProps = GetNameValueList(job); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Pencil); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - //JobTicket.Spool - if (job.Spool != null) - { - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "SPOOL", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 5.0; - basicProps = GetNameValueList(job.Spool); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Pencil); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - } - //JobTicket.ProcessParameters - if (job.ProcessParameters != null) - { - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "PROCESS PARAMETERS", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 5.0; - basicProps = GetNameValueList(job.ProcessParameters); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - } - //JobTicket.ThreadParameters - if (job.ThreadParameters != null) - { - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "THREAD PARAMETERS", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 5.0; - basicProps = GetNameValueList(job.ThreadParameters); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - } - //JobTicket.HeadCleaningParameters - if (job.HeadCleaningParameters != null) - { - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "HEAD CLEANING PARAMETERS", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 5.0; - basicProps = GetNameValueList(job.HeadCleaningParameters); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - } - //JobTicket.Segments - if (job.Segments != null) - { - _sizeControl.Height += 20; - DrawHeaderText(drawingContext, "SEGMENTS", 17, LevelOffset.level_0); - _sizeControl.Height += TITLE_FONT_HEIGHT; - _sizeControl.Height += 10.0; - int index = 0; - foreach (JobSegment seg in job.Segments) - { - DrawHeaderText(drawingContext, string.Format("#{0} SEGMENT", ++index), 14, LevelOffset.level_1); - _sizeControl.Height += SUB_TITLE_FONT_HEIGHT; - basicProps = GetNameValueList(seg); - foreach (var prop in basicProps) - { - DrawNameValueText(drawingContext, prop, LevelOffset.level_2, TouchIconKind.Pencil); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - //BrushStops - DrawHeaderText(drawingContext, "BRUSH STOPS", 12, LevelOffset.level_3); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - int indexBrush = 0; - foreach (JobBrushStop brushstop in seg.BrushStops) - { - _sizeControl.Height += 5.0; - DrawHeaderText(drawingContext, string.Format("#{0} STOP", ++indexBrush), 11, LevelOffset.level_4); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - var brushStops = GetNameValueList(brushstop); - foreach (var brushstopprop in brushStops) - { - DrawNameValueText(drawingContext, brushstopprop, LevelOffset.level_5, TouchIconKind.Pencil); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - DrawHeaderText(drawingContext, "DISPENSERS", 12, LevelOffset.level_6); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - _sizeControl.Height += 5.0; - int indexDispenser = 0; - foreach (JobDispenser disp in brushstop.Dispensers) - { - DrawHeaderText(drawingContext, string.Format("#{0} DISPENSER", ++indexDispenser), 11, LevelOffset.level_6); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - var dispProperties = GetNameValueList(disp); - foreach (var dispprop in dispProperties) - { - DrawNameValueText(drawingContext, dispprop, LevelOffset.level_7, TouchIconKind.ArrowRightBoldCircle); - _sizeControl.Height += NORMAL_FONT_HEIGHT; - } - } - } - } - } - - if (Height != _sizeControl.Height) - { - Height = _sizeControl.Height; - } - } - public IEnumerable<Tuple<String, String>> GetNameValueList(object value) - { - if (value != null) - { - var properties = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => (!x.PropertyType.IsClass && !typeof(IEnumerable).IsAssignableFrom(x.PropertyType)) || x.PropertyType == typeof(String)).ToList(); - return properties.Select(x => new Tuple<string, string>(x.Name, x.GetValue(value).ToString())); - } - else - { - return null; - } - } - #endregion render - - #region drawing - protected void DrawNameValueText(DrawingContext drawingContext, Tuple<string, string> text, double levelOfOffset, TouchIconKind? icon) - { - if (IsInViewPort()) - { - FormattedText formattedName = new FormattedText(text.Item1 + ": ", System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal), - 12, Foreground); - DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedName, icon); - double widthOfNameText = formattedName.WidthIncludingTrailingWhitespace + 17 + levelOfOffset;//17 pix for draw icon before text - - FormattedText formattedValue = new FormattedText(text.Item2, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), - 12, Foreground); - DrawIconTextIfVisible(drawingContext, widthOfNameText, formattedValue); - _sizeControl.Width = Math.Max(_sizeControl.Width, (widthOfNameText + formattedValue.WidthIncludingTrailingWhitespace)); - } - } - - private bool IsInViewPort() - { - return (_sizeControl.Height >= _verticalOffset && _sizeControl.Height <= (_verticalOffset + _viewportHeight + 5)); - } - - protected void DrawHeaderText(DrawingContext drawingContext, string text, int fontSize, double levelOfOffset) - { - if (IsInViewPort()) - { - FormattedText formattedtext = new FormattedText(text, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), - fontSize, Foreground); - DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedtext); - _sizeControl.Width = Math.Max(_sizeControl.Width, (formattedtext.Width + levelOfOffset)); - } - } - - private void DrawIconTextIfVisible(DrawingContext drawingContext, double levelOfOffset, FormattedText formattedText, TouchIconKind? icon = null) - { - if (icon is TouchIconKind) - { - DrawIcon(drawingContext, (TouchIconKind)icon, new Point(levelOfOffset, _sizeControl.Height)); - levelOfOffset += 17; - } - drawingContext.DrawText(formattedText, new Point(levelOfOffset, _sizeControl.Height)); - } - private void DrawIcon(DrawingContext drawingContext, TouchIconKind kind, Point point) - { - GeometryGroup group = GetGeometryByIcon(kind); - SetGeometryPosition(group, point); - drawingContext.DrawGeometry(Foreground, new Pen(Brushes.White, 1), group); - - } - private GeometryGroup GetGeometryByIcon(TouchIconKind kind) - { - Geometry geometry = Geometry.Parse(TouchIcon.Icons[kind]); - GeometryGroup group = new GeometryGroup(); - group.Children.Add(geometry); - - TransformGroup tg = new TransformGroup(); - tg.Children.Add(new ScaleTransform() - { - ScaleX = 10d / geometry.Bounds.Width, - ScaleY = 10d / geometry.Bounds.Height, - }); - tg.Children.Add(new TranslateTransform() { }); - - group.Transform = tg; - return group; - } - private void SetGeometryPosition(GeometryGroup group, Point point) - { - TransformGroup tg = group.Transform as TransformGroup; - (tg.Children[1] as TranslateTransform).X = point.X; - (tg.Children[1] as TranslateTransform).Y = point.Y + 1; - } - #endregion drawing - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index afe331145..ba6c13e91 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -66,9 +66,6 @@ </RectangleGeometry.Rect> </RectangleGeometry> </Border.Clip> - <Border.Background> - <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> - </Border.Background> <Grid> <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}"> <ItemsControl.ItemsPanel> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml index 5d3f3f1fc..97aedcf89 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml @@ -57,9 +57,6 @@ </ItemsControl> <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0"> - <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"> <RectangleGeometry.Rect> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs index b1be93793..a8ba66eda 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs @@ -18,17 +18,9 @@ namespace Tango.PPC.Jobs.Converters if (colorSpace != null) { - if (String.IsNullOrWhiteSpace(parameter.ToStringSafe())) + if (colorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) { - if (colorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) - { - return Visibility.Collapsed; - } - } - else - { - String[] spaces = parameter.ToString().Split(','); - return spaces.Contains(colorSpace.Space.ToString()) ? Visibility.Visible : Visibility.Collapsed; + return Visibility.Collapsed; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index da6989ff6..69eb1fd72 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -19,85 +19,23 @@ </Grid.RowDefinitions> <Grid> - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Text" Value="Color is out of range"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsOutOfGamut}" Value="False"> - <Setter Property="Text" Value="Closest Alternatives"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> - <Setter Property="Margin" Value="20 0 0 0"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxTitleFontSize}" Foreground="{StaticResource TangoErrorBrush}">Color is out of range</TextBlock> <touch:TouchIconButton Command="{Binding CloseCommand}" HorizontalAlignment="Right" Icon="Close" CornerRadius="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" Padding="22" /> </Grid> <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center"> - <Image Source="../Images/JobView/error.png" Stretch="None" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}" /> + <Image Source="../Images/JobView/error.png" Stretch="None" /> <Ellipse Width="60" Height="60" Margin="20 0 0 0" Fill="{Binding InvalidBrushStop.Brush}" /> <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="RGB"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> <Run Text="{Binding InvalidBrushStop.Red}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Green}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Blue}"></Run> </TextBlock> - <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="LAB"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - <Run Text="{Binding InvalidBrushStop.L,StringFormat=0.00}"></Run><Run>,</Run> - <Run Text="{Binding InvalidBrushStop.A,StringFormat=0.00}"></Run><Run>,</Run> - <Run Text="{Binding InvalidBrushStop.B,StringFormat=0.00}"></Run> - </TextBlock> - <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0" Text="{Binding InvalidBrushStop.LiquidVolumesOrderedPigmentedString,Mode=OneWay}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="Volume"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> </StackPanel> <DockPanel Grid.Row="2" Margin="0 0 0 0"> - <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Text" Value="Please select the best alternative"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsOutOfGamut}" Value="False"> - <Setter Property="Text" Value="Please select an alternative"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> + <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please select the best alternative</TextBlock> <hive:HexList Width="330" Height="460" Margin="0 20 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> <hive:HexList.ItemContainerStyle> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs index db8573322..887e62dd7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs @@ -14,6 +14,6 @@ namespace Tango.PPC.Jobs.Dialogs /// <seealso cref="Tango.PPC.Jobs.Dialogs.BasicColorCorrectionViewVM" /> public class AdvancedColorCorrectionViewVM : BasicColorCorrectionViewVM { - public bool IsOutOfGamut { get; set; } + } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml index bd31b88ce..4c100c2fc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml @@ -59,7 +59,7 @@ </StackPanel> <DockPanel Grid.Row="2" Margin="0 0 0 0"> - <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please use the closest alternative</TextBlock> + <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please select an alternative</TextBlock> <touch:TouchListBox SelectionMode="Single" Style="{StaticResource TangoNoRippleListBox}" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}" Margin="0 20 0 0"> <touch:TouchListBox.ItemContainerStyle> @@ -81,7 +81,7 @@ </Setter> <Setter Property="Effect"> <Setter.Value> - <DropShadowEffect Color="{StaticResource TangoGrayColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> + <DropShadowEffect Color="{StaticResource TangoDarkForegroundColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> </Setter.Value> </Setter> <Style.Triggers> @@ -147,10 +147,7 @@ <DockPanel Grid.Row="3" Margin="40 10 20 0" LastChildFill="False"> <touch:TouchButton Command="{Binding MoreOptionsCommand}" VerticalAlignment="Top" Style="{StaticResource TangoLinkButton}" DockPanel.Dock="Left" Foreground="{StaticResource TangoPrimaryAccentBrush}"> - <StackPanel Orientation="Horizontal"> - <Image Source="../Images/color-picker.png" Stretch="None" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">More Options</TextBlock> - </StackPanel> + More Options </touch:TouchButton> <touch:TouchButton Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" DockPanel.Dock="Right" Width="170" Height="50" VerticalAlignment="Bottom"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml index 128a93548..ded395e08 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml @@ -56,7 +56,7 @@ <DataTemplate> <StackPanel Orientation="Vertical" HorizontalAlignment="Center"> <Image Stretch="Fill" Width="32" Height="32" RenderOptions.BitmapScalingMode="Fant" Source="../Images/NewJob/twine.png"></Image> - <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" TextAlignment="Center" Text="{Binding Name}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis"></TextBlock> + <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Text="{Binding Name}"></TextBlock> </StackPanel> </DataTemplate> </touch:TouchStaticListBox.ItemTemplate> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml index da51bba27..ac27cc00d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml @@ -18,7 +18,7 @@ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT JOB</TextBlock> <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock> - <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0" Visibility="Collapsed">Edit this job after import</touch:TouchCheckBox> + <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0">Edit this job after import</touch:TouchCheckBox> </StackPanel> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg Binary files differdeleted file mode 100644 index cf1d94d12..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg Binary files differdeleted file mode 100644 index c682a4c7e..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png Binary files differdeleted file mode 100644 index d8d6f8470..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png Binary files differdeleted file mode 100644 index 46059c5c0..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png Binary files differdeleted file mode 100644 index 4e46ee447..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs deleted file mode 100644 index 4e3137e1c..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.PPC.Common.Notifications; - -namespace Tango.PPC.Jobs.NotificationItems -{ - /// <summary> - /// Represents a simple text message notification item which can be inserted into the application notifications panel. - /// </summary> - /// <seealso cref="Tango.PPC.Common.Notifications.NotificationItem" /> - public class NewSynchronizardJobsNotificationItem : NotificationItem - { - /// <summary> - /// Initializes a new instance of the <see cref="UpdateAvailableNotificationItem"/> class. - /// </summary> - public NewSynchronizardJobsNotificationItem() - { - CanClose = true; - } - - /// <summary> - /// Gets or sets the view type. - /// </summary> - public override Type ViewType - { - get { return typeof(NewSynchronizardJobsNotificationItemView); } - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml deleted file mode 100644 index 5a57e3db7..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml +++ /dev/null @@ -1,30 +0,0 @@ -<UserControl x:Class="Tango.PPC.Jobs.NotificationItems.NewSynchronizardJobsNotificationItemView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" - xmlns:local="clr-namespace:Tango.PPC.Jobs.NotificationItems" - xmlns:common="clr-namespace:Tango.PPC.Common.Converters" - mc:Ignorable="d" - x:Name="MessageNotificationItemControl" - d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:NewSynchronizardJobsNotificationItem, IsDesignTimeCreatable=False}" MinHeight="90" Height="90" MaxHeight="150" Background="White"> - - <UserControl.Resources> - <BitmapImage x:Key="icon" UriSource="../Images/sync_job.png" /> - </UserControl.Resources> - - <Grid> - <Border BorderThickness="0 0 0 2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" Padding="15"> - <DockPanel> - <Image Source="{StaticResource icon}" MaxHeight="50" /> - - <Grid> - <TextBlock Margin="20 0 0 0" VerticalAlignment="Center"> - New job definitions were synchronized with your machine. Tap to refresh your job list. - </TextBlock> - </Grid> - </DockPanel> - </Border> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs deleted file mode 100644 index 33db09386..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -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.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.PPC.Jobs.NotificationItems -{ - /// <summary> - /// Represents the <see cref="UpdateAvailableNotificationItemView"/> view. - /// </summary> - /// <seealso cref="System.Windows.Controls.UserControl" /> - /// <seealso cref="System.Windows.Markup.IComponentConnector" /> - public partial class NewSynchronizardJobsNotificationItemView : UserControl - { - public NewSynchronizardJobsNotificationItemView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 33b9de808..aedf09ce7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -124,10 +124,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="NotificationItems\NewSynchronizardJobsNotificationItemView.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="Resources\Styles.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -167,7 +163,6 @@ </Compile> <Compile Include="AppButtons\StartPrintingButton.cs" /> <Compile Include="AppButtons\StopPrintingButton.cs" /> - <Compile Include="Controls\JobOutlineControl.cs" /> <Compile Include="Controls\RunningJobViewer.xaml.cs"> <DependentUpon>RunningJobViewer.xaml</DependentUpon> </Compile> @@ -232,10 +227,6 @@ <Compile Include="NavigationObjects\JobNavigationObject.cs" /> <Compile Include="NavigationObjects\JobSummeryNavigationObject.cs" /> <Compile Include="NavigationObjects\TwineCatalogNavigationObject.cs" /> - <Compile Include="NotificationItems\NewSynchronizardJobsNotificationItem.cs" /> - <Compile Include="NotificationItems\NewSynchronizardJobsNotificationItemView.xaml.cs"> - <DependentUpon>NewSynchronizardJobsNotificationItemView.xaml</DependentUpon> - </Compile> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> @@ -491,25 +482,10 @@ <Resource Include="Images\small-cards-view - blue.png" /> <Resource Include="Images\small-cards-view.png" /> </ItemGroup> - <ItemGroup> - <Resource Include="Images\color-picker.png" /> - </ItemGroup> - <ItemGroup> - <Resource Include="Images\sync.png" /> - </ItemGroup> - <ItemGroup> - <Resource Include="Images\JobView\transparent.jpg" /> - </ItemGroup> - <ItemGroup> - <Resource Include="Images\JobView\transparent_small.jpg" /> - </ItemGroup> - <ItemGroup> - <Resource Include="Images\sync_job.png" /> - </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 8d5bd284d..103a10b28 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -6,10 +6,8 @@ using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Integration.Operation; -using Tango.PMR.Printing; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; -using Tango.PPC.Common.Notifications; using Tango.PPC.Jobs.AppBarItems; using Tango.PPC.Jobs.AppButtons; using Tango.PPC.Jobs.Dialogs; @@ -49,26 +47,6 @@ namespace Tango.PPC.Jobs.ViewModels set { _runningJobStatus = value; RaisePropertyChangedAuto(); } } - private bool _isDisplayJobOutline; - /// <summary> - /// Gets or sets a value indicating whether to display the job outline. - /// </summary> - public bool IsDisplayJobOutline - { - get { return _isDisplayJobOutline; } - set { _isDisplayJobOutline = value; RaisePropertyChangedAuto(); } - } - - private JobTicket _jobOutlineTicket; - /// <summary> - /// Gets or sets the job outline ticket. - /// </summary> - public JobTicket JobOutlineTicket - { - get { return _jobOutlineTicket; } - set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } - } - #endregion #region Commands @@ -81,16 +59,6 @@ namespace Tango.PPC.Jobs.ViewModels /// </value> public RelayCommand GoToJobCommand { get; set; } - /// <summary> - /// Gets or sets the display job outline command. - /// </summary> - public RelayCommand DisplayJobOutlineCommand { get; set; } - - /// <summary> - /// Gets or sets the hide job outline command. - /// </summary> - public RelayCommand HideJobOutlineCommand { get; set; } - #endregion public JobProgressViewVM() @@ -99,21 +67,14 @@ namespace Tango.PPC.Jobs.ViewModels _stop_job_btn.Pressed += _stop_job_btn_Pressed; GoToJobCommand = new RelayCommand(GoToJob); - DisplayJobOutlineCommand = new RelayCommand(DisplayJobOutline); - HideJobOutlineCommand = new RelayCommand(HideJobOutline); } - #region Private Methods - - private void HideJobOutline() - { - IsDisplayJobOutline = false; - } - - private void DisplayJobOutline() + private void _stop_job_btn_Pressed() { - JobOutlineTicket = _handler.JobTicket; - IsDisplayJobOutline = true; + if (_handler != null) + { + _handler.Cancel(); + } } private void GoToJob() @@ -122,8 +83,6 @@ namespace Tango.PPC.Jobs.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); } - #endregion - #region Override Methods /// <summary> @@ -135,32 +94,41 @@ namespace Tango.PPC.Jobs.ViewModels } /// <summary> + /// Called when the navigation system has navigated from this VM view. + /// </summary> + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + + if (MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled) + { + NotificationProvider.PushAppBarItem<JobProgressAppBarItem>().Pressed += (_, __) => + { + NotificationProvider.CurrentAppBarItem.Close(); + NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); + }; + } + } + + /// <summary> /// Called when the navigation system has navigated to this VM view. /// </summary> public override void OnNavigatedTo() { base.OnNavigatedTo(); - IsDisplayJobOutline = false; - - if (_handler != null && !_handler.Status.IsFailed) + if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) { - _stop_job_btn.Push(); + NotificationProvider.CurrentAppBarItem.Close(); } + + _stop_job_btn.Push(); } #endregion #region Event Handlers - private void _stop_job_btn_Pressed() - { - if (_handler != null) - { - _handler.Cancel(); - } - } - /// <summary> /// Handles the PrintingStarted event of the MachineOperator. /// </summary> @@ -173,10 +141,8 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; - e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; _stop_job_btn.Push(); - _stop_job_btn.IsEnabled = true; } /// <summary> @@ -206,18 +172,12 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void JobHandler_Stopped(object sender, EventArgs e) { - if (_stop_job_btn != null) + if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) { - _stop_job_btn.Pop(); + NotificationProvider.CurrentAppBarItem.Close(); } - if (_handler != null) - { - _handler.StatusChanged -= JobHandler_StatusChanged; - _handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired; - _handler.Stopped -= JobHandler_Stopped; - _handler.CanCancelChanged -= JobHandler_CanCancelChanged; - } + _stop_job_btn.Pop(); } /// <summary> @@ -233,16 +193,6 @@ namespace Tango.PPC.Jobs.ViewModels }); } - /// <summary> - /// Handles the CanCancelChanged event of the JobHandler control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> - private void JobHandler_CanCancelChanged(object sender, EventArgs e) - { - _stop_job_btn.IsEnabled = _handler.CanCancel; - } - #endregion } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index a2acf5893..bff6beff5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -26,7 +26,6 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _context; private bool _canStartJob; - private bool _startingJob; private bool _isPreparingJob; /// <summary> @@ -60,6 +59,7 @@ namespace Tango.PPC.Jobs.ViewModels set { _estimatedDuration = value; RaisePropertyChangedAuto(); } } + /// <summary> /// Gets or sets the dye command. /// </summary> @@ -96,20 +96,12 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { - if (_startingJob) return; - - _startingJob = true; - _canStartJob = false; - InvalidateRelayCommands(); - NavigationManager.IsBackEnabled = false; - try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo<JobsModule>(false, nameof(JobProgressView)); - _startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -120,13 +112,6 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}"); } - finally - { - _startingJob = false; - _canStartJob = true; - NavigationManager.IsBackEnabled = true; - InvalidateRelayCommands(); - } } /// <summary> @@ -145,6 +130,16 @@ namespace Tango.PPC.Jobs.ViewModels _context = obj.Context; Job = obj.Job; + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + await NavigationManager.NavigateBack(); + return; + } + } + IsPreparingJob = true; Job = await new JobBuilder(_context).Set(Job.Guid) @@ -155,15 +150,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .BuildAsync(); - if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) - { - if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) - { - await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); - await NavigationManager.NavigateBack(); - return; - } - } + await Task.Delay(2000); await Task.Factory.StartNew(() => { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 5e90d3b5b..4e1e58dba 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -56,7 +56,6 @@ namespace Tango.PPC.Jobs.ViewModels private ActionTimer _volumeConversionTimer; private IColorConverter _converter; private string _current_job_string; - private bool startingJob = false; #region Properties @@ -413,7 +412,7 @@ namespace Tango.PPC.Jobs.ViewModels RepeatSampleDyeCommand = new RelayCommand(RepeatSampleDye); AnotherSampleCommand = new RelayCommand(DyeAnotherSample); InvokeFineTuningPaletteCommand = new RelayCommand<FineTuneItem>(InvokeFineTuningPalette); - ResetFineTuningCommand = new RelayCommand(() => ResetFineTuning(true)); + ResetFineTuningCommand = new RelayCommand(ResetFineTuning); StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected) && CanStartJob()); RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); @@ -469,7 +468,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.ValidateOnPropertyChanged = true; LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().BuildAsync()).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -479,7 +478,7 @@ namespace Tango.PPC.Jobs.ViewModels if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) { - SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); + SelectedCatalog = await new ColorCatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); if (SelectedCatalog != null) { @@ -546,15 +545,18 @@ namespace Tango.PPC.Jobs.ViewModels } catch (Exception ex) { - IsFree = true; - LogManager.Log(ex, $"Error loading job '{(_job_to_load != null ? _job_to_load.Name : "null")}'"); + LogManager.Log(ex, $"Error loading job '{_job_to_load.Name}'"); await NotificationProvider.ShowError("An error occurred while trying to load the selected job."); _can_navigate_back = true; await NavigationManager.NavigateBack(); } finally { - IsFree = true; + InvokeUI(() => + { + IsFree = true; + //NotificationProvider.ReleaseGlobalBusyMessage(); + }); } } @@ -591,9 +593,7 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; - Job.IsSynchronized = false; Job.JobStatus = BL.Enumerations.JobStatuses.Draft; - Job.MarkModified(_db); await _db.SaveChangesAsync(); _current_job_string = Job.ToJobFileWhenLoaded().ToString(); @@ -645,16 +645,11 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { - if (startingJob) return; - try { - Debug.WriteLine("Job Starting..."); - startingJob = true; LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); - var handler = await PrintingManager.Print(Job, _db); + await PrintingManager.Print(Job, _db); await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); - startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -665,10 +660,6 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}."); } - finally - { - startingJob = false; - } } /// <summary> @@ -677,7 +668,8 @@ namespace Tango.PPC.Jobs.ViewModels private bool CanStartJob() { return - Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || x.IsLiquidVolumesOutOfRange); + Job != null && Job.Validate(_db) && + !Job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.IsOutOfGamut); } #endregion @@ -717,7 +709,7 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Adding new solid segment..."); - var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); + var s = Job.AddSolidSegment(MachineProvider.Machine.DefaultSegmentLength > 0 ? MachineProvider.Machine.DefaultSegmentLength : 10); SetSegmentLiquidVolumesIfVolume(s); return s; } @@ -737,7 +729,7 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Adding new gradient segment..."); - var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); + var s = Job.AddGradientSegment(MachineProvider.Machine.DefaultSegmentLength > 0 ? MachineProvider.Machine.DefaultSegmentLength : 10); SetSegmentLiquidVolumesIfVolume(s); return s; } @@ -767,7 +759,14 @@ namespace Tango.PPC.Jobs.ViewModels draggedSegment.SegmentIndex = droppedSegment.SegmentIndex + 1; } - ArrangeSegmentsIndices(); + int index = 1; + + foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) + { + segment.SegmentIndex = index++; + } + + SegmentsCollectionView.Refresh(); } /// <summary> @@ -830,14 +829,10 @@ namespace Tango.PPC.Jobs.ViewModels private void ArrangeSegmentsIndices() { - int index = 1; - - foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) + for (int i = 0; i < Job.Segments.Count; i++) { - segment.SegmentIndex = index++; + Job.Segments[i].SegmentIndex = i + 1; } - - SegmentsCollectionView.Refresh(); } #endregion @@ -885,55 +880,23 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log($"Invoking triplet color adjustment dialog for brush stop {brushStop.StopIndex} at segment {brushStop.Segment.SegmentIndex}."); LogManager.Log("Retrieving color conversion suggestions for brush stop..."); - PMR.ColorLab.ConversionOutput conversionOutput = null; - - if (brushStop.IsOutOfGamut) - { - conversionOutput = _converter.Convert(brushStop, false); - } + var conversionOutput = _converter.Convert(brushStop, true); BasicColorCorrectionViewVM vm = null; - List<ColorConversionSuggestion> suggestions = null; - if (brushStop.IsOutOfGamut) + vm = await NotificationProvider.ShowDialog<BasicColorCorrectionViewVM>(new BasicColorCorrectionViewVM() { - vm = await NotificationProvider.ShowDialog<BasicColorCorrectionViewVM>(new BasicColorCorrectionViewVM() - { - InvalidBrushStop = brushStop, - Suggestions = new List<ColorConversionSuggestion>() { new ColorConversionSuggestion(conversionOutput.SingleCoordinates, 0, 0) }, - }); - } + InvalidBrushStop = brushStop, + Suggestions = conversionOutput.CreateTrippletSuggestions(), + }); - if (vm == null || vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) + if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { - NotificationProvider.SetGlobalBusyMessage("Generating color hive..."); - - await Task.Factory.StartNew(() => - { - conversionOutput = _converter.Convert(brushStop, true); - - suggestions = conversionOutput.CreateHiveSuggestions(); - - if (vm == null) - { - var center = suggestions.GetCenterSuggestion(); - center.Coordinates.Red = brushStop.Red; - center.Coordinates.Green = brushStop.Green; - center.Coordinates.Blue = brushStop.Blue; - - center.Coordinates.L = brushStop.L; - center.Coordinates.A = brushStop.A; - center.Coordinates.B = brushStop.B; - } - }); - - NotificationProvider.ReleaseGlobalBusyMessage(); LogManager.Log("Invoking hive color conversion dialog..."); vm = await NotificationProvider.ShowDialog<AdvancedColorCorrectionViewVM>(new AdvancedColorCorrectionViewVM() { InvalidBrushStop = brushStop, - Suggestions = suggestions, - IsOutOfGamut = brushStop.IsOutOfGamut, + Suggestions = conversionOutput.CreateHiveSuggestions(), }); } @@ -953,13 +916,6 @@ namespace Tango.PPC.Jobs.ViewModels brushStop.A = vm.SelectedSuggestion.Coordinates.A; brushStop.B = vm.SelectedSuggestion.Coordinates.B; } - else if (brushStop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) - { - if (vm.SelectedSuggestion != suggestions.GetCenterSuggestion()) - { - vm.SelectedSuggestion.ApplyOnBrushStop(brushStop); - } - } brushStop.Corrected = true; brushStop.IsOutOfGamut = false; @@ -971,11 +927,6 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error while invoking color adjustment dialog."); await NotificationProvider.ShowError("An error occurred while trying to convert the selected color."); } - finally - { - NotificationProvider.ReleaseGlobalBusyMessage(); - DyeCommand.RaiseCanExecuteChanged(); - } } /// <summary> @@ -985,7 +936,7 @@ namespace Tango.PPC.Jobs.ViewModels [HandleProcessCorruptedStateExceptions] public void OnBrushStopFieldValueChanged(BrushStop stop) { - if (stop != null && stop.ColorSpace != null) + if (stop != null) { stop.Corrected = false; stop.OutOfGamutChecked = false; @@ -1003,11 +954,6 @@ namespace Tango.PPC.Jobs.ViewModels stop.Blue = output.SingleCoordinates.Blue; stop.Corrected = true; stop.IsOutOfGamut = false; - - InvokeUI(() => - { - DyeCommand.RaiseCanExecuteChanged(); - }); } catch (Exception ex) { @@ -1128,7 +1074,7 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Synchronizes the fine tune items to brush stops. /// </summary> - private async void SyncFineTuneItemsToBrushStops(bool displayBusy = false) + private void SyncFineTuneItemsToBrushStops() { try { @@ -1140,27 +1086,18 @@ namespace Tango.PPC.Jobs.ViewModels } else { - if (displayBusy) - { - NotificationProvider.SetGlobalBusyMessage("Generating suggestions..."); - } - FineTuneItems.Clear(); - foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) + foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) { - var conversionoutput = await _converter.ConvertAsync(stop, true); - FineTuneItem item = new FineTuneItem(conversionoutput); - item.BrushStop = stop; + FineTuneItem item = new FineTuneItem(_converter.Convert(stop, true)); item.BrushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.Color == stop.Color).ToList(); - item.SelectedSuggestion = item.Suggestions.GetCenterSuggestion(); + item.SelectedSuggestion = item.Suggestions[item.Suggestions.Count / 2]; item.SelectedChanged += () => StartFineTuningCommand.RaiseCanExecuteChanged(); FineTuneItems.Add(item); } _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); - - NotificationProvider.ReleaseGlobalBusyMessage(); } ApprovalFineTuneItems = FineTuneItems.Where(x => x.IsSelected).ToObservableCollection(); @@ -1172,10 +1109,6 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log(ex, "Error while trying to synchronize fine tuning items with brush stops."); } - finally - { - NotificationProvider.ReleaseGlobalBusyMessage(); - } } /// <summary> @@ -1202,23 +1135,19 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error invoking the fine tunning palette"); await NotificationProvider.ShowError("An error occurred while trying to display the fine tunning palette."); } - finally - { - NotificationProvider.ReleaseGlobalBusyMessage(); - } } /// <summary> /// Resets the fine tuning. /// </summary> - private void ResetFineTuning(bool displayBusy = false) + private void ResetFineTuning() { if (Job != null && _jobs_fine_tune_items.ContainsKey(Job.Guid)) { _jobs_fine_tune_items.Remove(Job.Guid); } - SyncFineTuneItemsToBrushStops(displayBusy); + SyncFineTuneItemsToBrushStops(); } /// <summary> @@ -1428,8 +1357,6 @@ namespace Tango.PPC.Jobs.ViewModels { bool result = true; - if (!IsFree) return false; - if (!_can_navigate_back) { bool jobChainged = false; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 64931cbe3..a7b06f6eb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -36,9 +36,6 @@ using System.Windows.Media.Imaging; using Tango.Touch.Components; using Tango.PPC.Jobs.ViewContracts; using Tango.Core.ExtensionMethods; -using Tango.PPC.Common.Synchronization; -using Tango.PPC.Jobs.NotificationItems; -using Tango.PPC.Storage.Models; namespace Tango.PPC.Jobs.ViewModels { @@ -49,10 +46,7 @@ namespace Tango.PPC.Jobs.ViewModels public class JobsViewVM : PPCViewModel<IJobsView> { private ObservablesContext _db; //Holds the db context for the job list. - private ObservableCollection<ColorCatalog> _catalogs; //Holds the available color catalogs for the site. - private ObservableCollection<Rml> _rmls; //Holds the available RML for the site. - private List<ColorSpace> _colorSpaces; //Holds the available color spaces. - private bool _isJobsSynchronizationNotificationActive; + private ObservableCollection<ColorCatalog> _catalogs; //Holds the available color catalogs. public enum JobsCategory { @@ -324,7 +318,7 @@ namespace Tango.PPC.Jobs.ViewModels RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); - if (!directlyToEdit && MachineProvider.MachineOperator.CanPrint) + if (!directlyToEdit && MachineProvider.MachineOperator.Status == Integration.Operation.MachineStatuses.ReadyToDye) { await NavigationManager.NavigateWithObject<JobsModule, JobSummeryView, JobSummeryNavigationObject>(new JobSummeryNavigationObject() { @@ -355,8 +349,6 @@ namespace Tango.PPC.Jobs.ViewModels _db = ObservablesContext.CreateDefault(); - _colorSpaces = _db.ColorSpaces.ToList(); - var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().WithCustomer().WithColorSpace().Build(); InvokeUI(() => @@ -415,15 +407,10 @@ namespace Tango.PPC.Jobs.ViewModels var machine = MachineProvider.Machine; JobCreationViewVM vm = new JobCreationViewVM( - Settings.SupportedJobTypes.Count > 0 ? Settings.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList(), - Settings.SupportedColorSpaces.Count > 0 ? Settings.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList() + machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList(), + machine.SupportedColorSpaces.Count > 0 ? machine.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList() ); - if (_catalogs.Count == 0) - { - vm.SupportedColorSpaces.Remove(ColorSpaces.Catalog); - } - CatalogSelectionViewVM catalogVM = new CatalogSelectionViewVM(_catalogs.ToList(), _catalogs.ToList().SingleOrDefault(x => x.Guid == settings.LastSelectedCatalogGuid)); if (settings.LastJobType != null) @@ -432,7 +419,7 @@ namespace Tango.PPC.Jobs.ViewModels } else { - vm.SelectedJobType = Settings.SupportedJobTypes.FirstOrDefault(); + vm.SelectedJobType = machine.SupportedJobTypes.FirstOrDefault(); } if (settings.LastJobColorSpace != null) @@ -441,7 +428,7 @@ namespace Tango.PPC.Jobs.ViewModels } else { - var space = Settings.SupportedColorSpaces.FirstOrDefault(); + var space = machine.SupportedColorSpaces.FirstOrDefault(); vm.SelectedColorSpace = space.IsUserSpace() ? space : ColorSpaces.Catalog; } @@ -459,7 +446,7 @@ namespace Tango.PPC.Jobs.ViewModels if (twnFile == null) { - if (Settings.SupportedJobTypes.Count != 1 || Settings.SupportedColorSpaces.Count != 1) + if (machine.SupportedJobTypes.Count != 1 || machine.SupportedColorSpaces.Count != 1) { vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); if (!vm.DialogResult) return; @@ -489,14 +476,14 @@ namespace Tango.PPC.Jobs.ViewModels } else { - vm.SelectedJobType = Settings.SupportedJobTypes.First(); - vm.SelectedColorSpace = Settings.SupportedColorSpaces.First(); + vm.SelectedJobType = machine.SupportedJobTypes.First(); + vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); } } settings.LastJobType = vm.SelectedJobType; settings.LastJobColorSpace = vm.SelectedColorSpace; - + if (vm.SelectedColorSpace == ColorSpaces.Catalog) { settings.LastSelectedCatalogGuid = catalogVM.SelectedCatalog.Guid; @@ -505,8 +492,6 @@ namespace Tango.PPC.Jobs.ViewModels settings.Save(); Job job = new Job(); - job.LastUpdated = DateTime.UtcNow; - job.JobSource = JobSource.Local; job.Name = "untitled"; job.NumberOfHeads = 1; job.NumberOfUnits = 1; @@ -516,12 +501,11 @@ namespace Tango.PPC.Jobs.ViewModels job.JobType = vm.SelectedJobType; job.EnableLubrication = true; job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; - job.ColorSpace = _colorSpaces.SingleOrDefault(x => x.Guid == job.ColorSpaceGuid); job.MachineGuid = MachineProvider.Machine.Guid; - job.UserGuid = null; - job.RmlGuid = (Settings.DefaultRmlGuid != null && _rmls.Select(x => x.Guid).Contains(Settings.DefaultRmlGuid)) ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; + job.UserGuid = AuthenticationProvider.CurrentUser.Guid; + job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; if (vm.SelectedColorSpace == ColorSpaces.Catalog) { @@ -535,11 +519,11 @@ namespace Tango.PPC.Jobs.ViewModels if (colorProfile == null) { - job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); + job.AddSolidSegment(machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); } else { - job.AddSolidSegment(colorProfile.Value, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); + job.AddSolidSegment(colorProfile.Value, machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); job.Name = $"SnapMatch {colorProfile.Value.R}, {colorProfile.Value.G}, {colorProfile.Value.B}"; } @@ -740,13 +724,10 @@ namespace Tango.PPC.Jobs.ViewModels StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); //Load catalogs. - using (ObservablesContext db = ObservablesContext.CreateDefault()) + using (ObservablesContext c = ObservablesContext.CreateDefault()) { - _catalogs = await new CatalogsCollectionBuilder(db).SetAll().ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); - _rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + _catalogs = (await c.ColorCatalogs.ToListAsync()).ToObservableCollection(); } - - MachineDataSynchronizer.SynchronizationEnded += MachineDataSynchronizer_SynchronizationEnded; } public override void OnNavigatedTo() @@ -764,64 +745,37 @@ namespace Tango.PPC.Jobs.ViewModels var selected_job = SelectedJobs.FirstOrDefault(); if (selected_job == null) return; - var selectedJobs = SelectedJobs.ToList(); - ClearSelection(); var result = await NavigationManager. NavigateForResult<StorageModule, Storage.Views.MainView, ExplorerFileItem, - StorageNavigationRequest>( - new StorageNavigationRequest() + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() { - Intent = selectedJobs.Count == 1 ? StorageNavigationIntent.SaveFile : StorageNavigationIntent.SaveFiles, + Intent = Storage.Models.StorageNavigationIntent.SaveFile, DefaultFileName = selected_job.Name, Filter = ExplorerFileDefinition.Job.Extension, - Title = selectedJobs.Count == 1 ? "Save Job File" : "Save Job Files", + Title = "Save Job File", }); if (result != null) { - if (selectedJobs.Count == 1) + try { - try - { - var jobFile = await selected_job.ToJobFile(); + var jobFile = await selected_job.ToJobFile(); - using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create)) - { - jobFile.WriteTo(fs); - } - - await NotificationProvider.ShowSuccess("Job saved successfully."); - } - catch (Exception ex) + using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create)) { - LogManager.Log(ex, $"Error saving job {selected_job.Name} to file."); - await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); + jobFile.WriteTo(fs); } + + await NotificationProvider.ShowSuccess("Job saved successfully."); } - else + catch (Exception ex) { - foreach (var job in selectedJobs) - { - try - { - var jobFile = await job.ToJobFile(); - - using (FileStream fs = new FileStream(Path.Combine(result.Path, jobFile.Name.ToValidFileName()) + ExplorerFileDefinition.Job.Extension, FileMode.Create)) - { - jobFile.WriteTo(fs); - } - } - catch (Exception ex) - { - LogManager.Log(ex, $"Error saving job {job.Name} to file."); - await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); - } - } - - await NotificationProvider.ShowSuccess("Jobs saved successfully."); + LogManager.Log(ex, $"Error saving job {selected_job.Name} to file."); + await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); } } } @@ -830,7 +784,7 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle Job File Loading From Storage - private async void HandleJobFileLoaded(List<ExplorerFileItem> jobFiles) + private async void HandleJobFileLoaded(ExplorerFileItem jobFile) { var vm = await NotificationProvider.ShowDialog<ImportJobViewVM>(); @@ -838,35 +792,29 @@ namespace Tango.PPC.Jobs.ViewModels { using (ObservablesContext jobContext = ObservablesContext.CreateDefault()) { - foreach (var jobFile in jobFiles) + try { - try + JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path)); + var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, AuthenticationProvider.CurrentUser.Guid); + jobContext.Jobs.Add(job); + await jobContext.SaveChangesAsync(); + LoadJobs(() => { - JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path)); - var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, null); - job.JobSource = JobSource.Local; - jobContext.Jobs.Add(job); - await jobContext.SaveChangesAsync(); - } - catch (Exception ex) - { - LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}."); - await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}"); - } + if (vm.ImportAndEdit) + { + var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid); + if (postJob != null) + { + SelectJob(postJob, true); + } + } + }); } - - LoadJobs(() => + catch (Exception ex) { - //Editing of a job is currently deprecated due to enabling multiple job imports. - //if (vm.ImportAndEdit) - //{ - // var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid); - // if (postJob != null) - // { - // SelectJob(postJob, true); - // } - //} - }); + LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}."); + await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}"); + } } } } @@ -875,10 +823,8 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle TCC File Loading From Storage - private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles) + private async void HandleColorProfileFileLoaded(ExplorerFileItem tccFile) { - var tccFile = tccFiles.FirstOrDefault(); - try { DetectionColorFile tcc = DetectionColorFile.Parser.ParseFrom(File.ReadAllBytes(tccFile.Path)); @@ -907,10 +853,8 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle Pulse TWN Loading From Storage - private async void HandlePulseFileLoaded(List<ExplorerFileItem> twnFiles) + private async void HandlePulseFileLoaded(ExplorerFileItem twnFile) { - var twnFile = twnFiles.FirstOrDefault(); - TwnFile twn = TwnFile.FromFile(twnFile.Path); BitmapSource preview = twn.Thumbnail.ToBitmapSource(); @@ -927,32 +871,6 @@ namespace Tango.PPC.Jobs.ViewModels #endregion - #region Handle New Synchronized Jobs - - private void MachineDataSynchronizer_SynchronizationEnded(object sender, SynchronizationEndedEventArgs e) - { - if (e.NewChangedJobs > 0 && !_isJobsSynchronizationNotificationActive) - { - _isJobsSynchronizationNotificationActive = true; - - var item = NotificationProvider.PushNotification<NewSynchronizardJobsNotificationItem>(); - item.Pressed += (_, __) => - { - _isJobsSynchronizationNotificationActive = false; - LoadJobs(() => - { - NotificationProvider.ShowSuccess("Your job list is now synchronized."); - }); - }; - item.Closed += (_, __) => - { - _isJobsSynchronizationNotificationActive = false; - }; - } - } - - #endregion - #region Color Profile Request private void ExternalBridgeService_ColorProfileRequest(object sender, ColorProfileRequestEventArgs e) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 579e1e2f7..ed1e28f55 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -11,7 +11,6 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; -using Tango.PPC.Jobs.AppBarItems; using Tango.PPC.Jobs.Messages; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; @@ -25,9 +24,6 @@ namespace Tango.PPC.Jobs.ViewModels public class MainViewVM : PPCViewModel { private NotificationItem _last_failed_job_notification; - private JobHandler _handler; - private bool resuming; - private JobProgressAppBarItem _appBarItem; /// <summary> /// Called when the application has been started. @@ -37,42 +33,23 @@ namespace Tango.PPC.Jobs.ViewModels MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob; - MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; - MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; - NavigationManager.CurrentVMChanged += NavigationManager_CurrentVMChanged; } - private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) + private async void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) { - _appBarItem?.Close(); - _appBarItem = null; - } + LogManager.Log($"Trying to resume job '{e.JobGuid}'..."); - private void NavigationManager_CurrentVMChanged(object sender, PPCViewModel vm) - { - if (vm.GetType() == typeof(JobProgressViewVM)) - { - _appBarItem?.Close(); - _appBarItem = null; - } - else if (vm.GetType() != typeof(JobSummeryViewVM) && _appBarItem == null && MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled) + try { - _appBarItem = NotificationProvider.PushAppBarItem<JobProgressAppBarItem>(); - _appBarItem.Pressed += (_, __) => - { - _appBarItem?.Close(); - NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); - }; - } - } + var job = await new JobBuilder(ObservablesContext.CreateDefault()).Set(e.JobGuid) + .WithConfiguration() + .WithRML() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); - private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) - { - _handler = e.JobHandler; - - if (resuming) - { - resuming = false; + e.Approve(job); InvokeUI(() => { @@ -85,17 +62,6 @@ namespace Tango.PPC.Jobs.ViewModels } }); } - } - - private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) - { - LogManager.Log($"Job resume request '{e.JobGuid}' approving..."); - - try - { - e.Approve(); - resuming = true; - } catch (Exception ex) { LogManager.Log(ex, "An error occurred while trying to resume the job."); @@ -113,15 +79,13 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="Integration.Operation.PrintingFailedEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e) { - String message = $"{e.Exception.FlattenMessage()}"; - _last_failed_job_notification = NotificationProvider.PushNotification(new MessageNotificationItem( - $"'{e.Job.Name}' failed at position {e.JobHandler.Status.ProgressMinusSettingUp.ToString("0.0")} out of {e.JobHandler.Status.TotalProgressMinusSettingUp.ToString("0.0")} meters.", - message, MessageNotificationItem.MessageNotificationItemTypes.Error, () => + String.Format("'{0}' failed.", e.Job.Name), + String.Format("The job '{1}' has failed due to unexpected error.{0}{2}{0}{0}Tap to view this job details.", Environment.NewLine, e.Job.Name, e.Exception), MessageNotificationItem.MessageNotificationItemTypes.Error, () => { NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job); NavigationManager.ClearHistoryExcept<JobsView>(); - }, NotificationItem.NotificationPriority.VeryHigh)); + })); } /// <summary> @@ -155,7 +119,7 @@ namespace Tango.PPC.Jobs.ViewModels { NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job }); NavigationManager.ClearHistoryExcept<JobsView>(); - }, NotificationItem.NotificationPriority.VeryHigh)); + })); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml index 40cfc40f9..3b92581bc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml @@ -19,7 +19,7 @@ <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 100 0 0"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> - <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name,FallbackValue='Job Name'}" TextWrapping="Wrap" MaxWidth="700"></TextBlock> + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name,FallbackValue='Job Name'}"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" Margin="10 0 0 0" Visibility="{Binding Job.Designation,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='SampleDye'}">(Sample)</TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" Margin="10 0 0 0" Visibility="{Binding Job.Designation,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='FineTuning'}">(Fine Tuning)</TextBlock> </StackPanel> @@ -38,8 +38,6 @@ <Setter Property="Visibility" Value="Visible"></Setter> </DataTrigger> <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> - <Setter Property="Maximum" Value="100"></Setter> - <Setter Property="Value" Value="99.9999999"></Setter> <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> </DataTrigger> <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> @@ -100,7 +98,7 @@ <StackPanel Height="90" Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Image Source="../Images/JobProgressView/drop.png" Stretch="None" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Getting Ready...</TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Getting ready...</TextBlock> </StackPanel> </StackPanel> @@ -119,8 +117,8 @@ </Grid> <Grid Margin="0 150 0 0"> - <StackPanel MaxWidth="600"> - <Canvas Height="80" Margin="0"> + <StackPanel> + <Canvas Height="80" Margin="5 0"> <StackPanel> <StackPanel.Style> <Style TargetType="StackPanel"> @@ -140,58 +138,64 @@ </Style.Triggers> </Style> </StackPanel.Style> - <StackPanel Margin="-20 20 0 0"> - <StackPanel> - <Canvas HorizontalAlignment="Center"> - <TextBlock Margin="0 -25 0 0" Canvas.Left="{Binding RelativeSource={RelativeSource Mode=Self},Path=ActualWidth,Converter={StaticResource MathOperatorConverter},ConverterParameter='*-0.5'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Text" Value="Now Dyeing"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> - <Setter Property="Text" Value="Getting Ready"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> - <Setter Property="Text" Value="Job Canceled"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> - <Setter Property="Text" Value="Job Failed"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> - <Setter Property="Text" Value="Job Completed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - </Canvas> - <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Width="40" Height="40"> - <touch:TouchIcon.Style> - <Style TargetType="touch:TouchIcon" BasedOn="{StaticResource {x:Type touch:TouchIcon}}"> - <Setter Property="Angle" Value="180"></Setter> - <Setter Property="Icon" Value="Water"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> - <Setter Property="Angle" Value="0"></Setter> - <Setter Property="Icon" Value="Alert"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> - <Setter Property="Angle" Value="0"></Setter> - <Setter Property="Icon" Value="AlertOctagon"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> - <Setter Property="Angle" Value="0"></Setter> - <Setter Property="Icon" Value="Check"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchIcon.Style> - </touch:TouchIcon> - </StackPanel> + <StackPanel Margin="-50 0 0 0"> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="now dyeing"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> + <Setter Property="Text" Value="getting ready"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Water" Angle="180" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job canceled</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Alert" Foreground="{StaticResource TangoWarningBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job failed</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="AlertOctagon" Foreground="{StaticResource TangoErrorBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job completed</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Check" Foreground="{StaticResource TangoSuccessBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> </StackPanel> </StackPanel> </Canvas> @@ -210,23 +214,5 @@ Go to job </touch:TouchButton> </StackPanel> - - <touch:TouchButton Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Bottom" Margin="0 100 0 0" Command="{Binding DisplayJobOutlineCommand}" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}"> - Display Job Outline - </touch:TouchButton> - - <Grid Visibility="{Binding IsDisplayJobOutline,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoPrimaryBackgroundBrush}" Opacity="0.8"/> - - <Grid Margin="0 -10 0 0" Visibility="{Binding IsDisplayJobOutline,Converter={StaticResource BooleanToVisibilityConverter}}"> - <Grid> - <touch:TouchScrollViewer BorderThickness="0" Padding="10" Margin="0 0 0 100"> - <global:JobOutlineControl BorderThickness="0" Margin="20" DataContext="{Binding JobOutlineTicket}" HorizontalAlignment="Left" /> - </touch:TouchScrollViewer> - </Grid> - - <touch:TouchButton Background="{StaticResource TangoPrimaryBackgroundBrush}" VerticalAlignment="Bottom" Margin="0 100 0 0" Command="{Binding HideJobOutlineCommand}" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}"> - Hide Job Outline - </touch:TouchButton> - </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml index 4785805a6..80a427714 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml @@ -54,7 +54,7 @@ <RowDefinition Height="300*"/> </Grid.RowDefinitions> - <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"></TextBlock> + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> <Grid Grid.Row="1" Width="360" Height="360"> <touch:TouchBusyIndicator Opacity="0.6" IsIndeterminate="False" Foreground="{StaticResource TangoGrayBrush}" StrokeThickness="10" Minimum="0" Maximum="100" Value="99.999" Width="Auto" Height="Auto"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 6a94034db..57101569a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -26,8 +26,6 @@ <BitmapImage x:Key="Image_Out_Of_Gamut" UriSource="../Images/JobView/error.png" /> <BitmapImage x:Key="Image_Replace_Color" UriSource="../Images/JobView/replace-color.png" /> <BitmapImage x:Key="Image_Color_Picker" UriSource="../Images/JobView/color-picker.png" /> - <BitmapImage x:Key="Image_Transparent" UriSource="../Images/JobView/transparent.jpg" /> - <BitmapImage x:Key="Image_TransparentSmall" UriSource="../Images/JobView/transparent_small.jpg" /> <Style TargetType="FrameworkElement" x:Key="Level1Container"> @@ -113,24 +111,9 @@ <StackPanel> <StackPanel Orientation="Horizontal"> <Border Width="48" Height="48" CornerRadius="5" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Background"> - <Setter.Value> - <SolidColorBrush Color="{Binding Color,IsAsync=True}" /> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True" > - <Setter Property="Background"> - <Setter.Value> - <ImageBrush ImageSource="{StaticResource Image_TransparentSmall}" Stretch="None" /> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </Border.Style> + <Border.Background> + <SolidColorBrush Color="{Binding Color,IsAsync=True}"></SolidColorBrush> + </Border.Background> </Border> <TextBlock Margin="30 0 0 0" FontSize="{StaticResource TangoTitleFontSize}"> @@ -164,17 +147,6 @@ <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Grid Height="40"> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> - </Grid> - </DataTemplate> - </Setter.Value> - </Setter> - </DataTrigger> </Style.Triggers> </Style> </ContentControl.Style> @@ -200,10 +172,7 @@ </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 0 -130 0" HorizontalAlignment="Right" VerticalAlignment="Top"> - <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> - <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> - </StackPanel> + <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> </StackPanel> </Grid> @@ -245,11 +214,7 @@ </Style.Triggers> </Style> </DockPanel.Style> - - <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> - <Border.Background> - <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" /> - </Border.Background> + <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> <Border.Style> <Style TargetType="Border"> <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> @@ -268,26 +233,6 @@ </Style.Triggers> </Style> </Border.Style> - <Border Background="{Binding SegmentBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> - </DataTrigger> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> - </MultiDataTrigger.Conditions> - <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Border.Style> - </Border> </Border> <Grid> @@ -302,90 +247,77 @@ </TextBlock> </StackPanel> - <Grid> - <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> - <DockPanel LastChildFill="False"> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Visibility" Value="Visible"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </DockPanel.Style> - <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <DockPanel LastChildFill="False"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> - <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> - <StackPanel> - <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> + <StackPanel> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> - </DataTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> - <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> - <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> - <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> - <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> - <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Grid Height="40"> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> - </Grid> - </DataTemplate> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - </Grid> - </DockPanel> - <Canvas> - <Canvas.Style> - <Style TargetType="Canvas"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> - <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Canvas.Style> - <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> - </Canvas> - <DockPanel LastChildFill="False" Margin="0 20 0 0"> - <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> - <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> - </StackPanel> - </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> + <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </Grid> + </DockPanel> + <Canvas> + <Canvas.Style> + <Style TargetType="Canvas"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Canvas.Style> + <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> + </Canvas> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> + </StackPanel> </DockPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> @@ -402,27 +334,23 @@ </TextBlock.Style> </TextBlock> - <StackPanel Orientation="Horizontal"> - <StackPanel.Style> - <Style TargetType="StackPanel"> + <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"> + <touch:TouchImageButton.Style> + <Style TargetType="{x:Type touch:TouchImageButton}" BasedOn="{StaticResource {x:Type touch:TouchImageButton}}"> <Setter Property="Visibility" Value="Collapsed"></Setter> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True}" Value="False" /> <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" /> <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Visibility" Value="Visible"></Setter> </MultiDataTrigger> </Style.Triggers> </Style> - </StackPanel.Style> - - <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> - - <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> - </StackPanel> + </touch:TouchImageButton.Style> + </touch:TouchImageButton> <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal"> @@ -526,9 +454,9 @@ <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> <TextBlock>Comment:</TextBlock> - <touch:TouchMultiLineTextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" Height="60" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> + <TextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" FocusVisualStyle="{x:Null}" BorderBrush="{StaticResource TangoDividerBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" AcceptsReturn="True" TextWrapping="Wrap" Height="60" Padding="5" keyboard:KeyboardView.Container="{Binding ElementName=Container}" keyboard:KeyboardView.Mode="AlphaNumeric"> - </touch:TouchMultiLineTextBox> + </TextBox> </controls:TableGrid> <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> @@ -631,6 +559,7 @@ <touch:TouchToggleImageButton x:Name="toggleEdit" UncheckedImage="../Images/pencil-gray.png" CheckedImage="../Images/pencil-blue.png" DockPanel.Dock="Right" + IsChecked="{Binding IsSelected}" Padding="8" CornerRadius="30" Width="40" Height="40"> </touch:TouchToggleImageButton> <!--<touch:TouchToggleIconButton x:Name="toggleEdit" DockPanel.Dock="Right" Icon="Pencil" CheckedIcon="Pencil" Padding="8" CornerRadius="20" />--> @@ -718,61 +647,63 @@ </touch:TouchDropShadowBorder> </touch:TouchVirtualizedContentControl> - <touch:TouchDropShadowBorder Padding="0 20 0 50" Margin="0 0 0 15"> - <StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <Image Source="../Images/JobView/job-summary.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> - </StackPanel> + <touch:TouchVirtualizedContentControl Margin="0 20 0 0" > + <touch:TouchDropShadowBorder Padding="0 0 0 50"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/JobView/job-summary.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> + </StackPanel> - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> - <Grid> - <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/> - </Grid> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <Grid> + <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/> + </Grid> - <DockPanel Margin="0 30 0 0" LastChildFill="False"> + <DockPanel Margin="0 30 0 0" LastChildFill="False"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> - <TextBlock> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> + <TextBlock> <Run Text="Job length (m):"></Run> <Run Text="{Binding Job.Length,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> + </TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run>(</Run><Run Text="{Binding Job.Length,Mode=OneWay}"></Run><Run>+</Run><Run Text="{Binding Job.LengthPercentageFactor,Mode=OneWay}"></Run><Run>%</Run><Run>)</Run> - </TextBlock> - </StackPanel> + </TextBlock> + </StackPanel> - <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> - <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> + <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> <Run Text="Factor: +"></Run> - </TextBlock> + </TextBlock> - <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> - <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> - </StackPanel> - </DockPanel> + <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> + </StackPanel> + </DockPanel> + </StackPanel> </StackPanel> - </StackPanel> - </touch:TouchDropShadowBorder> + </touch:TouchDropShadowBorder> + </touch:TouchVirtualizedContentControl> - <StackPanel Visibility="Collapsed" HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <StackPanel HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Additional Tools</TextBlock> </StackPanel> - <!--<touch:TouchVirtualizedContentControl> + <touch:TouchVirtualizedContentControl> <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 0" Padding="20 15"> <touch:TouchExpander.Header> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> @@ -940,7 +871,7 @@ </touch:TouchVirtualizedContentControl> <touch:TouchVirtualizedContentControl> - <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},ConverterParameter='RGB,LAB'}"> + <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}"> <touch:TouchExpander.Header> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> <Image Source="../Images/JobView/color-fine-tuning.png" Width="39" /> @@ -1171,7 +1102,7 @@ </ContentControl> </StackPanel> </touch:TouchExpander> - </touch:TouchVirtualizedContentControl>--> + </touch:TouchVirtualizedContentControl> </StackPanel> </StackPanel> </touch:LightTouchScrollViewer> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs index 86a8d2a37..880aa8a3a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs @@ -54,16 +54,16 @@ namespace Tango.PPC.Jobs.Views public async void DisplaySampleDye() { - //expander_sample_dye.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_sample_dye); + expander_sample_dye.IsExpanded = true; + await Task.Delay(500); + scrollViewer.ScrollToElement(expander_sample_dye); } public async void DisplayFineTuning() { - //expander_fine_tuning.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_fine_tuning); + expander_fine_tuning.IsExpanded = true; + await Task.Delay(500); + scrollViewer.ScrollToElement(expander_fine_tuning); } public void OnNavigatedFrom() @@ -94,10 +94,6 @@ namespace Tango.PPC.Jobs.Views borderEditDock.Visibility = Visibility.Collapsed; } } - else if (_is_edit_docked) - { - FloatEditing(); - } } private void DockEditing() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index 94abe6b83..c615583bc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -214,14 +214,14 @@ <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Name,Converter={StaticResource StringEllipsisConverter},ConverterParameter='40'}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -235,7 +235,7 @@ <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -314,21 +314,21 @@ <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter},IsAsync=True}" HorizontalAlignment="Left" VerticalAlignment="Center"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Name,Converter={StaticResource StringEllipsisConverter},ConverterParameter='40'}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}" HorizontalAlignment="Left" VerticalAlignment="Center"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -342,7 +342,7 @@ <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> |
