diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-12-20 15:15:37 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-12-20 15:15:37 +0200 |
| commit | 35dfed5a480f1e2316f5e4eaf5e284697679e408 (patch) | |
| tree | e8612de59ccca47bb12780f63d9aef814c3a3bd7 /Software/Visual_Studio/PPC | |
| parent | 392131c3594c2a73a1bd961eadd2ab44fa85aa8b (diff) | |
| parent | f67b8d11029ce185b4f13ec0fd866bfe4380be7d (diff) | |
| download | Tango-35dfed5a480f1e2316f5e4eaf5e284697679e408.tar.gz Tango-35dfed5a480f1e2316f5e4eaf5e284697679e408.zip | |
Merged Jobs V2
Diffstat (limited to 'Software/Visual_Studio/PPC')
215 files changed, 14457 insertions, 35 deletions
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 94c504908..48d609a1a 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 @@ -605,6 +605,7 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; + Job.Version = 1; Job.IsSynchronized = false; Job.JobStatus = BL.Enumerations.JobStatuses.Draft; Job.MarkModified(_db); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/App.xaml new file mode 100644 index 000000000..c8281a6e6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.Jobs.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItem.cs new file mode 100644 index 000000000..c43448a82 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItem.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppBarItems +{ + /// <summary> + /// Represents a job progress <see cref="AppBarItem"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.Notifications.AppBarItem" /> + public class JobProgressAppBarItem : AppBarItem + { + /// <summary> + /// Gets or sets the machine provider. + /// </summary> + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="JobProgressAppBarItem"/> class. + /// </summary> + public JobProgressAppBarItem() + { + TangoIOC.Default.Inject(this); + } + + /// <summary> + /// Gets or sets the view type. + /// </summary> + public override Type ViewType + { + get + { + return typeof(JobProgressAppBarItemView); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml new file mode 100644 index 000000000..16c6a42be --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="Tango.PPC.Jobs.AppBarItems.JobProgressAppBarItemView" + 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.AppBarItems" + 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> + <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"> + <Run>Completed</Run> + <Run Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.ProgressMinusSettingUp,StringFormat=0}"></Run><Run>/</Run><Run Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.TotalProgressMinusSettingUp,StringFormat=0}"></Run><Run>m</Run> + </TextBlock> + + <TextBlock DockPanel.Dock="Right"> + <Run Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run> + <Run FontSize="16" Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run> + </TextBlock> + </DockPanel> + </StackPanel> + </touch:TouchButton> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml.cs new file mode 100644 index 000000000..f0ba3b77d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppBarItems/JobProgressAppBarItemView.xaml.cs @@ -0,0 +1,30 @@ +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.AppBarItems +{ + /// <summary> + /// Represents the <see cref="JobProgressAppBarItem"/> view. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class JobProgressAppBarItemView : UserControl + { + public JobProgressAppBarItemView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StartPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StartPrintingButton.cs new file mode 100644 index 000000000..4d6050639 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StartPrintingButton.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppButtons +{ + public class StartPrintingButton : AppButton + { + public StartPrintingButton(RelayCommand command, IMachineOperator op) : base("DYE", command) + { + op.StatusChanged += Op_StatusChanged; + + Op_StatusChanged(op, op.Status); + } + + private void Op_StatusChanged(object sender, MachineStatuses status) + { + IsEnabled = (sender as IMachineOperator).CanPrint; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StopPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StopPrintingButton.cs new file mode 100644 index 000000000..d9ef86861 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/AppButtons/StopPrintingButton.cs @@ -0,0 +1,17 @@ +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.AppButtons +{ + public class StopPrintingButton : AppButton + { + public StopPrintingButton() : base("STOP", true) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobOutlineControl.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobOutlineControl.cs new file mode 100644 index 000000000..385f488ba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobOutlineControl.cs @@ -0,0 +1,326 @@ +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() + { + 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 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; + _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.BtsrParameters + if (job.BtsrParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "BTSR PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.BtsrParameters); + 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.JobsV2/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml new file mode 100644 index 000000000..8c84777a3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml @@ -0,0 +1,120 @@ +<UserControl x:Class="Tango.PPC.Jobs.Controls.JobSummeryViewer" + 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" + mc:Ignorable="d" + d:DesignHeight="60" d:DesignWidth="500" Height="38" x:Name="control"> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=JobModel.EffectiveSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid x:Name="grid"> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="JobModel.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithInterSegment"></Binding> + </MultiBinding> + </Grid.Width> + + <DockPanel HorizontalAlignment="Center" TextElement.FontSize="{StaticResource TangoSmallFontSize}"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=grid,Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <controls:FastTextBlock Text="{Binding LengthWithInterSegment,Mode=OneWay,StringFormat=N0}" /> + <controls:FastTextBlock Text="m" /> + </DockPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0"> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="brush_border" Path="ActualWidth" /> + <Binding ElementName="brush_border" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=JobModel.EffectiveSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="JobModel.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithInterSegment"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" /> + </Grid> + </Border> + </Grid> + + <Grid Grid.Column="1" VerticalAlignment="Bottom"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding ElementName=control,Path=JobModel.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> + <Condition Binding="{Binding ElementName=control,Path=IsActive}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <Run Text="x"></Run><Run Text="{Binding ElementName=control,Path=JobModel.NumberOfUnits}"></Run> + </TextBlock> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml.cs new file mode 100644 index 000000000..121be0477 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml.cs @@ -0,0 +1,69 @@ +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; +using Tango.BL.Entities; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.Controls +{ + /// <summary> + /// Represents a <see cref="Job"/> summary viewer control. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class JobSummeryViewer : UserControl + { + + /// <summary> + /// Gets or sets the job. + /// </summary> + public JobModel JobModel + { + get { return (JobModel)GetValue(JobProperty); } + set { SetValue(JobProperty, value); } + } + public static readonly DependencyProperty JobProperty = + DependencyProperty.Register("JobModel", typeof(JobModel), typeof(JobSummeryViewer), new PropertyMetadata(null)); + + /// <summary> + /// Maybe not necessary! + /// </summary> + public bool IsActive + { + get { return (bool)GetValue(IsActiveProperty); } + set { SetValue(IsActiveProperty, value); } + } + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register("IsActive", typeof(bool), typeof(JobSummeryViewer), new PropertyMetadata(false)); + + /// <summary> + /// Gets or sets a value indicating whether to display summery markers. + /// </summary> + public bool DisplayMarkers + { + get { return (bool)GetValue(DisplayMarkersProperty); } + set { SetValue(DisplayMarkersProperty, value); } + } + public static readonly DependencyProperty DisplayMarkersProperty = + DependencyProperty.Register("DisplayMarkers", typeof(bool), typeof(JobSummeryViewer), new PropertyMetadata(true)); + + /// <summary> + /// Initializes a new instance of the <see cref="JobSummeryViewer"/> class. + /// </summary> + public JobSummeryViewer() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml new file mode 100644 index 000000000..5d3f3f1fc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml @@ -0,0 +1,122 @@ +<UserControl x:Class="Tango.PPC.Jobs.Controls.RunningJobViewer" + 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:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:operation="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" + mc:Ignorable="d" + d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewer, IsDesignTimeCreatable=False}"> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewer},Path=RunningJobStatus.CurrentUnitSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> + + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> + </TextBlock> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0"> + <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> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="brush_border" Path="ActualWidth" /> + <Binding ElementName="brush_border" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewer},Path=RunningJobStatus.CurrentUnitSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" /> + </Grid> + </Border> + </Grid> + + <Grid Grid.Column="1" VerticalAlignment="Bottom"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewer},Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewer},Path=IsActive}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <Run Text="x"></Run><Run Text="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewer},Path=Job.NumberOfUnits}"></Run> + </TextBlock> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml.cs new file mode 100644 index 000000000..133a60bbd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/RunningJobViewer.xaml.cs @@ -0,0 +1,79 @@ +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; +using Tango.BL.Entities; +using Tango.Integration.Operation; + +namespace Tango.PPC.Jobs.Controls +{ + /// <summary> + /// Represents a running <see cref="Job"/> viewer control. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class RunningJobViewer : UserControl + { + /// <summary> + /// Maybe not necessary! + /// </summary> + public bool IsActive + { + get { return (bool)GetValue(IsActiveProperty); } + set { SetValue(IsActiveProperty, value); } + } + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register("IsActive", typeof(bool), typeof(RunningJobViewer), new PropertyMetadata(false)); + + /// <summary> + /// Gets or sets a value indicating whether summary markers. + /// </summary> + public bool DisplayMarkers + { + get { return (bool)GetValue(DisplayMarkersProperty); } + set { SetValue(DisplayMarkersProperty, value); } + } + public static readonly DependencyProperty DisplayMarkersProperty = + DependencyProperty.Register("DisplayMarkers", typeof(bool), typeof(RunningJobViewer), new PropertyMetadata(true)); + + /// <summary> + /// Gets or sets the job. + /// </summary> + public Job Job + { + get { return (Job)GetValue(JobProperty); } + set { SetValue(JobProperty, value); } + } + public static readonly DependencyProperty JobProperty = + DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewer), new PropertyMetadata(null)); + + /// <summary> + /// Gets or sets the running job status. + /// </summary> + public RunningJobStatus RunningJobStatus + { + get { return (RunningJobStatus)GetValue(RunningJobStatusProperty); } + set { SetValue(RunningJobStatusProperty, value); } + } + public static readonly DependencyProperty RunningJobStatusProperty = + DependencyProperty.Register("RunningJobStatus", typeof(RunningJobStatus), typeof(RunningJobViewer), new PropertyMetadata(null)); + + /// <summary> + /// Initializes a new instance of the <see cref="RunningJobViewer"/> class. + /// </summary> + public RunningJobViewer() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml new file mode 100644 index 000000000..3097121a6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml @@ -0,0 +1,20 @@ +<UserControl x:Class="Tango.PPC.Jobs.Controls.TwineCatalogViewer" + 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:controls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="300"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <controls:TwineCatalogControl x:Name="catalogControl" DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=Catalog,Mode=TwoWay}" + SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=SelectedItem,Mode=TwoWay}" + CollectionFilter ="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=CollectionFilter,Mode=TwoWay}"/> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs new file mode 100644 index 000000000..d71fa66ff --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs @@ -0,0 +1,114 @@ +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; +using Tango.BL.Entities; +using Tango.Touch.Components; + +namespace Tango.PPC.Jobs.Controls +{ + /// <summary> + /// Represents a twine <see cref="Catalog"/> viewer control. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class TwineCatalogViewer : UserControl + { + private ColorCatalog _originalCatalog; + + /// <summary> + /// Gets or sets the recent catalog items as a catalog. + /// </summary> + public ColorCatalog Recent + { + get { return (ColorCatalog)GetValue(RecentProperty); } + set { SetValue(RecentProperty, value); } + } + public static readonly DependencyProperty RecentProperty = + DependencyProperty.Register("Recent", typeof(ColorCatalog), typeof(TwineCatalogViewer), new PropertyMetadata(null)); + + /// <summary> + /// Gets or sets the catalog. + /// </summary> + public ColorCatalog Catalog + { + get { return (ColorCatalog)GetValue(CatalogProperty); } + set { SetValue(CatalogProperty, value); } + } + public static readonly DependencyProperty CatalogProperty = + DependencyProperty.Register("Catalog", typeof(ColorCatalog), typeof(TwineCatalogViewer), new PropertyMetadata(null)); + + /// <summary> + /// Gets or sets the selected catalog item. + /// </summary> + public ColorCatalogsItem SelectedItem + { + get { return (ColorCatalogsItem)GetValue(SelectedItemProperty); } + set { SetValue(SelectedItemProperty, value); } + } + public static readonly DependencyProperty SelectedItemProperty = + DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogViewer), new PropertyMetadata(null)); + + /// <summary> + /// Gets or sets the current catalog filter. + /// </summary> + public String Filter + { + get { return (String)GetValue(FilterProperty); } + set { SetValue(FilterProperty, value); } + } + public static readonly DependencyProperty FilterProperty = + DependencyProperty.Register("Filter", typeof(String), typeof(TwineCatalogViewer), new PropertyMetadata(null,(d,e) => (d as TwineCatalogViewer).OnFilterChanged())); + + /// <summary> + /// Gets or sets the collection filter. + /// </summary> + public ICollectionFilter CollectionFilter + { + get { return (ICollectionFilter)GetValue(CollectionFilterProperty); } + set { SetValue(CollectionFilterProperty, value); } + } + public static readonly DependencyProperty CollectionFilterProperty = + DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(TwineCatalogViewer), new PropertyMetadata(null, (d, e) => (d as TwineCatalogViewer).OnCollectionFilterChanged())); + + private void OnCollectionFilterChanged() + { + + } + /// <summary> + /// Called when the filter has been changed + /// </summary> + private void OnFilterChanged() + { + if (Filter == "CATALOG" && _originalCatalog != null) + { + Catalog = _originalCatalog; + _originalCatalog = null; + } + else if (Filter == "RECENT") + { + _originalCatalog = Catalog; + Catalog = Recent; + } + } + + /// <summary> + /// Initializes a new instance of the <see cref="TwineCatalogViewer"/> class. + /// </summary> + public TwineCatalogViewer() + { + InitializeComponent(); + Filter = "CATALOG"; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToImageConverter.cs new file mode 100644 index 000000000..f10bf0064 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToImageConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Enumerations; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Jobs.Converters +{ + public class ColorSpaceToImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + ColorSpaces colorSpace = (ColorSpaces)value; + + switch (colorSpace) + { + case ColorSpaces.RGB: + return ResourceHelper.GetImageFromResources("Images/NewJob/rgb.png"); + case ColorSpaces.LAB: + return ResourceHelper.GetImageFromResources("Images/NewJob/lab.png"); + case ColorSpaces.Catalog: + return ResourceHelper.GetImageFromResources("Images/NewJob/twine.png"); + case ColorSpaces.Volume: + return ResourceHelper.GetImageFromResources("Images/NewJob/volume.png"); + default: + return ResourceHelper.GetImageFromResources("Images/NewJob/coats.png"); + } + } + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToVisibilityConverter.cs new file mode 100644 index 000000000..b1be93793 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorSpaceToVisibilityConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.Converters +{ + public class ColorSpaceToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ColorSpace colorSpace = value as ColorSpace; + + if (colorSpace != null) + { + if (String.IsNullOrWhiteSpace(parameter.ToStringSafe())) + { + 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.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorTabToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorTabToVisibilityConverter.cs new file mode 100644 index 000000000..6f9a95ccf --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/ColorTabToVisibilityConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using static Tango.PPC.Jobs.Dialogs.ColorSelectionViewVM; + +namespace Tango.PPC.Jobs.Converters +{ + public class ColorTabToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ColorTab selected = (ColorTab)Enum.Parse(typeof(ColorTab), parameter.ToString()); + ColorTab colorTab = (ColorTab)value; + + return colorTab.Equals(selected) ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobProgressToPositionConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobProgressToPositionConverter.cs new file mode 100644 index 000000000..3ecc3276a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobProgressToPositionConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.PPC.Jobs.Converters +{ + /// <summary> + /// Converts a job progress to X position using the specified UI element width. + /// </summary> + /// <seealso cref="System.Windows.Data.IMultiValueConverter" /> + public class JobProgressToPositionConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values.Length == 3 && values[1] != DependencyProperty.UnsetValue) + { + double progress = (double)values[0]; + double total = (double)values[1]; + double ui_width = (double)values[2]; + return (progress / total) * ui_width; + } + + return 0d; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToEmbroideryImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToEmbroideryImageConverter.cs new file mode 100644 index 000000000..fce5bedf6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToEmbroideryImageConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobToEmbroideryImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Job job = value as Job; + + if (job != null && job.EmbroideryFileData != null) + { + try + { + return job.EmbroideryJpeg.ToBitmapSource(); + } + catch + { + return null; + } + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToPieImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToPieImageConverter.cs new file mode 100644 index 000000000..4c1a27822 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobToPieImageConverter.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; +using System.Media; + +namespace Tango.PPC.Jobs.Converters +{ + /// <summary> + /// Converts a job to <see cref="BitmapSource"/> representing the job segments as a pie chart. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> + public class JobToPieImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Job job = value as Job; + + if (job != null) + { + String[] param = parameter.ToString().Split(','); + double width = double.Parse(param[0]); + double height = double.Parse(param[1]); + return job.CreateSegmentsPie(width, height); + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobTypeToImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobTypeToImageConverter.cs new file mode 100644 index 000000000..aaa6a5bf2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobTypeToImageConverter.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Enumerations; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobTypeToImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobTypes jobType = (JobTypes)value; + + switch (jobType) + { + case JobTypes.Embroidery: + return ResourceHelper.GetImageFromResources("Images/Embroidery.png"); + case JobTypes.Sewing: + return ResourceHelper.GetImageFromResources("Images/Sewing.png"); + case JobTypes.Knitting: + return ResourceHelper.GetImageFromResources("Images/Knitting.png"); + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToOpacityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToOpacityConverter.cs new file mode 100644 index 000000000..0eaad280a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToOpacityConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using static Tango.PPC.Jobs.ViewModels.JobsViewVM; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobsCategoryToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobsCategory selected = (JobsCategory)Enum.Parse(typeof(JobsCategory), parameter.ToString()); + JobsCategory category = (JobsCategory)value; + + return category.Equals(selected) ? 1 : 0; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToVisibilityConverter.cs new file mode 100644 index 000000000..e602a99fc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/JobsCategoryToVisibilityConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using static Tango.PPC.Jobs.ViewModels.JobsViewVM; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobsCategoryToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobsCategory selected = (JobsCategory)Enum.Parse(typeof(JobsCategory), parameter.ToString()); + JobsCategory category = (JobsCategory)value; + + return category.Equals(selected) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml new file mode 100644 index 000000000..146ca4339 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml @@ -0,0 +1,30 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.AddSegmentWarningDialog" + 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.Dialogs" + mc:Ignorable="d" + Background="Transparent" d:DesignHeight="630" d:DesignWidth="560" Width="480" Height="250" + d:DataContext="{d:DesignInstance Type=local:AddSegmentWarningDialogVM, IsDesignTimeCreatable=False}"> + <Border BorderBrush="{StaticResource TangoMidAccentBrush}" Margin="-24" CornerRadius="40" BorderThickness="2" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <DockPanel VerticalAlignment="Top" Margin="0 16 18 18" Grid.Row="0"> + <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="28" Command="{Binding CloseCommand}" Icon="CloseCircleOutline" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Right" /> + </DockPanel> + + <TextBlock Grid.Row="1" Height="Auto" Margin="50 20 50 10" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center" TextWrapping="Wrap">Please note that gradient segment is now split into two gradients</TextBlock> + + <touch:TouchCheckBox VerticalAlignment="Bottom" Grid.Row="2" Margin="50 10 0 40" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" IsChecked="{Binding NotShow}" >Do not show again</touch:TouchCheckBox> + + </Grid> + </Border> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml.cs new file mode 100644 index 000000000..a5dcc6ba3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialog.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for AddSegmentWarningDialog.xaml + /// </summary> + public partial class AddSegmentWarningDialog : UserControl + { + public AddSegmentWarningDialog() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialogVM.cs new file mode 100644 index 000000000..d0901be21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AddSegmentWarningDialogVM.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class AddSegmentWarningDialogVM : DialogViewVM + { + private bool _notShow; + + public bool NotShow + { + get { return _notShow; } + set + { + _notShow = value; + RaisePropertyChangedAuto(); + } + } + + public AddSegmentWarningDialogVM() + { + _notShow = false; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml new file mode 100644 index 000000000..da6989ff6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml @@ -0,0 +1,178 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.AdvancedColorCorrectionView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" + xmlns:pmr="clr-namespace:Tango.PMR.ColorLab;assembly=Tango.PMR" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="630" d:DesignWidth="560" MinWidth="560" Height="700" d:DataContext="{d:DesignInstance Type=local:AdvancedColorCorrectionViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <Grid Margin="20"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="100"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="80"/> + </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> + + <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}}" /> + <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> + + <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> + <Style TargetType="ListBoxItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Grid.Column" Value="{Binding Path=Column}"></Setter> + <Setter Property="Grid.Row" Value="{Binding Path=Row}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <Grid Margin="10" RenderTransformOrigin="0.5,0.5"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect Color="{StaticResource TangoDarkForegroundColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Ellipse Fill="{Binding Brush}"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding DisplayIndices,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Run Text="{Binding Column}"></Run><Run>,</Run> + <Run Text="{Binding Row}"></Run> + </TextBlock> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </hive:HexList.ItemContainerStyle> + </hive:HexList> + </DockPanel> + + <DockPanel Grid.Row="3" Margin="40 10 20 0" LastChildFill="False"> + <touch:TouchButton Visibility="Collapsed" Command="{Binding MoreOptionsCommand}" VerticalAlignment="Top" Style="{StaticResource TangoLinkButton}" DockPanel.Dock="Left" Foreground="{StaticResource TangoPrimaryAccentBrush}"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/JobView/twine-catalog.png" Stretch="None" /> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Bottom">Twine Catalog</TextBlock> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" DockPanel.Dock="Right" Width="170" Height="50" VerticalAlignment="Bottom"> + OK + </touch:TouchButton> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml.cs new file mode 100644 index 000000000..68e53d7af --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionView.xaml.cs @@ -0,0 +1,30 @@ +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.Dialogs +{ + /// <summary> + /// Represents the Hive color correction dialog. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class AdvancedColorCorrectionView : UserControl + { + public AdvancedColorCorrectionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionViewVM.cs new file mode 100644 index 000000000..db8573322 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/AdvancedColorCorrectionViewVM.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.ColorLab; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the Hive color correction ViewModel. + /// </summary> + /// <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.JobsV2/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionView.xaml new file mode 100644 index 000000000..bd31b88ce --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionView.xaml @@ -0,0 +1,162 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.BasicColorCorrectionView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:pmr="clr-namespace:Tango.PMR.ColorLab;assembly=Tango.PMR" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" MinWidth="560" Height="570" d:DataContext="{d:DesignInstance Type=local:BasicColorCorrectionViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <Grid Margin="20"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="100"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="80"/> + </Grid.RowDefinitions> + + <Grid> + <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" /> + <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> + </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> + + <touch:TouchListBox SelectionMode="Single" Style="{StaticResource TangoNoRippleListBox}" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}" Margin="0 20 0 0"> + <touch:TouchListBox.ItemContainerStyle> + <Style TargetType="touch:TouchListBoxItem"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Margin" Value="0 10"></Setter> + </Style> + </touch:TouchListBox.ItemContainerStyle> + <touch:TouchListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Ellipse Width="60" Height="60" Margin="40 0 0 0" Fill="{Binding Brush}" RenderTransformOrigin="0.5,0.5"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect Color="{StaticResource TangoGrayColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchListBoxItem},Path=IsSelected}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InvalidBrushStop.BrushColorSpace}" Value="RGB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + <Run Text="{Binding Coordinates.Red}"></Run><Run>,</Run> + <Run Text="{Binding Coordinates.Green}"></Run><Run>,</Run> + <Run Text="{Binding Coordinates.Blue}"></Run> + </TextBlock> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InvalidBrushStop.BrushColorSpace}" Value="LAB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + <Run Text="{Binding Coordinates.L,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding Coordinates.A,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding Coordinates.B,StringFormat=0.00}"></Run> + </TextBlock> + </StackPanel> + </DataTemplate> + </touch:TouchListBox.ItemTemplate> + </touch:TouchListBox> + </DockPanel> + + <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> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" DockPanel.Dock="Right" Width="170" Height="50" VerticalAlignment="Bottom"> + OK + </touch:TouchButton> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionView.xaml.cs new file mode 100644 index 000000000..96744ccb3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionView.xaml.cs @@ -0,0 +1,33 @@ +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.Dialogs +{ + /// <summary> + /// Represents the Triplet color conversion dialog. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class BasicColorCorrectionView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="BasicColorCorrectionView"/> class. + /// </summary> + public BasicColorCorrectionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionViewVM.cs new file mode 100644 index 000000000..a6ffb57c3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/BasicColorCorrectionViewVM.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.ColorConversion; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the triplet color conversion dialog ViewModel. + /// </summary> + /// <seealso cref="Tango.SharedUI.DialogViewVM" /> + public class BasicColorCorrectionViewVM : DialogViewVM + { + private bool _moreOptions; + + /// <summary> + /// Represents a color conversion dialog result. + /// </summary> + public enum ColorCorrectionDialogResult + { + None, + Confirmed, + MoreOptions, + } + + /// <summary> + /// Gets or sets the invalid brush stop (out of gamut). + /// </summary> + public BrushStop InvalidBrushStop { get; set; } + + /// <summary> + /// Gets the dialog result. + /// </summary> + public ColorCorrectionDialogResult Result { get; private set; } + + /// <summary> + /// Gets or sets the suggestions. + /// </summary> + public List<ColorConversionSuggestion> Suggestions { get; set; } + + + private ColorConversionSuggestion _selectedSuggestion; + /// <summary> + /// Gets or sets the selected suggestion. + /// </summary> + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the more options command. + /// </summary> + public RelayCommand MoreOptionsCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="BasicColorCorrectionViewVM"/> class. + /// </summary> + public BasicColorCorrectionViewVM() + { + MoreOptionsCommand = new RelayCommand(() => + { + _moreOptions = true; + Accept(); + }); + } + + /// <summary> + /// Invokes the <see cref="E:Tango.SharedUI.DialogViewVM.Accepted" /> event. + /// </summary> + protected override void Accept() + { + Result = _moreOptions ? ColorCorrectionDialogResult.MoreOptions : ColorCorrectionDialogResult.Confirmed; + base.Accept(); + } + + /// <summary> + /// Invokes the <see cref="E:Tango.SharedUI.DialogViewVM.Canceled" /> event. + /// </summary> + protected override void Cancel() + { + Result = ColorCorrectionDialogResult.None; + base.Cancel(); + } + + /// <summary> + /// Called when the dialog has been shown. + /// </summary> + public override void OnShow() + { + base.OnShow(); + SelectedSuggestion = Suggestions.GetCenterSuggestion(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml new file mode 100644 index 000000000..586325515 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml @@ -0,0 +1,71 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.CatalogSelectionView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:CatalogSelectionViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> + <converters:ColorSpaceToImageConverter x:Key="ColorSpaceToImageConverter" /> + + </UserControl.Resources> + + <Grid Margin="20"> + + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CREATE</touch:TouchButton> + </Grid> + + <StackPanel DockPanel.Dock="Top"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Select Catalog</TextBlock> + <TextBlock Margin="0 30 100 0" HorizontalAlignment="Left" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}">Please select the desired color catalog and press 'create'.</TextBlock> + </StackPanel> + + <touch:LightTouchScrollViewer Margin="0 20 0 0"> + <touch:TouchStaticListBox Margin="20 0 20 20" HorizontalAlignment="Center" Width="480" ItemsSource="{Binding Catalogs}" SelectedItem="{Binding SelectedCatalog,Mode=TwoWay}"> + <touch:TouchStaticListBox.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </touch:TouchStaticListBox.ItemsPanel> + <touch:TouchStaticListBox.ItemContainerStyle> + <Style TargetType="touch:TouchStaticListBoxItem"> + <Setter Property="BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Padding" Value="0 10"></Setter> + <Setter Property="Margin" Value="25"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Width" Value="110"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderThickness" Value="2"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchStaticListBox.ItemContainerStyle> + <touch:TouchStaticListBox.ItemTemplate> + <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> + </StackPanel> + </DataTemplate> + </touch:TouchStaticListBox.ItemTemplate> + </touch:TouchStaticListBox> + </touch:LightTouchScrollViewer> + </DockPanel> + </Grid> +</UserControl> + + +
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml.cs new file mode 100644 index 000000000..65d03e531 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionView.xaml.cs @@ -0,0 +1,34 @@ +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; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the new job creation dialog. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class CatalogSelectionView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="CatalogSelectionView"/> class. + /// </summary> + public CatalogSelectionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionViewVM.cs new file mode 100644 index 000000000..0c4cd72f6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/CatalogSelectionViewVM.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents a catalog picker. + /// </summary> + /// <seealso cref="Tango.SharedUI.DialogViewVM" /> + public class CatalogSelectionViewVM : DialogViewVM + { + + private ObservableCollection<ColorCatalog> _catalogs; + /// <summary> + /// Gets or sets the catalogs. + /// </summary> + public ObservableCollection<ColorCatalog> Catalogs + { + get { return _catalogs; } + set { _catalogs = value; RaisePropertyChangedAuto(); } + } + + private ColorCatalog _selectedCatalog; + /// <summary> + /// Gets or sets the selected catalog. + /// </summary> + public ColorCatalog SelectedCatalog + { + get { return _selectedCatalog; } + set { _selectedCatalog = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="CatalogSelectionViewVM"/> class. + /// </summary> + /// <param name="catalogs">The catalogs.</param> + /// <param name="selectedCatalog">The selected catalog.</param> + public CatalogSelectionViewVM(List<ColorCatalog> catalogs, ColorCatalog selectedCatalog) : base() + { + Catalogs = catalogs.ToObservableCollection(); + SelectedCatalog = selectedCatalog; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml new file mode 100644 index 000000000..bc6534596 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml @@ -0,0 +1,41 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ColorProfileReceivedView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ColorProfileReceivedViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">DECLINE</touch:TouchButton> + + <Grid HorizontalAlignment="Center"> + <touch:TouchRingProgress Width="50" Height="50" Maximum="{Binding MaxSeconds}" Value="{Binding SecondsRemaining}" /> + <TextBlock Text="{Binding SecondsRemaining}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Grid> + + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">APPROVE</touch:TouchButton> + </Grid> + <StackPanel DockPanel.Dock="Top"> + <Image Source="../Images/snapmatch.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">New SnapMatch Color</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + A SnapMatch user is trying to send you a color detection result. Press 'Approve' to create a new job from this color. + </TextBlock> + </StackPanel> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}">Detected Color</TextBlock> + <Ellipse Width="100" Height="100" Margin="0 20 0 0"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + </StackPanel> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml.cs new file mode 100644 index 000000000..66ed6e334 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for ImportJobView.xaml + /// </summary> + public partial class ColorProfileReceivedView : UserControl + { + public ColorProfileReceivedView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedViewVM.cs new file mode 100644 index 000000000..1386acb93 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorProfileReceivedViewVM.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ColorProfileReceivedViewVM : DialogViewVM + { + private DispatcherTimer _timer; + + public Color Color { get; set; } + + private int _maxSeconds; + public int MaxSeconds + { + get { return _maxSeconds; } + set { _maxSeconds = value; RaisePropertyChangedAuto(); } + } + + private int _secondsRemaining; + public int SecondsRemaining + { + get { return _secondsRemaining; } + set { _secondsRemaining = value; RaisePropertyChangedAuto(); } + } + + public ColorProfileReceivedViewVM() + { + MaxSeconds = 10; + SecondsRemaining = 10; + + _timer = new DispatcherTimer(); + _timer.Interval = TimeSpan.FromMilliseconds(800); + _timer.Tick += _timer_Tick; + } + + public override void OnShow() + { + base.OnShow(); + _timer.Start(); + } + + protected override void Accept() + { + _timer.Stop(); + base.Accept(); + } + + protected override void Cancel() + { + _timer.Stop(); + base.Cancel(); + } + + private void _timer_Tick(object sender, EventArgs e) + { + SecondsRemaining--; + + if (SecondsRemaining == 0) + { + Cancel(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml new file mode 100644 index 000000000..abe89b0d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -0,0 +1,388 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ColorSelectionView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:vm="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + mc:Ignorable="d" + Background="{StaticResource TangoMidBackgroundBrush}" + d:DesignHeight="1280" d:DesignWidth="800" Width="750" Height="1200" + d:DataContext="{d:DesignInstance Type=vm:ColorSelectionViewVM, IsDesignTimeCreatable=False}"> + <UserControl.Resources> + + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Styles.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <converters:ColorTabToVisibilityConverter x:Key="ColorTabToVisibilityConverter" /> + <sharedConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <sharedConverters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter"/> + + <DataTemplate x:Key="brushColorPanel"> + <Grid Height="180" Margin="93 10 0 0" HorizontalAlignment="Stretch"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="270"/> + </Grid.ColumnDefinitions> + <StackPanel Orientation="Vertical" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock FontSize="{StaticResource TangoDataGridHeaderFontSize}" > + <Run Text="First Choice"></Run> + </TextBlock> + <Border Height="120" Margin="0 10 0 0" CornerRadius="20" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}" > + <Border.Background> + <SolidColorBrush Color="{Binding InitialBrushStop.Color}"/> + </Border.Background> + </Border> + </StackPanel> + <StackPanel Orientation="Vertical" Margin="0 0 0 0" > + <TextBlock FontSize="{StaticResource TangoDataGridHeaderFontSize}" HorizontalAlignment="Center" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <Run Text="First Choice - Segments "></Run> + <Run Text="{Binding SegmentIndex,Mode=OneWay}"/> + </TextBlock> + <TextBlock FontSize="{StaticResource TangoDataGridHeaderFontSize}" HorizontalAlignment="Center" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"> + <Run Text="Edited - Segments"></Run> + <Run Text="{Binding SegmentIndex,Mode=OneWay}"></Run> + </TextBlock> + <Border Height="120" CornerRadius="20" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.Background> + <SolidColorBrush Color="{Binding SelectedBrushStop.Color}"/> + </Border.Background> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Margin" Value="0 10 0 0"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsEditMode}" Value="True"> + <Setter Property="Margin" Value="130 10 0 0"/> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Grid> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding SelectedBrushStop.IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Image Margin="30 0 24 0" Stretch="Fill" Width="37" Height="33" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/Exclamation.png" HorizontalAlignment="Center"></Image> + <Border Margin=" 0 10 0 0" MinWidth="115" Height="31" Background="{StaticResource TangoDarkForegroundBrush}" CornerRadius="2"> + <TextBlock Margin="10 0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Text="This color is not supported." ></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding SelectedBrushStop.IsLiquidVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Image Margin="30 0 24 0" Stretch="Fill" Width="37" Height="33" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/Exclamation_black.png" HorizontalAlignment="Center"></Image> + <Border Margin=" 0 10 0 0" MinWidth="115" Height="31" Background="{StaticResource TangoDarkForegroundBrush}" CornerRadius="2"> + <TextBlock Margin="10 0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Text="Maximum ink level is reached." ></TextBlock> + </Border> + </StackPanel> + </Grid> + + </Border> + </StackPanel> + + <Grid x:Name="bestMatchPanel" Grid.Column="1" HorizontalAlignment="Stretch"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <!--<StackPanel x:Name="bestMatchPanel" Orientation="Horizontal" Grid.Column="1" Margin="30 0 0 0" HorizontalAlignment="Stretch" >--> + <Image Margin="30 0 0 0" Stretch="Fill" VerticalAlignment="Center" Width="20" Height="13" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/arrow-round-back.png"></Image> + + <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Stretch" Margin="26 0 93 0" > + <TextBlock Text="Best Match" FontSize="{StaticResource TangoDataGridHeaderFontSize}" HorizontalAlignment="Left"/> + <Border HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="100" Width="100" Margin="0 21 0 0" CornerRadius="20" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.Background> + <SolidColorBrush Color="{Binding SelectedBrushStop.BestMatchColor}"/> + </Border.Background> + + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding SelectedBrushStop.IsBusy,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchBusyIndicator HorizontalAlignment="Center" Minimum="0" Maximum="100" IsIndeterminate="True" Foreground="White" Width="32" Height="32" /> + <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoLightForegroundBrush}" Text="Processing..."></TextBlock> + </StackPanel> + </Border> + </StackPanel> + </Grid> + + <Canvas Grid.Column="1" Width="28" Height="28" VerticalAlignment="Top" HorizontalAlignment="Left"> + <touch:TouchButton Canvas.Left="0" Canvas.Top="0" x:Name="addmyColors" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> + <Border Height="26" Width="28" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/Heart.png"/> + </Border> + </touch:TouchButton> + </Canvas> + </Grid> + </DataTemplate> + + <DataTemplate x:Key="myColorsBtn"> + <touch:TouchButton x:Name="myColors" Margin="40 2 0 0" HorizontalAlignment="Left" FontWeight="Normal" FontSize="{StaticResource TangoDefaultFontSize}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Padding="10" Background="Transparent" BorderThickness="0"> + <Border Height="48" Width="160" CornerRadius="24" BorderThickness="0.8" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <StackPanel Orientation="Horizontal"> + <Image Margin="14 0 0 0" Stretch="Fill" Width="18" Height="17" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/Red_heart.png"></Image> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center" FontWeight="Normal" > My Colors</TextBlock> + </StackPanel> + </Border> + </touch:TouchButton> + </DataTemplate> + + <DataTemplate x:Key="bottomPanel" > + <Grid VerticalAlignment="Stretch" Margin="60 30 30 40"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <StackPanel > + <TextBlock FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center"> Job Palette</TextBlock> + <Rectangle Margin="0 10 20 0" Stroke="{StaticResource TangoDarkForegroundBrush}" Height="1" VerticalAlignment="Bottom"/> + </StackPanel> + + <Grid Grid.Row="2"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0" Content="OK"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + </Grid> + </Grid> + </DataTemplate> + </ResourceDictionary> + </UserControl.Resources> + <Grid HorizontalAlignment="Stretch"> + <Border > + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + + <Grid> + <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}" Margin="30 0 0 0"> + <touch:TouchButton HorizontalAlignment="Left" Command="{Binding CloseCommand}" Background="Transparent" Height="37" Width="37" EnableDropShadow="False"> + <Canvas x:Name="canvas" Width="24" Height="24" RenderTransformOrigin="0.5,0.5" Background="Transparent"> + <Canvas.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="2" ScaleY="2"/> + <SkewTransform/> + <RotateTransform Angle="-180"/> + <TranslateTransform/> + </TransformGroup> + </Canvas.RenderTransform> + <Rectangle x:Name="rectangle" Fill="{StaticResource TangoPrimaryAccentBrush}" Height="2" Canvas.Left="3" RadiusY="0" RadiusX="0" Canvas.Top="6" Width="18" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="0.581"/> + <SkewTransform/> + <RotateTransform Angle="45"/> + <TranslateTransform X="4.875" Y="1.875"/> + </TransformGroup> + </Rectangle.RenderTransform> + </Rectangle> + <Rectangle x:Name="rectangle2" Fill="{StaticResource TangoPrimaryAccentBrush}" Height="2" Canvas.Left="3" RadiusY="0" RadiusX="0" Canvas.Top="16" Width="18" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="0.581"/> + <SkewTransform/> + <RotateTransform Angle="-45"/> + <TranslateTransform X="4.832" Y="-2.082"/> + </TransformGroup> + </Rectangle.RenderTransform> + </Rectangle> + </Canvas> + </touch:TouchButton> + </Border> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Color Selection Tool</TextBlock> + </Grid> + </Border> + <Grid Grid.Row="1" Background="{StaticResource TangoPrimaryBackgroundBrush}" Margin="10"> + <Grid.RowDefinitions> + <RowDefinition Height="100"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <touch:TouchNavigationLinks x:Name="navigationCSTLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" + SelectedIndex="{Binding SelectedColorTabIndex,Mode=TwoWay}" VerticalAlignment="Bottom" Margin="20" + FontSize="{StaticResource TangoNavigationLinksFontSize}" HorizontalContentAlignment="Stretch" PreviewMouseDown="TouchNavigationLinks_OnPreviewMouseDown"> + <TextBlock HorizontalAlignment="Center" >HSB</TextBlock> + <TextBlock HorizontalAlignment="Center" >CIELab</TextBlock> + <TextBlock HorizontalAlignment="Center" >RGB</TextBlock> + <TextBlock HorizontalAlignment="Center" >CMYK</TextBlock> + <TextBlock HorizontalAlignment="Center" >Catalogs</TextBlock> + <touch:TouchNavigationLinks.Style> + <Style TargetType="{x:Type touch:TouchNavigationLinks}"> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <UniformGrid Columns="5" /> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + </Style> + </touch:TouchNavigationLinks.Style> + + </touch:TouchNavigationLinks> + + <Grid Grid.Row="1" x:Name="HSBGrid" > + + + <Grid Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='HSB'}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ContentControl Name="myColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> + + <ContentControl Name="segmentContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}"/> + + <Grid Grid.Row="2" Margin="80 0 93 0"> + + <touch:TouchColorPickerHSBControl x:Name="HSBPicker" Visibility="Visible" ThumbHeight="30" ThumbHeightInside="28" ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 0 0 0" MinWidth="200" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" + H="{Binding SelectedBrushStop.Hue, Mode=TwoWay}" S="{Binding SelectedBrushStop.Saturation, Mode=TwoWay}" B="{Binding SelectedBrushStop.Brightness, Mode=TwoWay}" + /> + </Grid> + + <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}"/> + </Grid> + + <Grid Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='CIELab'}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ContentControl Name="myLabColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> + + <ContentControl Name="segmentContentLab" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}"/> + + <Grid Grid.Row="2" Margin="80 0 93 0"> + <touch:TouchColorPickerLABControl x:Name="LABPicker" Visibility="Visible" + ThumbHeight="30" ThumbHeightInside="28" + ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + VerticalAlignment="Stretch" HorizontalAlignment="Stretch" + Margin="0 0 0 0" + MinWidth="200" + BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" + L="{Binding SelectedBrushStop.L, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" A="{Binding SelectedBrushStop.A, Mode=TwoWay}" B="{ Binding SelectedBrushStop.B, Mode=TwoWay}" + + /> + </Grid> + + <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}"/> + + </Grid> + + <Grid Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='RGB'}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ContentControl Name="myRGBColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> + + <ContentControl Name="segmentRGBContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}"/> + + <Grid Grid.Row="2" Margin="80 0 93 0" > + <touch:TouchColorPickerRGBControl x:Name="RGBPicker" Visibility="Visible" ThumbHeight="30" ThumbHeightInside="28" ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 0 0 0" MinWidth="200" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" + R="{Binding SelectedBrushStop.Red, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + G="{Binding SelectedBrushStop.Green, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + B="{ Binding SelectedBrushStop.Blue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + + /> + </Grid> + + <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}"/> + + </Grid> + + <Grid Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='Volume'}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ContentControl Name="myCMYKColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> + + <ContentControl Name="segmentCMYKContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}"/> + + <Grid Grid.Row="2" Margin="80 0 93 0"> + <touch:TouchColorPickerCMYKControl x:Name="CMYKPicker" Visibility="Visible" ThumbHeight="30" ThumbHeightInside="28" + ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + VerticalAlignment="Stretch" HorizontalAlignment="Stretch" + Margin="0 0 0 0" + MinWidth="200" + BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" + Cyan="{Binding SelectedBrushStop.Cyan, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Magenta="{Binding SelectedBrushStop.Magenta, Mode=TwoWay}" Yellow="{ Binding SelectedBrushStop.Yellow, Mode=TwoWay}" Key="{ Binding SelectedBrushStop.Black, Mode=TwoWay}" + MaxCyanValue="{Binding MaxCyanValue,UpdateSourceTrigger=PropertyChanged}" + MaxMagentaValue="{Binding MaxMagentaValue, UpdateSourceTrigger=PropertyChanged}" + MaxYellowValue="{Binding MaxYellowValue, UpdateSourceTrigger=PropertyChanged}" + MaxKeyValue="{Binding MaxBlackValue, UpdateSourceTrigger=PropertyChanged}" + /> + </Grid> + + <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}"/> + </Grid> + + <Grid x:Name="catalogsGrid" Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='Catalog'}"> + <!--Catalog--> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <ContentControl Name="myCatalogsColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> + <DockPanel Grid.Row="1" Margin="0 0 50 0"> + <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Grid VerticalAlignment="Center" HorizontalAlignment="Left" Margin="60 5 0 0" DockPanel.Dock="Left" Width="200"> + <DockPanel> + <touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" /> + <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay, UpdateSourceTrigger=LostFocus}" ></touch:TouchTextBox> + </DockPanel> + </Grid> + <touch:TouchComboBox Margin="0 5 60 0" Grid.Column="1" Width="200" HorizontalContentAlignment="Right" ItemsSource="{Binding Catalogs}" SelectedItem="{Binding SelectedCatalog}" DisplayMemberPath="Name" Title="Twine Catalog"/> + </Grid> + + <!--<commonControls:TwineCatalogControl Margin="0 30 0 0 " DataContext="{Binding SelectedCatalog, Mode=TwoWay}" SelectedItem="{Binding DataContext.ColorCatalogsItem, Mode=TwoWay, ElementName=catalogsGrid, UpdateSourceTrigger=PropertyChanged, Delay=500}" />--> + + <controls:TwineCatalogViewer Margin="80 0 0 0 " Catalog="{Binding SelectedCatalog, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedBrushStop.ColorCatalogsItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CollectionFilter="{Binding CollectionFilter, Mode=OneWay}"/> + </DockPanel> + <Grid Grid.Row="2" Margin="60 27 30 40"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" Background="{StaticResource TangoMidAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0">OK</touch:TouchButton> + </Grid> + </Grid> + </Grid> + + </Grid> + </Grid> + </Border> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs new file mode 100644 index 000000000..60a3f5039 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs @@ -0,0 +1,69 @@ +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; +using Tango.PPC.Jobs.ViewModels; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Interaction logic for ColorSelectionView.xaml + /// </summary> + public partial class ColorSelectionView : UserControl + { + private ColorSelectionViewVM _vm; + + public ColorSelectionView() + { + InitializeComponent(); + + Loaded += (_, __) => + { + _vm = DataContext as ColorSelectionViewVM; + }; + } + + + private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + } + + private void TouchNavigationLinks_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + if (_vm != null && _vm.SelectedBrushStop != null && true == _vm.SelectedBrushStop.IsLiquidVolumesOutOfRange) + { + var item = ItemsControl.ContainerFromElement(sender as ListBox, e.OriginalSource as DependencyObject) as ListBoxItem; + if (item != null) + { + e.Handled = true; + } + } + else if (_vm != null) + { + var item = ItemsControl.ContainerFromElement(sender as ListBox, e.OriginalSource as DependencyObject) as ListBoxItem; + if (item != null && item.DataContext is TextBlock ) + { + TextBlock header = item.DataContext as TextBlock; + if(header.Text == "HSB") + e.Handled = true; + } + } + } + + private void TwineCatalogControl_Loaded(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs new file mode 100644 index 000000000..10fe6e821 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -0,0 +1,481 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.ColorConversion; +using Tango.Core.Commands; +using Tango.Core.Threading; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Jobs.Models; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Jobs.ViewContracts; +using Tango.SharedUI; +using Tango.Touch.Components; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ColorSelectionViewVM : DialogViewVM + { + public enum ColorTab + { + [Description("HSB")] + HSB = 5, + [Description("CIELab")] + CIELab = 3, + [Description("RGB")] + RGB = 1, + [Description("CMYK")] + Volume = 0, + [Description("Catalog")] + Catalog = 2 + } + + public class DialogObject + { + public SegmentModel SelectedSegment { get; set; } + public BrushStopModel BrushStopForEdit { get; set; } + public List<ColorCatalog> Catalogs { get; set; } + /// <summary> + /// True when first brush is open for editing + /// </summary> + public bool IsEditingMode { get; set; } + } + + + private ActionTimer _volumeConversionTimer; + private IColorConverter _converter; + + + #region Properties + + private bool _isEditMode; + + public bool IsEditMode + { + get { return _isEditMode; } + set + { + _isEditMode = value; + RaisePropertyChangedAuto(); + } + } + + private int _selectedColorTabIndex; + /// <summary> + /// Gets or sets the index of the selected category. + /// </summary> + public int SelectedColorTabIndex + { + get { return _selectedColorTabIndex; } + set + { + if(_selectedColorTabIndex != value) + { + _selectedColorTabIndex = value; + RaisePropertyChangedAuto(); + switch (_selectedColorTabIndex) + { + case 0: + { + SelectedColorTab = ColorTab.HSB; + break; + } + case 1: + { + SelectedColorTab = ColorTab.CIELab; + break; + } + case 2: + { + SelectedColorTab = ColorTab.RGB; + break; + } + case 3: + { + SelectedColorTab = ColorTab.Volume; + break; + } + case 4: + { + SelectedColorTab = ColorTab.Catalog; + break; + } + } + } + } + } + + private ColorTab _selectedColorTab; + /// <summary> + /// Gets or sets the selected category. + /// </summary> + /// + public ColorTab SelectedColorTab + { + get { + return _selectedColorTab; + } + set + { + if (_selectedColorTab != value) + { + _selectedColorTab = value; + switch (SelectedColorTab) + { + case ColorTab.HSB: + { + SelectedColorTabIndex = 0; + break; + } + case ColorTab.CIELab: + { + SelectedColorTabIndex = 1; + break; + } + case ColorTab.RGB: + { + SelectedColorTabIndex = 2; + break; + } + case ColorTab.Volume: + { + SelectedColorTabIndex = 3; + break; + } + case ColorTab.Catalog: + { + SelectedColorTabIndex = 4; + break; + } + } + + OnSelectedtabChanged(); + RaisePropertyChangedAuto(); + } + } + } + + private int _segmentIndex; + + public int SegmentIndex + { + get { return _segmentIndex; } + set + { + _segmentIndex = value; + RaisePropertyChangedAuto(); + } + } + + + private BrushStopModel _initialBrushStop; + /// <summary> + /// Gets or sets the initial brush stop. + /// </summary> + public BrushStopModel InitialBrushStop + { + get { return _initialBrushStop; } + set + { + _initialBrushStop = value; + RaisePropertyChangedAuto(); + } + } + + private BrushStopModel _selectedBrushStop; + /// <summary> + /// Gets or sets the edited brush stop. + /// </summary> + public BrushStopModel SelectedBrushStop + { + get { return _selectedBrushStop; } + set + { + if (_selectedBrushStop != value) + { + _selectedBrushStop = value; + RaisePropertyChangedAuto(); + } + } + } + + public double MaxCyanValue + { + get + { + return GetMaxCMYKValueOrDefault(LiquidTypes.Cyan); + } + } + + public double MaxMagentaValue + { + get + { + return GetMaxCMYKValueOrDefault(LiquidTypes.Magenta); + } + } + + public double MaxYellowValue + { + get + { + return GetMaxCMYKValueOrDefault(LiquidTypes.Yellow); + } + } + + public double MaxBlackValue + { + get + { + return GetMaxCMYKValueOrDefault(LiquidTypes.Black); + } + } + + public DialogObject DialogEditObject { get; set; } + + private List<ColorCatalog> _catalogs; + public List<ColorCatalog> Catalogs + { + get { return _catalogs; } + set { + _catalogs = value; + RaisePropertyChangedAuto(); } + } + + private ColorCatalog _selectedCatalog; + public ColorCatalog SelectedCatalog + { + get { return _selectedCatalog; } + set + { + if (_selectedCatalog != value) + { + _selectedCatalog = value; + RaisePropertyChangedAuto(); + Filter = ""; + } + } + } + + private String _filter; + /// <summary> + /// Gets or sets the search filter. + /// </summary> + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } + } + + private ICollectionFilter _collectionFilter; + public ICollectionFilter CollectionFilter + { + get { return _collectionFilter; } + set { _collectionFilter = value; RaisePropertyChangedAuto(); } + } + + private void OnFilterChanged() + { + if(CollectionFilter != null) + { + CollectionFilter.RaiseFilterChanged(); + } + } + #endregion + + public ColorSelectionViewVM() + { + SelectedColorTab = ColorTab.RGB; + _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); + _converter = new DefaultColorConverter(); + CollectionFilter = new DefaultCollectionFilter(); + CollectionFilter.RegisterFilter(item => + { + var colorCatalogsItem = item as ColorCatalogsItem; + + if (colorCatalogsItem != null) + { + if (String.IsNullOrEmpty(Filter)) + { + return true; + } + else + { + return (colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())); + } + } + else + { + return true; + } + }); + } + + public override void OnShow() + { + Catalogs = DialogEditObject.Catalogs; + base.OnShow(); + + SegmentIndex = DialogEditObject.SelectedSegment.SegmentIndex; + IsEditMode = DialogEditObject.IsEditingMode; + if (DialogEditObject.IsEditingMode) + { + InitialBrushStop = DialogEditObject.BrushStopForEdit; + + SelectedBrushStop = InitialBrushStop.Clone(); + + SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; + if(SelectedBrushStop.ColorSpace == ColorSpaces.Volume) + SelectedColorTab = ColorTab.Volume; + if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) + { + SelectedColorTab = ColorTab.CIELab; + } + else if(SelectedBrushStop.ColorSpace == ColorSpaces.Catalog) + { + SelectedColorTab = ColorTab.Catalog; + if (SelectedBrushStop.ColorCatalogsItem != null) + { + SelectedCatalog = SelectedBrushStop.ColorCatalogsItem.ColorCatalogsGroup.ColorCatalog; + } + else + { + SelectedCatalog = Catalogs.FirstOrDefault(); + } + } + else if (SelectedBrushStop.ColorSpace == ColorSpaces.HSB) + SelectedColorTab = ColorTab.HSB; + else if (SelectedBrushStop.ColorSpace == ColorSpaces.RGB) + SelectedColorTab = ColorTab.RGB; + } + else + { + SelectedBrushStop = DialogEditObject.BrushStopForEdit; + SelectedColorTab = ColorTab.RGB; + SelectedCatalog = Catalogs.FirstOrDefault(); + } + SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; + SelectedBrushStop.ColorCatalogsItemChanged += OnColorSelectionItemChanged; + UpdateVolumesMaxValues(); + OKCommand.RaiseCanExecuteChanged(); + SelectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + SelectedBrushStop.LiquidVolumesOutOfRangeChanged += OnLiquidVolumesOutOfRangeChanged; + } + + private void OnSelectedtabChanged() + { + switch (SelectedColorTab) + { + case ColorTab.HSB: + { + if (SelectedBrushStop != null) + { + SelectedBrushStop.ConvertColorToHSB(); + } + + return; + } + case ColorTab.RGB: + { + if (SelectedBrushStop != null) + { + SelectedBrushStop.ConvertColorToRGB(); + } + return; + } + case ColorTab.CIELab: + { + if (SelectedBrushStop != null) + { + SelectedBrushStop.ConvertColorToLAB(); + } + return; + } + case ColorTab.Volume: + { + if (SelectedBrushStop != null) + { + SelectedBrushStop.ConvertColorToVolume(); + } + return; + } + case ColorTab.Catalog: + { + if (SelectedBrushStop != null) + { + SelectedBrushStop.ConvertColorToCatalogs(DialogEditObject.Catalogs); + } + return; + } + } + } + + protected void OnColorSelectionItemChanged( object sender, EventArgs args) + { + if (SelectedBrushStop.ColorCatalogsItem != null) + { + SelectedCatalog = SelectedBrushStop.ColorCatalogsItem.ColorCatalogsGroup.ColorCatalog; + } + + else + SelectedCatalog = Catalogs.FirstOrDefault(); + } + + #region Methods + + private double GetMaxCMYKValueOrDefault(LiquidTypes type) + { + if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null && SelectedBrushStop.SegmentModel.Job.Rml != null) + { + var liquidTypesRml = SelectedBrushStop.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); + if (liquidTypesRml != null) + { + //var test = liquidTypesRml.GetMaxCalibrationValue(); + + return liquidTypesRml.GetMaxCalibrationValue(); + } + + } + return 100; + } + + private void UpdateVolumesMaxValues() + { + RaisePropertyChanged(nameof(MaxCyanValue)); + RaisePropertyChanged(nameof(MaxMagentaValue)); + RaisePropertyChanged(nameof(MaxYellowValue)); + RaisePropertyChanged(nameof(MaxBlackValue)); + } + + private void OnLiquidVolumesOutOfRangeChanged(object sender, EventArgs e) + { + + OKCommand.RaiseCanExecuteChanged(); + } + + protected override void Accept() + { + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + _selectedBrushStop.InitColorsFromBestmatch(); + base.Accept(); + } + protected override void Cancel() + { + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + base.Cancel(); + } + + protected override bool CanOK() + { + return SelectedBrushStop!= null && !SelectedBrushStop.LiquidVolumesOutOfRange; + } + + #endregion + + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml new file mode 100644 index 000000000..0d6faa092 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml @@ -0,0 +1,113 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.FineTuningPaletteView" + 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:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="600" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=local:FineTuningPaletteViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <DockPanel Margin="20"> + <StackPanel DockPanel.Dock="Top"> + <TextBlock FontSize="{StaticResource TangoMessageBoxTitleFontSize}">Fine Tuning Palette</TextBlock> + <TextBlock Margin="0 30 0 0">Choose fine tuning palette:</TextBlock> + + <touch:TouchFlatListBox Margin="50 40 50 0" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsEnabled="False"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <ContentControl Width="70" Height="70" Margin="50 0"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <Ellipse Width="70" Height="70" Fill="{Binding Brush}" HorizontalAlignment="Center"> + + </Ellipse> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <Grid> + <Ellipse Fill="{Binding Brush}" Width="60" Height="60"></Ellipse> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="-1" StrokeThickness="3" StrokeDashArray="2" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"></Ellipse> + </Grid> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </touch:TouchFlatListBox> + + <ItemsControl Margin="0 40 0 0" ItemsSource="{Binding Suggestions}" Height="20"> + <ItemsControl.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualHeight"></Binding> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </ItemsControl.Clip> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Fill="{Binding Brush}"></Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + </StackPanel> + + <DockPanel DockPanel.Dock="Bottom" LastChildFill="False"> + <touch:TouchButton DockPanel.Dock="Left" Command="{Binding CloseCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50"> + CANCEL + </touch:TouchButton> + <touch:TouchButton DockPanel.Dock="Right" Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50"> + OK + </touch:TouchButton> + </DockPanel> + + <hive:HexList Width="330" Height="460" Margin="0 40 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedHiveSuggestion,Mode=TwoWay}"> + <hive:HexList.ItemContainerStyle> + <Style TargetType="ListBoxItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Grid.Column" Value="{Binding Path=Column}"></Setter> + <Setter Property="Grid.Row" Value="{Binding Path=Row}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <Grid Margin="10"> + <Ellipse Fill="{Binding Brush}"></Ellipse> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="-4" StrokeThickness="3" StrokeDashArray="2" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"></Ellipse> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </hive:HexList.ItemContainerStyle> + </hive:HexList> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml.cs new file mode 100644 index 000000000..b86584ad8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteView.xaml.cs @@ -0,0 +1,33 @@ +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.Dialogs +{ + /// <summary> + /// Represents the fine tuning pallet dialog. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class FineTuningPaletteView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="FineTuningPaletteView"/> class. + /// </summary> + public FineTuningPaletteView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteViewVM.cs new file mode 100644 index 000000000..2e16ac747 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/FineTuningPaletteViewVM.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.ColorConversion; +using Tango.PPC.Common.Models; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the fine tuning pallet dialog ViewModel. + /// </summary> + /// <seealso cref="Tango.SharedUI.DialogViewVM" /> + public class FineTuningPaletteViewVM : DialogViewVM + { + private Job _job; + private bool _prevent_change; + private IColorConverter _converter; + + private List<ColorConversionSuggestion> _suggestions; + /// <summary> + /// Gets or sets the triplet suggestions. + /// </summary> + public List<ColorConversionSuggestion> Suggestions + { + get { return _suggestions; } + set { _suggestions = value; RaisePropertyChangedAuto(); } + } + + private List<ColorConversionSuggestion> _hiveSuggestions; + /// <summary> + /// Gets or sets the hive suggestions. + /// </summary> + public List<ColorConversionSuggestion> HiveSuggestions + { + get { return _hiveSuggestions; } + set { _hiveSuggestions = value; RaisePropertyChangedAuto(); } + } + + private ColorConversionSuggestion _selectedHiveSuggestion; + /// <summary> + /// Gets or sets the selected hive suggestion. + /// </summary> + public ColorConversionSuggestion SelectedHiveSuggestion + { + get { return _selectedHiveSuggestion; } + set { _selectedHiveSuggestion = value; RaisePropertyChangedAuto(); OnSelectedHiveSuggestionChanged(); } + } + + private ColorConversionSuggestion _selectedSuggestion; + /// <summary> + /// Gets or sets the selected triplet suggestion. + /// </summary> + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="FineTuningPaletteViewVM"/> class. + /// </summary> + public FineTuningPaletteViewVM() + { + Suggestions = new List<ColorConversionSuggestion>(); + HiveSuggestions = new List<ColorConversionSuggestion>(); + + _converter = new DefaultColorConverter(); + } + + /// <summary> + /// Called when the selected hive suggestion has been changed + /// </summary> + private void OnSelectedHiveSuggestionChanged() + { + if (!_prevent_change) + { + Suggestions = _converter.Convert(_job, SelectedHiveSuggestion.Color, true).CreateTrippletSuggestions(); + SelectedSuggestion = Suggestions.GetCenterSuggestion(); + } + } + + /// <summary> + /// Initializes a new instance of the <see cref="FineTuningPaletteViewVM"/> class. + /// </summary> + /// <param name="fineTuneItem">The fine tune item.</param> + /// <param name="job">The job.</param> + public FineTuningPaletteViewVM(FineTuneItem fineTuneItem, Job job) : this() + { + _prevent_change = true; + _job = job; + Suggestions = fineTuneItem.Suggestions; + HiveSuggestions = fineTuneItem.HiveSuggestions; + SelectedHiveSuggestion = HiveSuggestions.GetCenterSuggestion(); + SelectedSuggestion = Suggestions[Suggestions.Count / 2]; + _prevent_change = false; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml new file mode 100644 index 000000000..41010261e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml @@ -0,0 +1,35 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportColorProfileView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportColorProfileViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> + </Grid> + <StackPanel DockPanel.Dock="Top"> + <Image Source="../Images/snapmatch.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Import SnapMatch Color</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + A SnapMatch color detection result file has been selected from the storage device. press 'IMPORT' to create a new job from this color. + </TextBlock> + </StackPanel> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}">Detected Color</TextBlock> + <Ellipse Width="100" Height="100" Margin="0 20 0 0"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + </StackPanel> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml.cs new file mode 100644 index 000000000..f919b9df8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for ImportJobView.xaml + /// </summary> + public partial class ImportColorProfileView : UserControl + { + public ImportColorProfileView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileViewVM.cs new file mode 100644 index 000000000..100236d8e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportColorProfileViewVM.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportColorProfileViewVM : DialogViewVM + { + public Color Color { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml new file mode 100644 index 000000000..e1caea66d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml @@ -0,0 +1,38 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportCsvJobView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportCsvJobViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> + </Grid> + <StackPanel> + <Grid HorizontalAlignment="Center"> + <Image Source="../Images/job.png" Stretch="Uniform" Height="120"></Image> + <Image Source="../Images/csv.png" Stretch="Uniform" Height="48" HorizontalAlignment="Right" VerticalAlignment="Bottom" RenderOptions.BitmapScalingMode="Fant" Margin="10"></Image> + </Grid> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT CSV JOB</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A csv job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock> + + <StackPanel Margin="80"> + <StackPanel> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Job Name</TextBlock> + <touch:TouchTextBox Text="{Binding Name}" Watermark="Name" Margin="0 -2 0 0"></touch:TouchTextBox> + </StackPanel> + + <StackPanel Margin="0 40 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Thread Type</TextBlock> + <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name"></touch:TouchComboBox> + </StackPanel> + </StackPanel> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml.cs new file mode 100644 index 000000000..67fc5ec82 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for ImportJobView.xaml + /// </summary> + public partial class ImportCsvJobView : UserControl + { + public ImportCsvJobView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobViewVM.cs new file mode 100644 index 000000000..ffa406795 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportCsvJobViewVM.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.PPC.Common; +using Tango.PPC.Common.Connection; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportCsvJobViewVM : DialogViewVM + { + [TangoInject] + private IMachineProvider MachineProvider { get; set; } + + private String _name; + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private List<Rml> _rmls; + public List<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRml; + public Rml SelectedRml + { + get { return _selectedRml; } + set { _selectedRml = value; RaisePropertyChangedAuto(); } + } + + private bool _importAndEdit; + public bool ImportAndEdit + { + get { return _importAndEdit; } + set { _importAndEdit = value; RaisePropertyChangedAuto(); } + } + + public ImportCsvJobViewVM() + { + TangoIOC.Default.Inject(this); + } + + public async Task Init() + { + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); + + if (settings.DefaultRmlGuid != null) + { + SelectedRml = Rmls.SingleOrDefault(x => x.Guid == settings.DefaultRmlGuid); + } + + if (SelectedRml == null) + { + SelectedRml = Rmls.FirstOrDefault(); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml new file mode 100644 index 000000000..da51bba27 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportJobView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportJobViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> + </Grid> + <StackPanel> + <Image Source="../Images/job.png" Stretch="Uniform" Height="120"></Image> + <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> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml.cs new file mode 100644 index 000000000..2d17483f5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for ImportJobView.xaml + /// </summary> + public partial class ImportJobView : UserControl + { + public ImportJobView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobViewVM.cs new file mode 100644 index 000000000..0440d6a54 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportJobViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportJobViewVM : DialogViewVM + { + private bool _importAndEdit; + public bool ImportAndEdit + { + get { return _importAndEdit; } + set { _importAndEdit = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml new file mode 100644 index 000000000..0cd9540ec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml @@ -0,0 +1,28 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportTwnFileView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportTwnFileViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> + </Grid> + <StackPanel DockPanel.Dock="Top"> + <Image Source="../Images/emb-file.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Import Embroidery File</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + An embroidery design file has been selected from the storage device. press 'IMPORT' to create a new job from this design. + </TextBlock> + </StackPanel> + <Grid> + <Image Source="{Binding Thumbnail}" Stretch="Uniform" Margin="50"></Image> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml.cs new file mode 100644 index 000000000..a04406374 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for ImportJobView.xaml + /// </summary> + public partial class ImportTwnFileView : UserControl + { + public ImportTwnFileView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileViewVM.cs new file mode 100644 index 000000000..5792413b8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ImportTwnFileViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportTwnFileViewVM : DialogViewVM + { + public BitmapSource Thumbnail { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml new file mode 100644 index 000000000..db3b134de --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml @@ -0,0 +1,199 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.JobCreationView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoMidBackgroundBrush}" d:DesignHeight="861" d:DesignWidth="600" Width="750" Height="1200" d:DataContext="{d:DesignInstance Type=local:JobCreationViewVM, IsDesignTimeCreatable=False}" HorizontalAlignment="Center"> + + <UserControl.Resources> + <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> + <converters:ColorSpaceToImageConverter x:Key="ColorSpaceToImageConverter" /> + + </UserControl.Resources> + + <Border BorderThickness="0" > + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Grid Height="89" x:Name="JobDetailsHeader" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + + <!--<Image Source="../Images/JobView/job-details.png" Width="34" />--> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Job Details</TextBlock> + <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}" Margin="30 0 0 0"> + <touch:TouchButton HorizontalAlignment="Left" Command="{Binding CloseCommand}" Background="Transparent" Height="37" Width="37" EnableDropShadow="False"> + <Canvas x:Name="canvas" Width="24" Height="24" RenderTransformOrigin="0.5,0.5" Background="Transparent"> + <Canvas.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="2" ScaleY="2"/> + <SkewTransform/> + <RotateTransform Angle="-180"/> + <TranslateTransform/> + </TransformGroup> + </Canvas.RenderTransform> + <Rectangle x:Name="rectangle" Fill="{StaticResource TangoPrimaryAccentBrush}" Height="2" Canvas.Left="3" RadiusY="0" RadiusX="0" Canvas.Top="6" Width="18" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="0.581"/> + <SkewTransform/> + <RotateTransform Angle="45"/> + <TranslateTransform X="4.875" Y="1.875"/> + </TransformGroup> + </Rectangle.RenderTransform> + </Rectangle> + <Rectangle x:Name="rectangle2" Fill="{StaticResource TangoPrimaryAccentBrush}" Height="2" Canvas.Left="3" RadiusY="0" RadiusX="0" Canvas.Top="16" Width="18" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <TransformGroup> + <ScaleTransform ScaleX="0.581"/> + <SkewTransform/> + <RotateTransform Angle="-45"/> + <TranslateTransform X="4.832" Y="-2.082"/> + </TransformGroup> + </Rectangle.RenderTransform> + </Rectangle> + </Canvas> + </touch:TouchButton> + </Border> + </Grid> + <Grid Grid.Row="1" Margin="24 17 24 31" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="47 38 54 40"> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="180" Height="48" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + </Grid> + + <Grid DockPanel.Dock="Top" > + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + + + <StackPanel Grid.Row="1" VerticalAlignment="Top" TextElement.FontWeight="Normal" HorizontalAlignment="Stretch"> + <DockPanel Margin="0 50 0 0" HorizontalAlignment="Stretch"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Job Name" FontSize="{StaticResource TangoDialogFontSize}" Width="125"/> + <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> + <touch:TouchTextBox Margin="20 10 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Text="{Binding JobName}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" ></touch:TouchTextBox> + </Border> + </DockPanel > + <DockPanel HorizontalAlignment="Stretch" Margin="0 50 0 0"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Thread Type" FontSize="{StaticResource TangoDialogFontSize}" Width="125"/> + <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> + <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML,Mode=TwoWay}"> + <touch:TouchComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Name}"> + + </TextBlock> + </DataTemplate> + </touch:TouchComboBox.ItemTemplate> + <touch:TouchComboBox.SelectedItemTemplate> + <DataTemplate> + <TextBlock Margin="0 0 0 5" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> + </DataTemplate> + </touch:TouchComboBox.SelectedItemTemplate> + </touch:TouchComboBox> + </Border> + </DockPanel> + <DockPanel Margin="190 15 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding LubricationLevel,Converter={StaticResource IsNullToVisibilityConverter}}"> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <TextBlock Margin="5 0 0 0"> + <Run Text="{Binding LubricationLevel.LubricationLevel,Mode=OneWay,Converter={StaticResource EnumToDescriptionConverter}}"></Run> + <Run>Lubrication</Run> + </TextBlock> + </DockPanel> + <StackPanel TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Margin="190 5 0 0" HorizontalAlignment="Left" Visibility="{Binding MachineProvider.Machine.BtsrInstalled,Converter={StaticResource BooleanToVisibilityConverter}}"> + <DockPanel> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> + <Run>Required tensioner level is </Run> + <Run Text="{Binding BtsrSpoolTension}" FontWeight="Bold"></Run> + </TextBlock> + </DockPanel> + </StackPanel> + + <DockPanel HorizontalAlignment="Stretch" Margin="0 50 0 0"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Spool Type" FontSize="{StaticResource TangoDialogFontSize}" Width="125"/> + <Border Margin="49 0 0 0" BorderThickness="1" HorizontalAlignment="Stretch" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> + <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding SpoolTypes}" SelectedItem="{Binding SelectedSpoolType,Mode=TwoWay}" FontSize="{StaticResource TangoDialogFontSize}"> + + <touch:TouchComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}"> + <Run Text="{Binding Name}"></Run> + <Run Foreground="{StaticResource TangoDarkForegroundBrush}" Text="{Binding Length,Mode=OneWay}"></Run> + <Run Foreground="{StaticResource TangoDarkForegroundBrush}" Text="m"></Run> + </TextBlock> + </DataTemplate> + </touch:TouchComboBox.ItemTemplate> + <touch:TouchComboBox.SelectedItemTemplate> + <DataTemplate> + <TextBlock Margin="0 0 0 5" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Name}"></TextBlock> + </DataTemplate> + </touch:TouchComboBox.SelectedItemTemplate> + </touch:TouchComboBox> + </Border> + </DockPanel> + <DockPanel Margin="0 50 0 0" HorizontalAlignment="Stretch"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="White Gap" FontSize="{StaticResource TangoDialogFontSize}" Width="125"/> + <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> + <touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" ></touch:TouchNumericTextBox> + </Border> + </DockPanel > + </StackPanel> + + <Grid Grid.Row="2" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Duplicate Job As New" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> + <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}">Duplicate</touch:TouchButton> + + </Grid> + <Grid Grid.Row="3" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Save Job As PDF" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> + <touch:TouchButton CornerRadius="25" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" + TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" + FontSize="{StaticResource TangoButtonFontSize}" Content="Export" IsEnabled="False"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + + </Grid> + </Grid> + </DockPanel> + </Grid> + </Grid> + </Border> +</UserControl> + + +
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml.cs new file mode 100644 index 000000000..4d57794d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml.cs @@ -0,0 +1,34 @@ +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; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the new job creation dialog. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class JobCreationView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="JobCreationView"/> class. + /// </summary> + public JobCreationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs new file mode 100644 index 000000000..88636db76 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs @@ -0,0 +1,226 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.Commands; +using Tango.PPC.Common; +using Tango.PPC.Common.Lubrication; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// <summary> + /// Represents the a job type picker view model + /// </summary> + /// <seealso cref="Tango.SharedUI.DialogViewVM" /> + public class JobCreationViewVM : DialogViewVM + { + private String _jobName; + + public String JobName + { + get { return _jobName; } + set { _jobName = value; + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + } + } + + private List<Rml> _rmls; + /// <summary> + /// Gets or sets the available RMLS. + /// </summary> + public List<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + /// <summary> + /// Gets or sets the selected RML. + /// </summary> + public Rml SelectedRML + { + get { return _selectedRML; } + set { + if(_selectedRML != value) + { + _selectedRML = value; + OnRmlSelectionChanged(); + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + } + } + } + + private List<SpoolType> _spoolTypes; + /// <summary> + /// Gets or sets the available spool types. + /// </summary> + public List<SpoolType> SpoolTypes + { + get { return _spoolTypes; } + set { _spoolTypes = value; + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + } + } + + private SpoolType _selectedSpoolType; + /// <summary> + /// Gets or sets the type of the selected spool. + /// </summary> + public SpoolType SelectedSpoolType + { + get { return _selectedSpoolType; } + set { + if(_selectedSpoolType != value) + { + _selectedSpoolType = value; + OnSelectedSpoolTypeChanged(); + RaisePropertyChangedAuto(); + } + } + } + + private RmlLubricationLevel _lubricationLevel; + public RmlLubricationLevel LubricationLevel + { + get { return _lubricationLevel; } + set { _lubricationLevel = value; RaisePropertyChangedAuto(); } + } + + private int _btsrSpoolTension; + public int BtsrSpoolTension + { + get { return _btsrSpoolTension; } + set { _btsrSpoolTension = value; RaisePropertyChangedAuto(); } + } + + private PPCSettings _settings; + /// <summary> + /// Gets the main PPC settings. + /// </summary> + public PPCSettings Settings + { + get + { + if (_settings == null) + { + _settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + } + + return _settings; + } + private set { _settings = value; } + } + private double _whiteGap; + + public double WhiteGap + { + get { return _whiteGap; } + set { _whiteGap = value; + RaisePropertyChangedAuto(); + } + } + + + private bool _showDuplicate; + + public bool ShowDuplicate + { + get { return _showDuplicate; } + set { _showDuplicate = value; + RaisePropertyChangedAuto(); + + } + } + + public bool IsDuplicate { get; set; } + public RelayCommand DuplicateCommand { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="JobCreationViewVM"/> class. + /// </summary> + /// <param name="supportedJobTypes">The supported job types.</param> + /// <param name="supportedColorSpaces">The supported color spaces</param> + public JobCreationViewVM(List<SpoolType> spoolTypes, List<Rml> rmls, double whitegap, bool showDuplicate) : base() + { + JobName = "Unnamed"; + SpoolTypes = spoolTypes; + Rmls = rmls.OrderBy(x => x.Name).ToList(); + DuplicateCommand = new RelayCommand(Duplicate); + IsDuplicate = false; + ShowDuplicate = showDuplicate; + WhiteGap = whitegap; + } + + #region Commands + + private void Duplicate(object obj) + { + IsDuplicate = true; + Accept(); + } + + protected override bool CanOK() + { + //var ret = (false == String.IsNullOrEmpty(JobName) && SelectedRML != null && SelectedSpoolType != null); + return (false == String.IsNullOrEmpty(JobName) && SelectedRML!=null && SelectedSpoolType!=null); + } + + #endregion + + #region update on change value + + private void OnRmlSelectionChanged() + { + GetLubricationLevel(); + SetSpoolTension(); + } + + private void OnSelectedSpoolTypeChanged() + { + SetSpoolTension(); + } + + #endregion + + + #region Lubrication Level + + private void GetLubricationLevel() + { + if (SelectedRML != null) + { + LubricationLevel = Settings.LubricationLevels.FirstOrDefault(x => x.RmlGuid == SelectedRML.Guid); + } + else + { + LubricationLevel = null; + } + } + + #endregion + + #region Spool Tension + + private async void SetSpoolTension() + { + if (SelectedRML != null && SelectedSpoolType != null) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + BtsrSpoolTension = await SelectedRML.GetRequiredBtsrSpoolTension(db, SelectedSpoolType); + } + } + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml new file mode 100644 index 000000000..bf242e98b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml @@ -0,0 +1,36 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.RepeatJobView" + 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.Dialogs" + mc:Ignorable="d" + Background="Transparent" d:DesignHeight="630" d:DesignWidth="560" MinWidth="380" Height="250" + d:DataContext="{d:DesignInstance Type=local:RepeatJobViewVM, IsDesignTimeCreatable=False}"> + <Border BorderBrush="{StaticResource TangoMidAccentBrush}" Margin="-24" CornerRadius="40" BorderThickness="2" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <DockPanel VerticalAlignment="Top" Margin="0 16 18 18" Grid.Row="0"> + <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="28" Command="{Binding CloseCommand}" Icon="CloseCircleOutline" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Right" /> + </DockPanel> + + <TextBlock Grid.Row="1" Height="26" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center"> Repeat All</TextBlock> + + <StackPanel Margin="0 20 0 0" Grid.Row="2" Width="302" VerticalAlignment="Center" HorizontalAlignment="Center"> + <touch:TouchNumericUpDownConrol Margin="0 0 0 0" Width="Auto" Value="{Binding Repeats, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" BorderThickness="0" MaxValue="{Binding MaxRepeations, Mode=OneWay}" MinValue="1" Style="{StaticResource TouchNumericMiddleUpDownControl}"/> + + <Rectangle Margin="0 7 0 0" Stroke="{StaticResource TangoMidAccentBrush}" Height="1" VerticalAlignment="Bottom"/> + + + <touch:TouchButton Margin="0 41 0 0 " Command="{Binding OKCommand}" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" Style="{StaticResource TangoFlatButton}" Width="Auto" VerticalAlignment="Bottom" HorizontalAlignment="Center">OK</touch:TouchButton> + </StackPanel> + </Grid> + </Border> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml.cs new file mode 100644 index 000000000..dff1ced26 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for RepeatJob.xaml + /// </summary> + public partial class RepeatJobView : UserControl + { + public RepeatJobView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobViewVM.cs new file mode 100644 index 000000000..4cf5d8c95 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobViewVM.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class RepeatJobViewVM : DialogViewVM + { + private int _repeats; + + public int Repeats + { + get { return _repeats; } + set { _repeats = value; + RaisePropertyChangedAuto(); + } + } + + private int _maxrepeations; + + public int MaxRepeations + { + get { + return _maxrepeations; } + set { _maxrepeations = value; + RaisePropertyChangedAuto(); + } + } + + + public RepeatJobViewVM() + { + Repeats = 1; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml new file mode 100644 index 000000000..c0874363f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml @@ -0,0 +1,32 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.SpoolChangeView" + 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.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="630" d:DesignWidth="560" MinWidth="560" Height="700" d:DataContext="{d:DesignInstance Type=local:SpoolChangeViewVM, IsDesignTimeCreatable=False}"> + + <Grid Margin="20"> + <DockPanel> + <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal"> + <touch:TouchButton Command="{Binding CloseCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="140" Height="50" VerticalAlignment="Bottom">ABORT</touch:TouchButton> + <touch:TouchButton Command="{Binding OKCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="140" Height="50" VerticalAlignment="Bottom">CONTINUE</touch:TouchButton> + </StackPanel> + <StackPanel> + <Image Source="../Images/spool_replace.png" Stretch="Uniform" Height="200" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">SPOOL CHANGE</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + <Run>The current job was set to dye each color segment on a single spool.</Run> + <LineBreak/> + <Run>Please replace the spool and press 'continue'.</Run> + </TextBlock> + + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Center" Margin="0 50 0 0"> + <Run Text="{Binding SpoolChangeRequiredEventArgs.CurrentSegment}"></Run><Run>/</Run><Run Text="{Binding SpoolChangeRequiredEventArgs.TotalSegments}"></Run> + </TextBlock> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml.cs new file mode 100644 index 000000000..f79e1f4b7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeView.xaml.cs @@ -0,0 +1,28 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for SpoolChangeView.xaml + /// </summary> + public partial class SpoolChangeView : UserControl + { + public SpoolChangeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeViewVM.cs new file mode 100644 index 000000000..8942cb284 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/SpoolChangeViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class SpoolChangeViewVM : DialogViewVM + { + public SpoolChangeRequiredEventArgs SpoolChangeRequiredEventArgs { get; set; } + + public SpoolChangeViewVM(SpoolChangeRequiredEventArgs spoolChangeRequiredEventArgs) + { + SpoolChangeRequiredEventArgs = spoolChangeRequiredEventArgs; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats-sylko-logo.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats-sylko-logo.png Binary files differnew file mode 100644 index 000000000..5fc4c13d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats-sylko-logo.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats.png Binary files differnew file mode 100644 index 000000000..1b2d01f51 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/coats.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/thread.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/thread.png Binary files differnew file mode 100644 index 000000000..443897335 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Coats/thread.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Black_heart.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Black_heart.png Binary files differnew file mode 100644 index 000000000..0d736a108 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Black_heart.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Exclamation.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Exclamation.png Binary files differnew file mode 100644 index 000000000..a9bfc8027 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Exclamation.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Heart.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Heart.png Binary files differnew file mode 100644 index 000000000..1abee7650 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Heart.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Red_heart.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Red_heart.png Binary files differnew file mode 100644 index 000000000..1d8002603 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Red_heart.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Triangle.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Triangle.png Binary files differnew file mode 100644 index 000000000..58af21001 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Triangle.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/arrow-round-back.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/arrow-round-back.png Binary files differnew file mode 100644 index 000000000..d5f4168ff --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/arrow-round-back.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroider.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroider.png Binary files differnew file mode 100644 index 000000000..f71bc2a70 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroider.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroidery.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroidery.png Binary files differnew file mode 100644 index 000000000..d71717835 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Embroidery.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Job Issues/cyan.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Job Issues/cyan.png Binary files differnew file mode 100644 index 000000000..d53382f28 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Job Issues/cyan.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/clock.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/clock.png Binary files differnew file mode 100644 index 000000000..80cde5b8b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/clock.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/drop.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/drop.png Binary files differnew file mode 100644 index 000000000..75b215a63 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobProgressView/drop.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddColor.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddColor.png Binary files differnew file mode 100644 index 000000000..e008014dd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddColor.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddNewSegment.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddNewSegment.png Binary files differnew file mode 100644 index 000000000..afb4b72eb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/AddNewSegment.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Color Picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Color Picker.png Binary files differnew file mode 100644 index 000000000..9c75b5440 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Color Picker.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Edit_color.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Edit_color.png Binary files differnew file mode 100644 index 000000000..5ba4c12a5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Edit_color.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Exclamation_black.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Exclamation_black.png Binary files differnew file mode 100644 index 000000000..5592d5ac3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Exclamation_black.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Plus.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Plus.png Binary files differnew file mode 100644 index 000000000..d6929fd61 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Plus.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Redo.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Redo.png Binary files differnew file mode 100644 index 000000000..9b6cae8c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/Redo.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/SliderThumb.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/SliderThumb.png Binary files differnew file mode 100644 index 000000000..38c186bc5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/SliderThumb.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/add_gap.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/add_gap.png Binary files differnew file mode 100644 index 000000000..a095e3987 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/add_gap.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/additional-tools.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/additional-tools.png Binary files differnew file mode 100644 index 000000000..421446e8d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/additional-tools.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-fine-tuning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-fine-tuning.png Binary files differnew file mode 100644 index 000000000..5b8201eef --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-fine-tuning.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-length.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-length.png Binary files differnew file mode 100644 index 000000000..6495c83ff --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-length.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-picker.png Binary files differnew file mode 100644 index 000000000..e09d23190 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/color-picker.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete.png Binary files differnew file mode 100644 index 000000000..1e4cf9945 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete_segment.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete_segment.png Binary files differnew file mode 100644 index 000000000..c81d42e81 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/delete_segment.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/duplicate.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/duplicate.png Binary files differnew file mode 100644 index 000000000..62bbda6fa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/duplicate.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/error.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/error.png Binary files differnew file mode 100644 index 000000000..02a0a91a9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/error.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-details.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-details.png Binary files differnew file mode 100644 index 000000000..e0ebc547e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-details.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-summary.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-summary.png Binary files differnew file mode 100644 index 000000000..d85cbd5e0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job-summary.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_details.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_details.png Binary files differnew file mode 100644 index 000000000..fa5a1f81f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_details.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_mode.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_mode.png Binary files differnew file mode 100644 index 000000000..16da30c27 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/job_mode.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/output.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/output.png Binary files differnew file mode 100644 index 000000000..7e58fa67a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/output.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/paste.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/paste.png Binary files differnew file mode 100644 index 000000000..11fcca9f9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/paste.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/remove.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/remove.png Binary files differnew file mode 100644 index 000000000..68ee07788 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/remove.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/repeat.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/repeat.png Binary files differnew file mode 100644 index 000000000..2ab076ad6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/repeat.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/replace-color.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/replace-color.png Binary files differnew file mode 100644 index 000000000..af5655416 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/replace-color.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/reverse.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/reverse.png Binary files differnew file mode 100644 index 000000000..cc662a5d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/reverse.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/sample-dye.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/sample-dye.png Binary files differnew file mode 100644 index 000000000..f8989e19a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/sample-dye.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/settings.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/settings.png Binary files differnew file mode 100644 index 000000000..d7b224819 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/settings.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent.jpg Binary files differnew file mode 100644 index 000000000..cf1d94d12 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent.jpg diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent_small.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent_small.jpg Binary files differnew file mode 100644 index 000000000..c682a4c7e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/transparent_small.jpg diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/twine-catalog.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/twine-catalog.png Binary files differnew file mode 100644 index 000000000..35d9b69cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/twine-catalog.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/undo.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/undo.png Binary files differnew file mode 100644 index 000000000..404aea45b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/undo.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/white_gap.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/white_gap.png Binary files differnew file mode 100644 index 000000000..120ba9fda --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/white_gap.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Knitting.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Knitting.png Binary files differnew file mode 100644 index 000000000..06c345965 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Knitting.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/coats.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/coats.png Binary files differnew file mode 100644 index 000000000..d6cd3ecf2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/coats.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/job_export.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/job_export.png Binary files differnew file mode 100644 index 000000000..8251d97ae --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/job_export.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/lab.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/lab.png Binary files differnew file mode 100644 index 000000000..607afd980 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/lab.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/rgb.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/rgb.png Binary files differnew file mode 100644 index 000000000..dfdf32c8d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/rgb.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/twine.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/twine.png Binary files differnew file mode 100644 index 000000000..b1d3da8c5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/twine.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/volume.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/volume.png Binary files differnew file mode 100644 index 000000000..434e704ca --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/NewJob/volume.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Sewing.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Sewing.png Binary files differnew file mode 100644 index 000000000..51c468eea --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/Sewing.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/arrows.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/arrows.png Binary files differnew file mode 100644 index 000000000..ae3482ee5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/arrows.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color-picker.png Binary files differnew file mode 100644 index 000000000..d8d6f8470 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color-picker.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small.png Binary files differnew file mode 100644 index 000000000..e29b5fb67 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small_gray.png Binary files differnew file mode 100644 index 000000000..828379648 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/color_approved_small_gray.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/csv.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/csv.png Binary files differnew file mode 100644 index 000000000..5ff44818b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/csv.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/emb-file.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/emb-file.png Binary files differnew file mode 100644 index 000000000..a369eb899 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/emb-file.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/job.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/job.png Binary files differnew file mode 100644 index 000000000..a41bcf8f0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/job.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs-module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs-module.png Binary files differnew file mode 100644 index 000000000..85e82c491 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs-module.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs.png Binary files differnew file mode 100644 index 000000000..eb668ad03 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/jobs.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view - blue.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view - blue.png Binary files differnew file mode 100644 index 000000000..a37e0b555 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view - blue.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view.png Binary files differnew file mode 100644 index 000000000..697ce228c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/large-cards-view.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/length.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/length.png Binary files differnew file mode 100644 index 000000000..bad870dcb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/length.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/liquid.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/liquid.png Binary files differnew file mode 100644 index 000000000..7c5a4bceb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/liquid.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pantone.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pantone.png Binary files differnew file mode 100644 index 000000000..477af3c2c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pantone.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-blue.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-blue.png Binary files differnew file mode 100644 index 000000000..cab937cef --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-blue.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-gray.png Binary files differnew file mode 100644 index 000000000..0ca2eed8c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/pencil-gray.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/plus.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/plus.png Binary files differnew file mode 100644 index 000000000..de965130e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/plus.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small.png Binary files differnew file mode 100644 index 000000000..6e4e56fe0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small_gray.png Binary files differnew file mode 100644 index 000000000..edf3bf0dd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sample_approved_small_gray.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view - blue.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view - blue.png Binary files differnew file mode 100644 index 000000000..d0a97503e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view - blue.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view.png Binary files differnew file mode 100644 index 000000000..873b7513f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/small-cards-view.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/snapmatch.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/snapmatch.png Binary files differnew file mode 100644 index 000000000..05656ffdc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/snapmatch.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_change.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_change.png Binary files differnew file mode 100644 index 000000000..17737eed0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_change.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_replace.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_replace.png Binary files differnew file mode 100644 index 000000000..0adf7e7d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/spool_replace.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync.png Binary files differnew file mode 100644 index 000000000..46059c5c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync_job.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync_job.png Binary files differnew file mode 100644 index 000000000..4e46ee447 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/sync_job.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/warning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/warning.png Binary files differnew file mode 100644 index 000000000..5c7672421 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/warning.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsModuleSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsModuleSettings.cs new file mode 100644 index 000000000..85278d692 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsModuleSettings.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Settings; + +namespace Tango.PPC.Jobs +{ + /// <summary> + /// Represents the jobs module settings. + /// </summary> + /// <seealso cref="Tango.Settings.SettingsBase" /> + public class JobsModuleSettings : SettingsBase + { + public class RecentCatalog + { + public String Guid { get; set; } + public List<String> RecentItems { get; set; } + + public RecentCatalog() + { + RecentItems = new List<string>(); + } + } + + /// <summary> + /// Gets or sets the recent catalogs items. + /// </summary> + public List<RecentCatalog> RecentCatalogsItems { get; set; } + + /// <summary> + /// Gets or sets the last job color space. + /// </summary> + public ColorSpaces? LastJobColorSpace { get; set; } + + /// <summary> + /// Gets or sets the new job last type. + /// </summary> + public JobTypes? LastJobType { get; set; } + + /// <summary> + /// Gets or sets the last selected catalog unique identifier. + /// </summary> + public String LastSelectedCatalogGuid { get; set; } + + /// <summary> + /// Adds a catalog item to the recent list. + /// </summary> + /// <param name="catalog">The catalog.</param> + /// <param name="item">The catalog item.</param> + public void AddRecentCatalogItem(ColorCatalog catalog, ColorCatalogsItem item) + { + var recentCatalog = RecentCatalogsItems.FirstOrDefault(x => x.Guid == catalog.Guid); + + if (recentCatalog == null) + { + recentCatalog = new RecentCatalog(); + recentCatalog.Guid = catalog.Guid; + RecentCatalogsItems.Add(recentCatalog); + } + + if (recentCatalog.RecentItems.Exists(x => x == item.Guid)) + { + recentCatalog.RecentItems.Remove(item.Guid); + } + + recentCatalog.RecentItems.Insert(0, item.Guid); + + if (recentCatalog.RecentItems.Count > 20) + { + recentCatalog.RecentItems.RemoveAt(recentCatalog.RecentItems.Count - 1); + } + } + + /// <summary> + /// Initializes a new instance of the <see cref="JobsModuleSettings"/> class. + /// </summary> + public JobsModuleSettings() + { + RecentCatalogsItems = new List<RecentCatalog>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsV2Module.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsV2Module.cs new file mode 100644 index 000000000..64ad34a21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/JobsV2Module.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Jobs.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Jobs +{ + /// <summary> + /// Represents the PPC jobs module + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> + [PPCModule(1, nameof(JobsView))] + public class JobsV2Module : PPCModuleBase + { + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name + { + get + { + return "Jobs"; + } + } + + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description + { + get + { + return "Manage and run jobs"; + } + } + + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/jobs.png"); + } + } + + /// <summary> + /// Gets the module entry point view type. + /// </summary> + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/JobSelectedMessage.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/JobSelectedMessage.cs new file mode 100644 index 000000000..721dce6ed --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/JobSelectedMessage.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.Messages +{ + /// <summary> + /// Notifies about a job being selected from the job list. + /// </summary> + public class JobSelectedMessage + { + /// <summary> + /// Gets or sets the job. + /// </summary> + public Job Job { get; set; } + + /// <summary> + /// Gets or sets the db context. + /// </summary> + public ObservablesContext Context { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/NavigatedToJobsModuleMessage.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/NavigatedToJobsModuleMessage.cs new file mode 100644 index 000000000..3f2be3f89 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Messages/NavigatedToJobsModuleMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.Messages +{ + public class NavigatedToJobsModuleMessage + { + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs new file mode 100644 index 000000000..03ae2bbab --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -0,0 +1,1290 @@ +using System; +using ColorMine.ColorSpaces; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.SharedUI; +using System.Windows.Media; +using Tango.BL.Enumerations; +using Tango.Core.Threading; +using Tango.ColorConversion; +using System.Reflection; +using Tango.BL.Dispensing; +using Tango.BL; +using Tango.Core.ExtensionMethods; + +namespace Tango.PPC.Jobs.Models +{ + public class BrushStopModel : ViewModel + { + public enum PositionStatus + { + First = 1, + FirstColor = 2, + Middle = 3, + SecondColor = 4, + Last = 5 + } + + private ActionTimer _volumeConversionTimer; + private IColorConverter _converter; + public const double MAX_INK_UPTAKE = 400; + public event EventHandler ColorCatalogsItemChanged; + public event EventHandler LiquidVolumesOutOfRangeChanged; + + #region Property + + public bool PreventPropertyUpdate { get; set; } + + protected Double _cyan; + + /// <summary> + /// Gets or sets the BrushStopModel cyan. + /// </summary> + public Double Cyan + { + get + { + return _cyan; + } + + set + { + if (_cyan != value) + { + _cyan = value; + RaisePropertyChangedAuto(); + OnVolumeChanged(); + } + } + } + + protected Double _magenta; + + /// <summary> + /// Gets or sets the BrushStopModel magenta. + /// </summary> + + public Double Magenta + { + get + { + return _magenta; + } + + set + { + if (_magenta != value) + { + _magenta = value; + RaisePropertyChangedAuto(); + OnVolumeChanged(); + } + } + } + + protected Double _yellow; + + /// <summary> + /// Gets or sets the BrushStopModel yellow. + /// </summary> + + public Double Yellow + { + get + { + return _yellow; + } + + set + { + if (_yellow != value) + { + _yellow = value; + RaisePropertyChangedAuto(); + OnVolumeChanged(); + } + } + } + + protected Double _black; + + /// <summary> + /// Gets or sets the BrushStopModel black. + /// </summary> + public Double Black + { + get + { + return _black; + } + + set + { + if (_black != value) + { + _black = value; + RaisePropertyChangedAuto(); + OnVolumeChanged(); + } + } + } + + protected Int32 _red; + + /// <summary> + /// Gets or sets the BrushStopModel red. + /// </summary> + public Int32 Red + { + get + { + return _red; + } + set + { + if (_red != value) + { + _red = value; + RaisePropertyChangedAuto(); + OnRGBChanged(); + } + } + } + + protected Int32 _green; + + /// <summary> + /// Gets or sets the BrushStopModel green. + /// </summary> + public Int32 Green + { + get + { + return _green; + } + set + { + if (_green != value) + { + _green = value; + RaisePropertyChangedAuto(); + OnRGBChanged(); + } + } + } + + protected Int32 _blue; + + /// <summary> + /// Gets or sets the BrushStopModel blue. + /// </summary> + public Int32 Blue + { + get + { + return _blue; + } + set + { + if (_blue != value) + { + _blue = value; + RaisePropertyChangedAuto(); + OnRGBChanged(); + } + } + } + + protected Double _l; + + /// <summary> + /// Gets or sets the BrushStopModel l. + /// </summary> + + public Double L + { + get + { + return _l; + } + + set + { + if (_l != value) + { + _l = value; + RaisePropertyChangedAuto(); + OnLABChanged(); + } + } + } + + protected Double _a; + + /// <summary> + /// Gets or sets the BrushStopModel a. + /// </summary> + public Double A + { + get + { + return _a; + } + set + { + if (_a != value) + { + _a = value; + RaisePropertyChangedAuto(); + OnLABChanged(); + } + } + } + + protected Double _b; + + /// <summary> + /// Gets or sets the BrushStopModel b. + /// </summary> + public Double B + { + get + { + return _b; + } + set + { + if (_b != value) + { + _b = value; + RaisePropertyChangedAuto(); + OnLABChanged(); + } + } + } + + //HSB??? + private double _hue; + + public double Hue + { + get { return _hue; } + set + { + if (_hue != value) + { + _hue = value; + OnHSBChanged(); + RaisePropertyChangedAuto(); + } + + } + } + + private double _saturation; + + public double Saturation + { + get { return _saturation; } + set + { + if (_saturation != value) + { + _saturation = value; + OnHSBChanged(); + RaisePropertyChangedAuto(); + } + } + } + + private double _brightness; + + public double Brightness + { + get { return _brightness; } + set + { + if (_brightness != value) + { + _brightness = value; + OnHSBChanged(); + RaisePropertyChangedAuto(); + } + + } + } + + private double _bestMatchL; + public double BestMatchL + { + get + { + return _bestMatchL; + } + set + { + if (_bestMatchL != value) + { + _bestMatchL = value; + RaisePropertyChangedAuto(); + } + } + } + + private double _bestMatchA; + public double BestMatchA + { + get + { + return _bestMatchA; + } + set + { + if (_bestMatchA != value) + { + _bestMatchA = value; + RaisePropertyChangedAuto(); + } + } + } + + private double _bestMatchB; + public double BestMatchB + { + get + { + return _bestMatchB; + } + set + { + if (_bestMatchB != value) + { + _bestMatchB = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double _offsetpercent; + + /// <summary> + /// Gets or sets the brushstopbase offset percent. + /// </summary> + public Double OffsetPercent + { + get + { + return _offsetpercent; + } + set + { + if (_offsetpercent != value) + { + _offsetpercent = value; + RaisePropertyChangedAuto(); + OnOffsetPercentChanged(); + } + } + } + + public double OffsetMeters + { + get + { + if (SegmentModel != null) + { + var a = SegmentModel.Length * (OffsetPercent / 100d); + return a; + } + else + { + return 0; + } + } + set + { + if (SegmentModel != null) + { + OffsetPercent = (value / SegmentModel.Length) * 100d; + RaisePropertyChangedAuto(); + } + } + } + + protected Int32 _stopindex; + + /// <summary> + /// Gets or sets the brushstopbase stop index. + /// </summary> + public Int32 StopIndex + { + get + { + return _stopindex; + } + + set + { + if (_stopindex != value) + { + _stopindex = value; + RaisePropertyChangedAuto(); + OnStopIndexChanged(); + + } + } + } + + private PositionStatus _position; + + public PositionStatus Position + { + get { return _position; } + set { _position = value; + RaisePropertyChangedAuto(); + } + } + + protected ColorSpaces _colorspace; + + public virtual ColorSpaces ColorSpace + { + get + { + return _colorspace; + } + + set + { + if (_colorspace != value) + { + _colorspace = value; + } + RaisePropertyChangedAuto(); + } + } + + protected ColorCatalogsItem _colorcatalogsitem; + public virtual ColorCatalogsItem ColorCatalogsItem + { + get + { + return _colorcatalogsitem; + } + + set + { + if (_colorcatalogsitem != value) + { + _colorcatalogsitem = value; + OnColorCatalogsItemChanged(); + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(ColorCatalog)); + + } + } + } + + + /// <summary> + /// Gets or sets the color catalog. + /// </summary> + /// <value> + /// The color catalog. + /// </value> + public virtual ColorCatalog ColorCatalog + { + get + { + if(ColorCatalogsItem != null && ColorCatalogsItem.ColorCatalogsGroup!= null) + return ColorCatalogsItem.ColorCatalogsGroup.ColorCatalog; + + return null; + } + } + + private System.Windows.Media.Color _color; + public System.Windows.Media.Color Color + { + get + { + return _color; + } + set + { + if(_color != value) + { + _color = value; + RaisePropertyChangedAuto(); + } + } + } + + private System.Windows.Media.Color _bestMatchColor; + + public System.Windows.Media.Color BestMatchColor + { + get { return _bestMatchColor; } + set { + _bestMatchColor = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(BestMatchA)); + RaisePropertyChanged(nameof(BestMatchB)); + RaisePropertyChanged(nameof(BestMatchL)); + } + } + + + public SolidColorBrush ColorBrush + { + get + { + if(Color == null) + { + InitColor(); + } + return new SolidColorBrush(Color); + } + } + + private SegmentModel _segmentmodel; + + public SegmentModel SegmentModel + { + get { return _segmentmodel; } + set { _segmentmodel = value; } + } + + + private bool _outOfGamutChecked; + /// <summary> + /// Gets or sets a value indicating whether out of gamut has been checked. + /// </summary> + public bool OutOfGamutChecked + { + get { return _outOfGamutChecked; } + set { _outOfGamutChecked = value; RaisePropertyChangedAuto(); } + } + + private bool _isOutOfGamut; + /// <summary> + /// Gets or sets a value indicating whether this instance is out of gamut. + /// </summary> + public bool IsOutOfGamut + { + get { return _isOutOfGamut && ColorSpace != ColorSpaces.Volume && ColorSpace != ColorSpaces.Catalog; } + set + { + if (_isOutOfGamut != value) + { + _isOutOfGamut = value; + RaisePropertyChangedAuto(); + } + } + } + #endregion + + public BrushStopModel(SegmentModel segmentModel) + { + _hue = 0; + _saturation = 0; + _brightness = 100; + _l = 100; + _a = 0; + _b = 0; + _bestMatchL = 100; + _bestMatchA = _bestMatchB = 0; + _red = _green = _blue = 255; + _cyan = _magenta = _yellow = _black = 0; + StopIndex = 1; + Position = PositionStatus.FirstColor; + SegmentModel = segmentModel; + IsOutOfGamut = false; + _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); + _converter = new DefaultColorConverter(); + _bestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + Color = Colors.White; + ColorSpace = ColorSpaces.RGB; + ColorCatalogsItem = null; + PreventPropertyUpdate = false; + LiquidVolumesOutOfRange = false; + } + + public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel) + { + SegmentModel = segmentModel; + OffsetPercent = brushStop.OffsetPercent; + Color = brushStop.Color; + BestMatchColor = brushStop.Color; + ColorSpace = brushStop.ColorSpace.Space; + ColorCatalogsItem = brushStop.ColorCatalogsItem; + StopIndex = brushStop.StopIndex; + + PreventPropertyUpdate = true; + Cyan = brushStop.Cyan; + Magenta = brushStop.Magenta; + Yellow = brushStop.Yellow; + Black = brushStop.Black; + Red = brushStop.Red; + Green = brushStop.Green; + Blue = brushStop.Blue; + L = brushStop.L; + A = brushStop.A; + B = brushStop.B; + BestMatchL = brushStop.L; + BestMatchA = brushStop.A; + BestMatchB = brushStop.B; + PreventPropertyUpdate = false; + LiquidVolumesOutOfRange = false; + } + + #region Methods + /// <summary> + /// Initializes the color. + /// </summary> + public void InitColor() + { + if (ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + { + Color = Color.FromRgb((byte)ColorCatalogsItem.Red, (byte)ColorCatalogsItem.Green, (byte)ColorCatalogsItem.Blue); + } + else + { + Color = Color.FromRgb((byte)_red, (byte)_green, (byte)_blue); + } + } + + /// <summary> + /// Sets the new color. + /// </summary> + public void SetNewColor( BrushStopModel newBrushStop) + { + ColorSpace = newBrushStop.ColorSpace; + PreventPropertyUpdate = true; + + Red = newBrushStop.Red; + Green = newBrushStop.Green; + Blue = newBrushStop.Blue; + L = newBrushStop.L; + A = newBrushStop.A; + B = newBrushStop.B; + BestMatchL = newBrushStop.BestMatchL; + BestMatchA = newBrushStop.BestMatchA; + BestMatchB = newBrushStop.BestMatchB; + + Cyan = newBrushStop.Cyan; + Magenta = newBrushStop.Magenta; + Yellow = newBrushStop.Yellow; + Black = newBrushStop.Black; + ColorCatalogsItem = newBrushStop.ColorCatalogsItem; + PreventPropertyUpdate = false; + + Color = newBrushStop.Color; + BestMatchColor = newBrushStop.BestMatchColor; + } + + /// <summary> + /// Creates the brush stop. + /// </summary> + public BrushStop CreateBrushStop(ColorSpaces colorSpace) + { + List<Tango.BL.Entities.ColorSpace> list = SegmentModel.Job.ColorSpacesList; + + BrushStop s = new BrushStop(); + s.ColorSpace = list.FirstOrDefault(x => x.Space == colorSpace); + + Configuration configuration = SegmentModel.Job.Machine.Configuration; + Rml rml = SegmentModel.Job.Rml; + s.SetLiquidVolumes(configuration, rml, rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); + + + if (s.ColorSpace.Space == ColorSpaces.Volume) + { + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan); + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); + } + else if(s.ColorSpace.Space == ColorSpaces.LAB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.LAB; + s.L = this.L; + s.A = this.A; + s.B = this.B; + } + else if (s.ColorSpace.Space == ColorSpaces.RGB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; + s.Red = this.Red; + s.Green = this.Green; + s.Blue = this.Blue; + } + else if(s.ColorSpace.Space == ColorSpaces.HSB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; + s.Red = this.Red; + s.Green = this.Green; + s.Blue = this.Blue; + } + + return s; + } + + public BrushStopModel Clone() + { + var cloned = new BrushStopModel(SegmentModel); + cloned.StopIndex = StopIndex; + cloned.PreventPropertyUpdate = true; + cloned.Red = Red; + cloned.Green = Green; + cloned.Blue = Blue; + cloned.L = L; + cloned.A = A; + cloned.B = B; + cloned.BestMatchL = BestMatchL; + cloned.BestMatchA = BestMatchA; + cloned.BestMatchB = BestMatchB; + cloned.Cyan = Cyan; + cloned.Magenta = Magenta; + cloned.Yellow = Yellow; + cloned.Black = Black; + cloned.Hue = Hue; + cloned.Saturation = Saturation; + cloned.Brightness = Brightness; + cloned.Color = Color; + + cloned.ColorCatalogsItem = ColorCatalogsItem; + cloned.ColorSpace = ColorSpace; + cloned.BestMatchColor = BestMatchColor; + cloned.OffsetMeters = OffsetMeters; + cloned.OffsetPercent = OffsetPercent; + cloned.Position = Position; + cloned.IsOutOfGamut = IsOutOfGamut; + cloned.OutOfGamutChecked = OutOfGamutChecked; + cloned.LiquidVolumesOutOfRange = LiquidVolumesOutOfRange; + //this.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); + cloned.PreventPropertyUpdate = false; + return cloned; + } + + public static Color GetRelativeRGB(Color first, Color second, double firstOffset, double secondOffset, double offset) + { + var color = new Color(); + var range = (secondOffset - firstOffset); + var realoffset = offset - firstOffset; + + color.ScA = (float)(realoffset * (second.ScA - first.ScA) / range + first.ScA); + color.ScR = (float)(realoffset * (second.ScR - first.ScR) / range + first.ScR); + color.ScG = (float)(realoffset * (second.ScG - first.ScG) / range + first.ScG); + color.ScB = (float)(realoffset * (second.ScB - first.ScB) / range + first.ScB); + + return color; + } + + #endregion + + #region changes + + private void OnVolumeChanged() + { + if (PreventPropertyUpdate) + return; + ColorSpace = ColorSpaces.Volume; + RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + OnBrushStopFieldValueChanged(); + + } + private void OnRGBChanged() + { + if (PreventPropertyUpdate) + return; + ColorSpace = ColorSpaces.RGB; + InitColor(); + OnBrushStopFieldValueChanged(); + } + + private void OnHSBChanged() + { + if (PreventPropertyUpdate) + return; + ColorSpace = ColorSpaces.HSB; + Rgb rgb = GetRGBColor(); + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; + InitColor(); + OnBrushStopFieldValueChanged(); + } + + private void OnLABChanged() + { + if (PreventPropertyUpdate) + return; + ColorSpace = ColorSpaces.LAB; + Rgb rgb = GetRGBColor(); + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; + InitColor(); + OnBrushStopFieldValueChanged(); + } + + private void OnColorCatalogsItemChanged() + { + if (PreventPropertyUpdate) + return; + ColorSpace = ColorSpaces.Catalog; + if (_colorcatalogsitem != null) + { + _red = (int)_colorcatalogsitem.Red; + _green = (int)_colorcatalogsitem.Green; + _blue = (int)_colorcatalogsitem.Blue; + InitColor(); + BestMatchColor = Color; + } + + if (ColorCatalogsItemChanged != null) + { + ColorCatalogsItemChanged.Invoke(this, new EventArgs()); + } + } + private void OnOffsetPercentChanged() + { + //lenth? + } + + private void OnStopIndexChanged() + { + //throw new NotImplementedException(); + } + + private Rgb GetRGBColor() + { + if(ColorSpace == ColorSpaces.LAB) + { + Lab lab = new Lab(L, A, B); + Rgb rgb = new Rgb(lab.ToRgb()); + return rgb; + } + if(ColorSpace == ColorSpaces.HSB) + { + Hsb hsb = new Hsb(Hue, Saturation / 100, Brightness / 100); + Rgb rgb = new Rgb(hsb.ToRgb()); + return rgb; + } + if(ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + { + return new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue); + } + return new Rgb(Red, Green, Blue); + } + + public void ConvertColorToHSB() + { + if(ColorSpace != ColorSpaces.HSB) + { + Hsb hsb = null; + + if (ColorSpace == ColorSpaces.Volume) + { + BrushStop stop = CreateBrushStop(ColorSpaces.Volume); + try + { + IsBusy = true; + var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + IsOutOfGamut = output.OutOfGamut; + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + } + finally + { + IsBusy = false; + } + Rgb rgb = new Rgb(Red, Green, Blue); + hsb = new Hsb(rgb.To<Hsb>()); + } + else if (ColorSpace == ColorSpaces.LAB) + { + Lab lab = new Lab(L, A, B); + hsb = new Hsb(lab.To<Hsb>()); + } + else if (ColorSpace == ColorSpaces.RGB) + { + Rgb rgb = new Rgb(Red, Green, Blue); + hsb = new Hsb(rgb.To<Hsb>()); + } + else if(ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + { + Rgb rgb = new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue); + hsb = new Hsb(rgb.To<Hsb>()); + } + if (hsb != null) + { + _hue = hsb.H; + _saturation = hsb.S * 100; ; + _brightness = hsb.B * 100; ; + RaisePropertyChanged(nameof(Hue)); + RaisePropertyChanged(nameof(Saturation)); + RaisePropertyChanged(nameof(Brightness)); + } + } + } + + public void ConvertColorToRGB() + { + if (ColorSpace != ColorSpaces.RGB) + { + if (ColorSpace == ColorSpaces.Volume) + { + BrushStop stop = CreateBrushStop(ColorSpaces.Volume); + try + { + IsBusy = true; + var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + IsOutOfGamut = output.OutOfGamut; + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + } + finally + { + IsBusy = false; + } + } + else + { + Rgb rgb = GetRGBColor(); + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; + } + + RaisePropertyChanged(nameof(Red)); + RaisePropertyChanged(nameof(Green)); + RaisePropertyChanged(nameof(Blue)); + } + } + + public void ConvertColorToLAB() + { + if (ColorSpace != ColorSpaces.LAB) + { + Lab lab = null; + if (ColorSpace == ColorSpaces.Volume) + { + BrushStop stop = CreateBrushStop(ColorSpaces.Volume); + try + { + IsBusy = true; + var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); + _l = output.SingleCoordinates.L; + _a = output.SingleCoordinates.A; + _b = output.SingleCoordinates.B; + IsOutOfGamut = output.OutOfGamut; + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to convert volume to LAB."); + } + finally + { + IsBusy = false; + } + } + else if (ColorSpace == ColorSpaces.HSB) + { + Hsb hsb = new Hsb(Hue, Saturation / 100, Brightness / 100); + lab = new Lab(hsb.To<Lab>()); + } + else if (ColorSpace == ColorSpaces.RGB) + { + Rgb rgb = new Rgb(Red, Green, Blue); + lab = new Lab(rgb.To<Lab>()); + } + else if (ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + { + lab = new Lab(ColorCatalogsItem.L, ColorCatalogsItem.A, ColorCatalogsItem.B); + } + if(lab != null) + { + _l = lab.L; + _a = lab.A; + _b = lab.B; + + } + RaisePropertyChanged(nameof(L)); + RaisePropertyChanged(nameof(A)); + RaisePropertyChanged(nameof(B)); + } + } + + public void ConvertColorToVolume() + { + if (ColorSpace != ColorSpaces.Volume) + { + if (ColorSpace == ColorSpaces.Catalog) + { + if (ColorCatalogsItem != null) + { + _cyan = ColorCatalogsItem.Cyan; + _magenta = ColorCatalogsItem.Magenta; + _yellow = ColorCatalogsItem.Yellow; + _black = ColorCatalogsItem.Black; + RaisePropertyChanged(nameof(Cyan)); + RaisePropertyChanged(nameof(Yellow)); + RaisePropertyChanged(nameof(Magenta)); + RaisePropertyChanged(nameof(Black)); + IsOutOfGamut = false; + RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + } + return; + } + ColorSpaces colorSpace = ColorSpace; + if (ColorSpace == ColorSpaces.HSB) + { + colorSpace = ColorSpaces.RGB; + } + BrushStop stop = CreateBrushStop(colorSpace); + try + { + IsBusy = true; + var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); + + _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume) ; + _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); + _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); + _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); + IsOutOfGamut = false; + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + InitColor(); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + + RaisePropertyChanged(nameof(Cyan)); + RaisePropertyChanged(nameof(Yellow)); + RaisePropertyChanged(nameof(Magenta)); + RaisePropertyChanged(nameof(Black)); + RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + } + finally + { + IsBusy = false; + } + } + } + + public void ConvertColorToCatalogs(List<ColorCatalog> catalogs) + { + if (ColorSpace != ColorSpaces.Catalog) + { + if (BestMatchColor == null) + BestMatchColor = Color; + var closestItem = catalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(BestMatchColor); + + ColorCatalogsItem = closestItem; + RaisePropertyChanged(nameof(ColorCatalog)); + } + } + + public void RaiseOffsetChanged() + { + RaisePropertyChanged(nameof(OffsetPercent)); + RaisePropertyChanged(nameof(OffsetMeters)); + } + + public void RaiseColorCatalogsItemChanged() + { + RaisePropertyChanged(nameof(ColorCatalogsItem)); + } + + #endregion + + #region color converters + + public void InitColorsFromBestmatch() + { + if (BestMatchColor == null || BestMatchColor == Color) + return; + + _red = BestMatchColor.R; + _green = BestMatchColor.G; + _blue = BestMatchColor.B; + if (ColorSpace == BL.Enumerations.ColorSpaces.LAB) + { + _l = _bestMatchL; + _a = _bestMatchA; + _b = _bestMatchB; + } + IsOutOfGamut = false; + InitColor(); + } + + private double GetTotalMaximumLiquidNlPerCMLimit() + { + try + { + var tables = SegmentModel.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + + if (tables.Count > 0) + { + return tables.Max(x => x.MaxInkUptake); + } + else + { + return MAX_INK_UPTAKE; + } + } + catch + { + return MAX_INK_UPTAKE; + } + } + + public double GetColorNLPerCm(double color,LiquidTypes type ) + { + StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); + + Rml rml = SegmentModel.Job.Rml; + LiquidTypesRml liquidType = rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); + if (liquidType != null) + { + double maxNlPerCm = liquidType.MaxNlPerCm; + return calc.CalculateNanoliterPerCentimeter(color, maxNlPerCm); + } + return 0.0; + } + + public bool IsLiquidVolumesOutOfRange + { + get + { + //if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) + // { + var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black); + var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); + LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit(); + + return LiquidVolumesOutOfRange; + // } + // else return false; + } + } + + private bool _liquidVolumesOutOfRange; + + public bool LiquidVolumesOutOfRange + { + get { return _liquidVolumesOutOfRange; } + set { + if(_liquidVolumesOutOfRange != value) + { + _liquidVolumesOutOfRange = value; + LiquidVolumesOutOfRangeChanged?.Invoke(this, new EventArgs()); + } + } + } + + public void OnBrushStopFieldValueChanged() + { + IsBusy = true; + + _volumeConversionTimer.ResetReplace( () => + { + try + { + ColorSpaces colorSpace = ColorSpace; + + BrushStop stop = CreateBrushStop(colorSpace); + + Configuration configuration = SegmentModel.Job.Machine.Configuration; + Rml rml = SegmentModel.Job.Rml; + + if ( ColorSpace == BL.Enumerations.ColorSpaces.Volume) + { + //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + if(IsLiquidVolumesOutOfRange) + { + IsBusy = false; + return; + } + } + + var output = _converter.Convert(stop, configuration, rml, false, false, false); + //output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume; + + if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) + { + IsOutOfGamut = false; + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + InitColor(); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchL = (double)output.SingleCoordinates.L; + BestMatchA = (double)output.SingleCoordinates.A; + BestMatchB = (double)output.SingleCoordinates.B; + Lab lab = new Lab(output.SingleCoordinates.L, output.SingleCoordinates.A, output.SingleCoordinates.B); + Rgb rgb = new Rgb(lab.ToRgb()); + BestMatchColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + //TODO ASK ROY + //foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + //{ + // var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); + + // if (liquidVolume == null) + // { + // throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); + // } + + // liquidVolume.Volume = outputLiquid.Volume; + //} + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.HSB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + } + finally + { + IsBusy = false; + } + }); + + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs new file mode 100644 index 000000000..c7b9d9b6d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -0,0 +1,576 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Models +{ + public class JobModel : ViewModel + { + private bool _preventChange; + + #region Properties + protected String _name; + + public String Name + { + get + { + return _name; + } + + set + { + if (_name != value) + { + _name = value; + RaisePropertyChangedAuto(); + } + } + } + protected DateTime _creationdate; + + /// <summary> + /// Gets or sets the JobModel creation date. + /// </summary> + public DateTime CreationDate + { + get + { + return _creationdate; + } + set + { + if (_creationdate != value) + { + _creationdate = value; + RaisePropertyChangedAuto(); + } + } + } + + private double _lastLength; + public double Length + { + get + { + _lastLength = GetLength(); + return _lastLength; + } + } + + private double GetLength() + { + if (Segments != null) + { + return Segments.Sum(x => x.LengthWithInterSegment); + // return Segments.Sum(x => x.LengthWithFactor) + ((EnableInterSegment && IsAllSegmentsPerSpool) ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); + } + else + { + return 0; + } + } + + protected Double _lengthpercentagefactor; + + /// <summary> + /// Gets or sets the JobModel length percentage factor. + /// </summary> + + public Double LengthPercentageFactor + { + get + { + return _lengthpercentagefactor; + } + + set + { + if (_lengthpercentagefactor != value) + { + _lengthpercentagefactor = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Int32 _numberofunits; + /// <summary> + /// Gets or sets the JobModel number of units. + /// </summary> + public Int32 NumberOfUnits + { + get + { + return _numberofunits; + } + + set + { + if (_numberofunits != value) + { + _numberofunits = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(GetEstimatedDuration)); + + } + } + } + + protected Double _intersegmentlength; + + /// <summary> + /// Gets or sets the JobModel inter segment length. + /// </summary> + public Double InterSegmentLength + { + get + { + return _intersegmentlength; + } + + set + { + if (_intersegmentlength != value) + { + _intersegmentlength = value; + OnInterSegmentlengthChanged(); + RaisePropertyChangedAuto(); + } + } + } + + protected SpoolsDistributions _spoolsdistribution; + public bool IsAllSegmentsPerSpool + { + get { return ((SpoolsDistributions)_spoolsdistribution) == SpoolsDistributions.AllSegments; } + set + { + _spoolsdistribution = value ? SpoolsDistributions.AllSegments : SpoolsDistributions.SingleSegment; + RaisePropertyChangedAuto(); + } + } + /// <summary> + /// Gets the total job segments length multiplied by number of units if it is an embroidery job. + /// </summary> + public double LengthIncludingNumberOfUnits + { + get + { + _lastLength = GetLength(); + var l = _lastLength * Math.Max(NumberOfUnits, 1); + + //TODO ASK ROY + //if (EnableInterSegment && NumberOfUnits > 1) + //{ + // l += ((NumberOfUnits - 1) * InterSegmentLength); + //} + + return l; + } + } + + protected Rml _rml; + + /// <summary> + /// Gets or sets the JobModel rml. + /// </summary> + public virtual Rml Rml + { + get + { + return _rml; + } + + set + { + if (_rml != value) + { + _rml = value; + RaisePropertyChangedAuto(); + } + } + } + + protected ColorSpace _colorspace; + + /// <summary> + /// Gets or sets the JobModel color spaces. + /// </summary> + public virtual ColorSpace ColorSpace + { + get + { + return _colorspace; + } + set + { + if (_colorspace != value) + { + _colorspace = value; + RaisePropertyChangedAuto(); + } + } + } + + /// <summary> + /// Gets or sets the available color spaces. + /// </summary> + public List<ColorSpace> ColorSpacesList { get; set; } + + protected Customer _customer; + + /// <summary> + /// Gets or sets the JobModel customer. + /// </summary> + + public virtual Customer Customer + { + get + { + return _customer; + } + set + { + if (_customer != value) + { + _customer = value; + RaisePropertyChangedAuto(); + } + } + } + protected Machine _machine; + + /// <summary> + /// Gets or sets the JobModel machine. + /// </summary> + public virtual Machine Machine + { + get + { + return _machine; + } + + set + { + if (_machine != value) + { + _machine = value; + RaisePropertyChangedAuto(); + } + } + } + + protected SpoolType _spooltype; + + /// <summary> + /// Gets or sets the JobModel spool types. + /// </summary> + + public virtual SpoolType SpoolType + { + get + { + return _spooltype; + } + + set + { + if (_spooltype != value) + { + _spooltype = value; + RaisePropertyChangedAuto(); + + } + } + } + + protected User _user; + + /// <summary> + /// Gets or sets the JobModel user. + /// </summary> + public virtual User User + { + get + { + return _user; + } + + set + { + if (_user != value) + { + _user = value; + RaisePropertyChangedAuto(); + } + } + } + + protected SynchronizedObservableCollection<SegmentModel> _segments; + + /// <summary> + /// Gets or sets the JobModel segments. + /// </summary> + + public SynchronizedObservableCollection<SegmentModel> Segments + { + get + { + return _segments; + } + set + { + if (_segments != value) + { + _segments = value; + RaisePropertyChangedAuto(); + //OnSegmentsChanged(value); + } + } + } + + public ObservableCollection<SegmentModel> EffectiveSegments + { + get + { + //if (EnableInterSegment && IsAllSegmentsPerSpool) + if( IsAllSegmentsPerSpool) + { + int max = Segments.Max(x => x.SegmentIndex); + + ObservableCollection<SegmentModel> effectiveSegments = new ObservableCollection<SegmentModel>(); + + foreach (var s in Segments.ToList().OrderBy(x => x.SegmentIndex)) + { + effectiveSegments.Add(s); + + if (s.SegmentIndex != max && s.EnableInterSegment) + { + effectiveSegments.Add(CreateInterSegment(InterSegmentLength)); + } + } + + return effectiveSegments; + } + else + { + return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection(); + } + } + } + + private bool _selectAllSegments; + + public bool SelectAllSegments + { + get { return _selectAllSegments; } + set + { + _selectAllSegments = value; + OnSelectAllChanged(); + RaisePropertyChangedAuto(); + } + } + + public bool HasSelectedItems + { + get { + bool test = Segments.ToList().Any(x => x.IsSelected); + return Segments.ToList().Any(x => x.IsSelected); } + } + public List<SegmentModel> SegmentsToCopy { get; set; } + + public TimeSpan GetEstimatedDuration + { + get + { + if (Rml == null || Rml.GetActiveProcessGroup().ProcessParametersTables == null) + return TimeSpan.Zero; + var processParameters = Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault(); + + if (processParameters.DyeingSpeed != 0) + { + return TimeSpan.FromSeconds((LengthIncludingNumberOfUnits + processParameters.DryerBufferLengthMeters) / (processParameters.DyeingSpeed / 100d)); + } + return TimeSpan.Zero; + } + } + + + + #endregion + + public JobModel(List<ColorSpace> list) + { + ColorSpacesList = list; + Segments = new SynchronizedObservableCollection<SegmentModel>(); + SegmentsToCopy = new List<SegmentModel>(); + + Segments.CollectionChanged -= Segments_CollectionChanged; + Segments.CollectionChanged += Segments_CollectionChanged; + SelectAllSegments = false; + NumberOfUnits = 1; + } + + #region modifications + + public static SegmentModel CreateInterSegment(double length) + { + SegmentModel segment = new SegmentModel() + { + IsInterSegment = true, + Length = length, + Name = "Inter Segment" + }; + segment.BrushStops.Add(new BrushStopModel(segment) + { + ColorSpace = ColorSpaces.RGB, + Color = System.Windows.Media.Colors.White, + }); + return segment; + } + + public SegmentModel AddNewSegment( double length, Int32 segmentIndex) + { + SegmentModel segment = new SegmentModel(); + segment.Name = "Standard Segment"; + segment.SegmentIndex = segmentIndex + 1; + + + segment.Length = length; + + segment.Job = this; + segment.EnableInterSegment = InterSegmentLength > 0; + + if(segmentIndex < Segments.Count) + { + Segments.Insert(segmentIndex,segment); + + } + else + Segments.Add(segment); + + return segment; + } + + #endregion + + #region changes + /// <summary> + /// Handles the CollectionChanged event of the Segments collection. + /// </summary> + private void Segments_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + foreach (var segment in Segments.ToList()) + { + segment.PropertyChanged -= Segment_PropertyChanged; + segment.PropertyChanged += Segment_PropertyChanged; + } + + OnLengthChanged(); + RaisePropertyChanged(nameof(EffectiveSegments)); + } + + /// <summary> + /// Handles the PropertyChanged event of all job segments. + /// </summary> + private void Segment_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(SegmentModel.Length)) + { + OnLengthChanged(); + } + else if (e.PropertyName == nameof(SegmentModel.SegmentIndex)) + { + RaisePropertyChanged(nameof(EffectiveSegments)); + } + else if(e.PropertyName == nameof(SegmentModel.EnableInterSegment)) + { + OnLengthChanged(); + RaisePropertyChanged(nameof(EffectiveSegments)); + } + else if(e.PropertyName == nameof(SegmentModel.IsSelected)) + { + if (_preventChange) return; + if(Segments.ToList().TrueForAll(x => x.IsSelected)) + { + _selectAllSegments = true; + } + else + { + _selectAllSegments = false; + } + RaisePropertyChanged(nameof(SelectAllSegments)); + RaisePropertyChanged(nameof(HasSelectedItems)); + } + } + + /// <summary> + /// Called when the <see cref="Length"/> property has been changed + /// </summary> + public void OnLengthChanged() + { + if (_lastLength != GetLength()) + { + RaisePropertyChanged(nameof(Length)); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(GetEstimatedDuration)); + } + } + + private void OnSelectAllChanged() + { + if (Segments != null ) + { + _preventChange = true; + Segments.ToList().ForEach(x => x.IsSelected = SelectAllSegments); + _preventChange = false; + RaisePropertyChanged(nameof(HasSelectedItems)); + } + } + + private void OnInterSegmentlengthChanged() + { + _preventChange = true; + int max = Segments.Max(x => x.SegmentIndex); + Segments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); + _preventChange = false; + } + + #endregion + + #region collapsed mode actions + + public void InsertWhiteGapToSelectedSegments() + { + if (false == Segments.ToList().Any(x => x.IsSelected)) + return; + LogManager.Log("Copy selected segments."); + int max = Segments.Max(x => x.SegmentIndex); + Segments.Where(i => i.IsSelected && i.SegmentIndex != max).ToList().ForEach(y => y.EnableInterSegment = true); + } + + public void SwapSegments(int index1, int index2) + { + if (index1 < 0 || index1 >= Segments.Count) + return; + if (index2 < 0 || index2 >= Segments.Count) + return; + var tmpIndex = Segments[index2]; + Segments[index2] = Segments[index1]; + Segments[index1] = tmpIndex; + } + + #endregion + + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs new file mode 100644 index 000000000..3b4644a8d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -0,0 +1,735 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Threading; +using Tango.SharedUI; +using System.Windows; +using System.Windows.Media; +using System.Collections.Specialized; +using System.Reflection; +using Tango.BL.Enumerations; +using System.Diagnostics; +using Tango.Core.Commands; +using Tango.PPC.Jobs.UndoRedoCommands; + +namespace Tango.PPC.Jobs.Models +{ + public class SegmentModel : ViewModel + { + private double _lastLength; + private LinearGradientBrush _brush; + private ActionTimer _brushStopCollectionChangedActionTimer; + + #region Properties + + public string GUID { get; set; } + + protected String _name; + /// <summary> + /// Gets or sets the SegmentModel name. + /// </summary> + public String Name + { + get + { + return _name; + } + + set + { + if (_name != value) + { + _name = value; + RaisePropertyChangedAuto(); + } + } + } + protected Double _length; + /// <summary> + /// Gets or sets the length. + /// </summary> + public Double Length + { + get + { + return _length; + } + set + { + if (_length != value) + { + _length = value; + OnLengthChanged(value); + RaisePropertyChangedAuto(); + } + } + } + public void LengthBeforeChange(double value) + { + _lastLength = Length; + } + + public void LengthChanged(double value) + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeLengthCommand(this, _lastLength, value)); + _lastLength = Length; + } + + protected Int32 _segmentindex; + /// <summary> + /// Gets or sets the index of the segment. + /// </summary> + public Int32 SegmentIndex + { + get + { + return _segmentindex; + } + set + { + if (_segmentindex != value) + { + _segmentindex = value; + RaisePropertyChangedAuto(); + } + } + } + private bool _isInterSegment; + /// <summary> + /// Gets or sets a value indicating whether this segment is an inter segment. + /// </summary> + public bool IsInterSegment + { + get { return _isInterSegment; } + set { _isInterSegment = value; + RaisePropertyChangedAuto(); } + } + + protected Boolean _enableintersegment; + public Boolean EnableInterSegment + { + get { return _enableintersegment; } + set + { + if (_enableintersegment != value) + { + _enableintersegment = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(LengthWithInterSegment)); + RaisePropertyChanged(nameof(InterSegmentLength)); + } + } + } + + public double LengthWithInterSegment + { + get + { + if (Job != null && !IsInterSegment) + { + // var length = Length;// + Length * (Job.LengthPercentageFactor / 100); + return EnableInterSegment ? (Length + Job.InterSegmentLength) : Length; + } + return Length; + // return Job != null && !IsInterSegment ? (Length + Length * (Job.LengthPercentageFactor / 100)) : Length; + } + } + + public double InterSegmentLength + { + get { return Job == null ? 0 : Job.InterSegmentLength; } + } + + protected SynchronizedObservableCollection<BrushStopModel> _brushstops; + + /// <summary> + /// Gets or sets the segmentbase brush stops. + /// </summary> + + public SynchronizedObservableCollection<BrushStopModel> BrushStops + { + get + { + return _brushstops; + } + + set + { + if (_brushstops != value) + { + _brushstops = value; + OnBrushStopsChanged(_brushstops); + RaisePropertyChangedAuto(); + } + } + } + + private JobModel _job; + + public JobModel Job + { + get + { + return _job; + } + + set + { + if (_job != value) + { + _job = value; + } + } + } + + public Brush SegmentBrush + { + get + { + return GetSegmentBrush(); + } + } + + public bool IsOffsetChanged { get; set; } + + public double LeftOffset + { + get { return FirstBrushStop != null? FirstBrushStop.OffsetPercent : 0; } + set { + if (FirstBrushStop != null && FirstBrushStop.OffsetPercent != value) + { + FirstBrushStop.OffsetPercent = value; + RaisePropertyChangedAuto(); + IsOffsetChanged = true; + RaisePropertyChanged(nameof(SegmentBrush)); + IsOffsetChanged = false; + } + } + } + + private double _leftOffsetChangeComleted; + + public double LeftOffsetChangeComleted + { + get { return _leftOffsetChangeComleted; } + set { + if(_leftOffsetChangeComleted != value) + { + _leftOffsetChangeComleted = value; + RaisePropertyChangedAuto(); + UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, LeftOffsetStartChanging, _leftOffsetChangeComleted, OffsetType.Left)); + } + } + } + + private double _leftOffsetStartChanging; + + public double LeftOffsetStartChanging + { + get { return _leftOffsetStartChanging; } + set + { + _leftOffsetStartChanging = value; + RaisePropertyChangedAuto(); + } + } + + public double MiddleOffset + { + get { return (MiddleBrushStop != null) ? MiddleBrushStop.OffsetPercent : 50; } + set { + + if (MiddleBrushStop != null && MiddleBrushStop.OffsetPercent != value) + { + MiddleBrushStop.OffsetPercent = value; + RaisePropertyChangedAuto(); + IsOffsetChanged = true; + RaisePropertyChanged(nameof(SegmentBrush)); + IsOffsetChanged = false; + } + } + } + + private double _middleOffsetChangeComleted; + + public double MiddleOffsetChangeComleted + { + get { return _middleOffsetChangeComleted; } + set + { + if (_middleOffsetChangeComleted != value) + { + _middleOffsetChangeComleted = value; + RaisePropertyChangedAuto(); + UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, MiddleOffsetStartChanging, _middleOffsetChangeComleted, OffsetType.Middle)); + } + } + } + + private double _middleOffsetStartChanging; + + public double MiddleOffsetStartChanging + { + get { return _middleOffsetStartChanging; } + set + { + _middleOffsetStartChanging = value; + RaisePropertyChangedAuto(); + } + } + public double RightOffset + { + get { return SecondBrushStop != null ? SecondBrushStop.OffsetPercent: 100; } + set { + + if (SecondBrushStop != null && SecondBrushStop.OffsetPercent != value) + { + SecondBrushStop.OffsetPercent = value; + RaisePropertyChangedAuto(); + IsOffsetChanged = true; + RaisePropertyChanged(nameof(SegmentBrush)); + IsOffsetChanged = false; + } + } + } + + private double _rightOffsetChangeComleted; + + public double RightOffsetChangeComleted + { + get { return _rightOffsetChangeComleted; } + set + { + if (_rightOffsetChangeComleted != value) + { + _rightOffsetChangeComleted = value; + RaisePropertyChangedAuto(); + UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, RightOffsetStartChanging, _rightOffsetChangeComleted, OffsetType.Right)); + } + } + } + + private double _rightOffsetStartChanging; + + public double RightOffsetStartChanging + { + get { return _rightOffsetStartChanging; } + set + { + _rightOffsetStartChanging = value; + RaisePropertyChangedAuto(); + } + } + + public bool HasColors + { + get + { + return BrushStops.Count > 0; + } + } + + public bool IsGradient + { + get + { + return BrushStops.Count > 1; + } + } + + /// <summary> + /// Gets the second brush stop. + /// </summary> + public BrushStopModel SecondBrushStop + { + get + { + if (BrushStops.Count > 1) + return BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.SecondColor).FirstOrDefault(); + + return null; + } + } + + /// <summary> + /// Gets the first brush stop. + /// </summary> + public BrushStopModel FirstBrushStop + { + get + { + if(BrushStops.Count > 0) + { + var brushStop = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor).FirstOrDefault(); + return brushStop; + } + + return null; + } + + } + + /// <summary> + /// Gets the middle brush stop. + /// </summary> + public BrushStopModel MiddleBrushStop + { + get + { + if (BrushStops.Count > 1) + return BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.Middle).FirstOrDefault(); + + return null; + } + } + + public bool HasOutOfGamutBrush + { + get + { + bool hasError = (FirstBrushStop != null && FirstBrushStop.IsOutOfGamut) + || (SecondBrushStop != null && SecondBrushStop.IsOutOfGamut); + + return hasError; + } + } + + private bool _isSelected; + + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isLast; + + public bool IsLast + { + get { return _isLast; } + set { _isLast = value; + RaisePropertyChangedAuto(); + } + } + + #endregion + + #region command + + public RelayCommand AddGapCommand { get; set; } + public RelayCommand DeleteGapCommand { get; set; } + #endregion + + public SegmentModel(JobModel jobModel, string guid) + { + InitnewSegment(); + Job = jobModel; + GUID = guid; + IsLast = false; + EnableInterSegment = jobModel.InterSegmentLength > 0; + } + + public SegmentModel() + { + GUID = ""; + InitnewSegment(); + } + + public void InitnewSegment() + { + BrushStops = new SynchronizedObservableCollection<BrushStopModel>(); + LeftOffset = 0; + MiddleOffset = 50; + RightOffset = 100; + IsOffsetChanged = false; + Length = 5; + _lastLength = 5; + IsSelected = false; + IsLast = false; + _enableintersegment = false; + AddGapCommand = new RelayCommand(x => AddGap()); + DeleteGapCommand = new RelayCommand(x => DeleteGap()); + } + #region Public Methods + + /// <summary> + /// Gets the segment brush. + /// </summary> + /// <returns></returns> + public LinearGradientBrush GetSegmentBrush() + { + if (_brush == null || _brush.GradientStops.Count != BrushStops.Count || IsOffsetChanged) + { + GradientStopCollection stops = new GradientStopCollection(); + foreach (var stop in BrushStops.ToList().OrderBy(x => x.StopIndex).ToList()) + { + //TODO test if displayed is valid stop.IsValid + + Color color = stop.BestMatchColor; + stops.Add(new GradientStop( color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0, 0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + _brush = brush; + return brush; + } + else + { + for (int i = 0; i < BrushStops.Count; i++) + { + //TODO test if displayed is valid stop.IsValid + Color color = BrushStops[i].BestMatchColor; + _brush.GradientStops[i].Color = color; + _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; + } + + return _brush; + } + } + + public SegmentModel Clone() + { + var cloned = new SegmentModel(Job, GUID);//(SegmentModel)Activator.CreateInstance(typeof(SegmentModel), this.Job); + + cloned.Name = Name; + cloned.LeftOffset = LeftOffset; + cloned.MiddleOffset = MiddleOffset; + cloned.RightOffset = RightOffset; + cloned.IsOffsetChanged = IsOffsetChanged; + cloned.Length = Length; + cloned.IsSelected = false; + cloned.IsInterSegment = IsInterSegment; + cloned.EnableInterSegment = EnableInterSegment; + cloned.BrushStops = BrushStops.Select(x => x.Clone()).ToSynchronizedObservableCollection(); + + cloned.SegmentIndex = SegmentIndex + 1; + + return cloned; + } + + public static SegmentModel CreateInterSegment(double length) + { + return new SegmentModel() + { + IsInterSegment = true, + Length = length, + Name = "Inter Segment", + BrushStops = new SynchronizedObservableCollection<BrushStopModel>() + + }; + } + /// <summary> + /// Creates the gradient brushes. + /// </summary> + public void CreateGradientBrushes(BrushStopModel firstBrush, BrushStopModel secondBrush) + { + BrushStops.Clear(); + BrushStopModel brushStop = firstBrush.Clone(); + brushStop.StopIndex = 1; + brushStop.OffsetPercent = 0; + brushStop.Position = BrushStopModel.PositionStatus.First; + brushStop.IsOutOfGamut = false; + BrushStops.Add(brushStop); + + BrushStopModel colorbrushStop = firstBrush.Clone(); + colorbrushStop.Position = BrushStopModel.PositionStatus.FirstColor; + colorbrushStop.StopIndex = 2; + colorbrushStop.OffsetPercent = 0; + BrushStops.Add(colorbrushStop); + + BrushStopModel middleBrushStop = firstBrush.Clone(); + middleBrushStop.StopIndex = 3; + middleBrushStop.Position = BrushStopModel.PositionStatus.Middle; + middleBrushStop.OffsetPercent = 50; + middleBrushStop.IsOutOfGamut = false; + middleBrushStop.Color = BrushStopModel.GetRelativeRGB(firstBrush.Color, secondBrush.Color, 0, 1, 0.5); + middleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(firstBrush.BestMatchColor, secondBrush.BestMatchColor, 0, 1, 0.5); + BrushStops.Add(middleBrushStop); + + AddOrReplaceSecondBrush(secondBrush); + } + + public void AddOrReplaceSecondBrush(BrushStopModel secondBrush) + { + RemoveSecondColorOfGradient(); + + BrushStopModel secondbrushStop = secondBrush.Clone(); + secondbrushStop.StopIndex = 4; + secondbrushStop.Position = BrushStopModel.PositionStatus.SecondColor; + secondbrushStop.OffsetPercent = 100; + BrushStops.Add(secondbrushStop); + + BrushStopModel lastSecondBrushStop = secondBrush.Clone(); + lastSecondBrushStop.StopIndex = 5; + lastSecondBrushStop.OffsetPercent = 100; + lastSecondBrushStop.IsOutOfGamut = false; + lastSecondBrushStop.Position = BrushStopModel.PositionStatus.Last; ; + BrushStops.Add(lastSecondBrushStop); + } + + public void SetNewColor(BrushStopModel target, BrushStopModel source ) + { + target.SetNewColor(source); + target.IsOutOfGamut = source.IsOutOfGamut; + if (target.Position == BrushStopModel.PositionStatus.FirstColor) + { + BrushStopModel first = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.First).FirstOrDefault(); + if(first != null) + { + first.SetNewColor(source); + first.IsOutOfGamut = source.IsOutOfGamut; + } + } + else if(target.Position == BrushStopModel.PositionStatus.SecondColor) + { + BrushStopModel last = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.Last).FirstOrDefault(); + if(last != null) + { + last.SetNewColor(source); + last.IsOutOfGamut = source.IsOutOfGamut; + } + } + UpdateMiddleColorBrush(); + RaiseSegmentBrushChanged(); + } + + public void UpdateMiddleColorBrush() + { + if (MiddleBrushStop != null && SecondBrushStop != null && FirstBrushStop != null) + { + MiddleBrushStop.Color = BrushStopModel.GetRelativeRGB(FirstBrushStop.Color, SecondBrushStop.Color, 0, 1, 0.5); + MiddleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(FirstBrushStop.BestMatchColor, SecondBrushStop.BestMatchColor, 0, 1, 0.5); + } + } + + public void RemoveSecondColorOfGradient() + { + if (BrushStops.Count < 5) + return ; + BrushStops.RemoveAt(4); + BrushStops.RemoveAt(3); + } + + public void ArrangeBrushStopsIndexes() + { + for (int i = 0; i < BrushStops.Count; i++) + { + BrushStops[i].StopIndex = i + 1; + } + ArrangeBrushStopsPosition(); + } + + public void ArrangeBrushStopsPosition() + { + if (BrushStops.Count == 1) + { + BrushStops.FirstOrDefault().Position = BrushStopModel.PositionStatus.FirstColor; + } + else if (BrushStops.Count > 1) + BrushStops.ToList().ForEach(x => x.Position = (BrushStopModel.PositionStatus)x.StopIndex); + } + #endregion + + #region Brush Stops Collection Changed + + private void BrushStops_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (_brushStopCollectionChangedActionTimer == null) + { + _brushStopCollectionChangedActionTimer = new ActionTimer(TimeSpan.FromMilliseconds(100)); + } + + _brushStopCollectionChangedActionTimer.ResetReplace(() => + { + foreach (var stop in BrushStops.ToList()) + { + stop.RaiseOffsetChanged(); + } + + if (BrushStops.Count > 0) + { + BrushStops.First().OffsetPercent = 0; + } + if (BrushStops.Count > 1) + { + BrushStops.Last().OffsetPercent = 100; + } + RaiseSegmentBrushChanged(); + }); + } + + /// <summary> + /// Raises the <see cref="SegmentBrush"/> property changed event. + /// </summary> + public void RaiseSegmentBrushChanged() + { + RaisePropertyChanged(nameof(SegmentBrush)); + RaisePropertyChanged(nameof(HasColors)); + RaisePropertyChanged(nameof(IsGradient)); + RaisePropertyChanged(nameof(FirstBrushStop)); + RaisePropertyChanged(nameof(SecondBrushStop)); + RaisePropertyChanged(nameof(HasOutOfGamutBrush)); + } + #endregion + + #region Properties Changed + + /// <summary> + /// Called when the Length has changed. + /// </summary> + /// <param name="length"></param> + protected void OnLengthChanged(double length) + { + //if (_lastLength != length) + { + BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); + //_lastLength = Length; + //RaisePropertyChanged(nameof(LengthWithFactor)); + RaisePropertyChanged(nameof(LengthWithInterSegment)); + } + } + + /// <summary> + /// Called when the BrushStops has changed. + /// </summary> + /// <param name="brushstops"></param> + protected void OnBrushStopsChanged(SynchronizedObservableCollection<BrushStopModel> brushstops) + { + if (brushstops != null) + { + brushstops.CollectionChanged -= BrushStops_CollectionChanged; + brushstops.CollectionChanged += BrushStops_CollectionChanged; + + foreach (var stop in brushstops.ToList()) + { + stop.RaiseOffsetChanged(); + } + + RaiseSegmentBrushChanged(); + } + } + + private void AddGap() + { + EnableInterSegment = true; + } + + private void DeleteGap() + { + EnableInterSegment = false; + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobNavigationObject.cs new file mode 100644 index 000000000..0f5e39872 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobNavigationObject.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.NavigationObjects +{ + /// <summary> + /// Represents a job navigation object. + /// </summary> + public class JobNavigationObject + { + /// <summary> + /// Gets or sets the job. + /// </summary> + public Job Job { get; set; } + + /// <summary> + /// Gets or sets the navigation intent. + /// </summary> + public JobNavigationIntent Intent { get; set; } + } + + /// <summary> + /// Represents different job navigation intents. + /// </summary> + public enum JobNavigationIntent + { + Default, + NewJob, + SampleDye, + FineTuning, + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobSummeryNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobSummeryNavigationObject.cs new file mode 100644 index 000000000..912b42683 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/JobSummeryNavigationObject.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.NavigationObjects +{ + public class JobSummeryNavigationObject + { + public ObservablesContext Context { get; set; } + public Job Job { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/TwineCatalogNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/TwineCatalogNavigationObject.cs new file mode 100644 index 000000000..edd18a2c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NavigationObjects/TwineCatalogNavigationObject.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.NavigationObjects +{ + public class TwineCatalogNavigationObject + { + public ColorCatalog Catalog { get; set; } + public ColorCatalogsItem SelectedItem { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItem.cs new file mode 100644 index 000000000..4e3137e1c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItem.cs @@ -0,0 +1,32 @@ +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.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml new file mode 100644 index 000000000..5a57e3db7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml @@ -0,0 +1,30 @@ +<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.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs new file mode 100644 index 000000000..33db09386 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs @@ -0,0 +1,30 @@ +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.JobsV2/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..41dc27f8b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango PPC Jobs V2 Module")] +[assembly: AssemblyVersion("1.0.0.0")] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.Designer.cs new file mode 100644 index 000000000..69824181c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Jobs.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Jobs.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.Designer.cs new file mode 100644 index 000000000..07b7f7e97 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Jobs.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resources/Styles.xaml new file mode 100644 index 000000000..b1f4b6d49 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resources/Styles.xaml @@ -0,0 +1,48 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Resources"> + + <!--Jobs Grid--> + <Style x:Key="TangoJobsGrid" TargetType="{x:Type touch:LightTouchDataGrid}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGrid}}"> + <Style.Resources> + + <Style TargetType="{x:Type touch:LightTouchDataGridHeaderRow}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridHeaderRow}}"> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoLowAccentBrush}"></Setter> + <Setter Property="Height" Value="68"></Setter> + <Setter Property="Margin" Value="5 0 5 5"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect BlurRadius="5" ShadowDepth="1" Color="Silver" /> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type touch:LightTouchDataGridRow}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridRow}}"> + <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoLightBorderBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Margin" Value="5 4"></Setter> + <Setter Property="Height" Value="78"></Setter> + <!--<Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect BlurRadius="5" ShadowDepth="1" Color="{StaticResource TangoDropShadowColor}" /> + </Setter.Value> + </Setter>--> + </Style> + + <Style TargetType="{x:Type touch:LightTouchDataGridCell}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridCell}}"> + + </Style> + </Style.Resources> + </Style> + <!--Jobs Grid--> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj new file mode 100644 index 000000000..a38818ffb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -0,0 +1,633 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{DBBD90F4-4135-475D-A8F8-6795D3A8F697}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.Jobs</RootNamespace> + <AssemblyName>Tango.PPC.JobsV2</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>TRACE;DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="AppBarItems\JobProgressAppBarItemView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Controls\RunningJobViewer.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Controls\JobSummeryViewer.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Controls\TwineCatalogViewer.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\AddSegmentWarningDialog.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\AdvancedColorCorrectionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\BasicColorCorrectionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\ColorSelectionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\ImportCsvJobView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\ImportTwnFileView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\ImportColorProfileView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\FineTuningPaletteView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\ColorProfileReceivedView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\ImportJobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\CatalogSelectionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\JobCreationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\RepeatJobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\SpoolChangeView.xaml"> + <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> + </Page> + <Page Include="Views\JobProgressView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\JobsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\JobSummeryView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\JobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\TwineCatalogView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="AppBarItems\JobProgressAppBarItem.cs" /> + <Compile Include="AppBarItems\JobProgressAppBarItemView.xaml.cs"> + <DependentUpon>JobProgressAppBarItemView.xaml</DependentUpon> + </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> + <Compile Include="Controls\JobSummeryViewer.xaml.cs"> + <DependentUpon>JobSummeryViewer.xaml</DependentUpon> + </Compile> + <Compile Include="Controls\TwineCatalogViewer.xaml.cs"> + <DependentUpon>TwineCatalogViewer.xaml</DependentUpon> + </Compile> + <Compile Include="Converters\ColorSpaceToImageConverter.cs" /> + <Compile Include="Converters\ColorSpaceToVisibilityConverter.cs" /> + <Compile Include="Converters\ColorTabToVisibilityConverter.cs" /> + <Compile Include="Converters\JobsCategoryToOpacityConverter.cs" /> + <Compile Include="Converters\JobProgressToPositionConverter.cs" /> + <Compile Include="Converters\JobsCategoryToVisibilityConverter.cs" /> + <Compile Include="Converters\JobToEmbroideryImageConverter.cs" /> + <Compile Include="Converters\JobToPieImageConverter.cs" /> + <Compile Include="Converters\JobTypeToImageConverter.cs" /> + <Compile Include="Dialogs\AddSegmentWarningDialog.xaml.cs"> + <DependentUpon>AddSegmentWarningDialog.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\AddSegmentWarningDialogVM.cs" /> + <Compile Include="Dialogs\AdvancedColorCorrectionView.xaml.cs"> + <DependentUpon>AdvancedColorCorrectionView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\AdvancedColorCorrectionViewVM.cs" /> + <Compile Include="Dialogs\BasicColorCorrectionView.xaml.cs"> + <DependentUpon>BasicColorCorrectionView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\BasicColorCorrectionViewVM.cs" /> + <Compile Include="Dialogs\ColorSelectionView.xaml.cs"> + <DependentUpon>ColorSelectionView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportCsvJobView.xaml.cs"> + <DependentUpon>ImportCsvJobView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportCsvJobViewVM.cs" /> + <Compile Include="Dialogs\ImportTwnFileView.xaml.cs"> + <DependentUpon>ImportTwnFileView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportColorProfileView.xaml.cs"> + <DependentUpon>ImportColorProfileView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportTwnFileViewVM.cs" /> + <Compile Include="Dialogs\ImportColorProfileViewVM.cs" /> + <Compile Include="Dialogs\FineTuningPaletteView.xaml.cs"> + <DependentUpon>FineTuningPaletteView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\FineTuningPaletteViewVM.cs" /> + <Compile Include="Dialogs\ColorProfileReceivedView.xaml.cs"> + <DependentUpon>ColorProfileReceivedView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportJobView.xaml.cs"> + <DependentUpon>ImportJobView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ColorProfileReceivedViewVM.cs" /> + <Compile Include="Dialogs\ImportJobViewVM.cs" /> + <Compile Include="Dialogs\CatalogSelectionView.xaml.cs"> + <DependentUpon>CatalogSelectionView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\JobCreationView.xaml.cs"> + <DependentUpon>JobCreationView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\CatalogSelectionViewVM.cs" /> + <Compile Include="Dialogs\JobCreationViewVM.cs" /> + <Compile Include="Dialogs\RepeatJobView.xaml.cs"> + <DependentUpon>RepeatJobView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\RepeatJobViewVM.cs" /> + <Compile Include="Dialogs\SpoolChangeView.xaml.cs"> + <DependentUpon>SpoolChangeView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\SpoolChangeViewVM.cs" /> + <Compile Include="JobsV2Module.cs" /> + <Compile Include="JobsModuleSettings.cs" /> + <Compile Include="Messages\JobSelectedMessage.cs" /> + <Compile Include="Messages\NavigatedToJobsModuleMessage.cs" /> + <Compile Include="Models\BrushStopModel.cs" /> + <Compile Include="Models\JobModel.cs" /> + <Compile Include="Models\SegmentModel.cs" /> + <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> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="UndoRedoCommands\AddBrushStopCommand.cs" /> + <Compile Include="UndoRedoCommands\AddNewSegmentCommand.cs" /> + <Compile Include="UndoRedoCommands\ChangeLengthCommand.cs" /> + <Compile Include="UndoRedoCommands\ChangeOffsetCommand.cs" /> + <Compile Include="UndoRedoCommands\CopySegmentCommand.cs" /> + <Compile Include="UndoRedoCommands\DuplicateSegmentCommand.cs" /> + <Compile Include="UndoRedoCommands\EditBrushStopColorCommand.cs" /> + <Compile Include="UndoRedoCommands\IUndoRedoCommand.cs" /> + <Compile Include="UndoRedoCommands\PasteSegmentsCommand.cs" /> + <Compile Include="UndoRedoCommands\RemoveSegmentCommand.cs" /> + <Compile Include="UndoRedoCommands\RemoveSegmentsCommand.cs" /> + <Compile Include="UndoRedoCommands\ReverseCommand.cs" /> + <Compile Include="UndoRedoCommands\UndoRedoManager.cs" /> + <Compile Include="ViewContracts\IJobsView.cs" /> + <Compile Include="ViewContracts\IJobView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="Dialogs\ColorSelectionViewVM.cs" /> + <Compile Include="ViewModels\JobProgressViewVM.cs" /> + <Compile Include="ViewModels\JobSummeryViewVM.cs" /> + <Compile Include="ViewModels\JobsViewVM.cs" /> + <Compile Include="ViewModels\JobViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\TwineCatalogViewVM.cs" /> + <Compile Include="Views\JobProgressView.xaml.cs"> + <DependentUpon>JobProgressView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JobsView.xaml.cs"> + <DependentUpon>JobsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JobSummeryView.xaml.cs"> + <DependentUpon>JobSummeryView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JobView.xaml.cs"> + <DependentUpon>JobView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\TwineCatalogView.xaml.cs"> + <DependentUpon>TwineCatalogView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\ColorMine\ColorMine.csproj"> + <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> + <Name>ColorMine</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.ColorConversion\Tango.ColorConversion.csproj"> + <Project>{b4fe6485-4161-4b36-bc08-67e0b53d01b7}</Project> + <Name>Tango.ColorConversion</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.ColorPickers\Tango.ColorPickers.csproj"> + <Project>{f9df9435-a4f3-43c5-a6cd-aad6689b42ae}</Project> + <Name>Tango.ColorPickers</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399AF76-DB52-4CFB-8020-6F85BDB29FD5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Hive\Tango.Hive.csproj"> + <Project>{942134ac-6ea2-4500-8f22-0f739b70a05f}</Project> + <Name>Tango.Hive</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206AC58-3B57-4699-8835-90BF6DB01A61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Pulse\Tango.Pulse.csproj"> + <Project>{8435223d-db6b-45e3-a08b-45b7416f8481}</Project> + <Name>Tango.Pulse</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.PPC.Storage\Tango.PPC.Storage.csproj"> + <Project>{04febb02-f782-4b96-b47d-f6902afa43be}</Project> + <Name>Tango.PPC.Storage</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\jobs-module.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\liquid.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\arrows.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Job Issues\cyan.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\warning.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\pantone.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\job-details.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\delete.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\remove.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\output.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\color-length.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\additional-tools.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\job-summary.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\settings.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\error.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\replace-color.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\twine-catalog.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobProgressView\drop.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobProgressView\clock.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\sample-dye.png" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Images\NotificationItems\" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\color-fine-tuning.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\color-picker.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Sewing.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Embroidery.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Knitting.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\job.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\spool_change.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\spool_replace.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\color_approved_small.png" /> + <Resource Include="Images\sample_approved_small.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\color_approved_small_gray.png" /> + <Resource Include="Images\sample_approved_small_gray.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\NewJob\coats.png" /> + <Resource Include="Images\NewJob\lab.png" /> + <Resource Include="Images\NewJob\rgb.png" /> + <Resource Include="Images\NewJob\twine.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\length.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\jobs.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\NewJob\volume.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\snapmatch.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\emb-file.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Coats\coats.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Coats\coats-sylko-logo.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Coats\thread.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\plus.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\pencil-blue.png" /> + <Resource Include="Images\pencil-gray.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\large-cards-view - blue.png" /> + <Resource Include="Images\large-cards-view.png" /> + <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> + <ItemGroup> + <Resource Include="Images\csv.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ColorSelection\Heart.png" /> + <Resource Include="Images\ColorSelection\Red_heart.png" /> + <Resource Include="Images\ColorSelection\Triangle.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ColorSelection\arrow-round-back.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\AddColor.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\Edit_color.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\SliderThumb.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\Exclamation_black.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\undo.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\AddNewSegment.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ColorSelection\Exclamation.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\delete_segment.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\duplicate.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\job_details.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\job_mode.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\paste.png" /> + <Resource Include="Images\JobView\reverse.png" /> + <Resource Include="Images\JobView\white_gap.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\redo.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\add_gap.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\repeat.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\NewJob\job_export.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddBrushStopCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddBrushStopCommand.cs new file mode 100644 index 000000000..35d1629e0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddBrushStopCommand.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class AddBrushStopCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private SegmentModel _segment; + private SegmentModel _createdNewSegment; + private BrushStopModel _brushStopModelToAdd; + + public AddBrushStopCommand(JobModel job, SegmentModel segment, BrushStopModel addedbrush) + { + _jobModel = job; + _segment = segment; + _brushStopModelToAdd = addedbrush; + _createdNewSegment = null; + } + + public void Execute() + { + if (_segment == null) + return; + //SolidColor + if (_segment.BrushStops.Count == 0) + { + _brushStopModelToAdd.Position = BrushStopModel.PositionStatus.FirstColor; + _segment.BrushStops.Add(_brushStopModelToAdd); + } + //Add Second BrushStop + else if (_segment.BrushStops.Count == 1)// add gradient + { + BrushStopModel currentBrushStop = _segment.BrushStops[0]; + _segment.CreateGradientBrushes(_segment.BrushStops[0], _brushStopModelToAdd); + _segment.RaiseSegmentBrushChanged(); + } + else //Create new Segment and Add BrushStop + { + _createdNewSegment = _segment.Clone(); + var length = _segment.Length / 2; + _createdNewSegment.Length = length; + _segment.Length = length; + _createdNewSegment.SegmentIndex = _segment.SegmentIndex + 1; + _createdNewSegment.CreateGradientBrushes(_brushStopModelToAdd, _segment.SecondBrushStop); + _createdNewSegment.RaiseSegmentBrushChanged(); + + _segment.AddOrReplaceSecondBrush(_brushStopModelToAdd); + _segment.UpdateMiddleColorBrush(); + _segment.RaiseSegmentBrushChanged(); + _segment.ArrangeBrushStopsIndexes(); + _createdNewSegment.ArrangeBrushStopsIndexes(); + + if (_jobModel.Segments.Count == _segment.SegmentIndex) + _jobModel.Segments.Add(_createdNewSegment); + else + { + _jobModel.Segments.Insert(_segment.SegmentIndex, _createdNewSegment); + } + } + } + + public void UnExecute() + { + if (_segment == null) + return; + + if (_createdNewSegment != null) + { + BrushStopModel secondbrush = _createdNewSegment.SecondBrushStop; + _segment.AddOrReplaceSecondBrush(secondbrush); + _segment.UpdateMiddleColorBrush(); + _segment.RaiseSegmentBrushChanged(); + _segment.ArrangeBrushStopsIndexes(); + _jobModel.Segments.Remove(_createdNewSegment); + //delete + } + else if(_segment.IsGradient) + { + BrushStopModel firstbrush = _segment.FirstBrushStop; + _segment.BrushStops.Clear(); + _segment.BrushStops.Add(firstbrush); + _segment.ArrangeBrushStopsIndexes(); + } + else if(_segment.BrushStops.Count == 1) + { + _segment.BrushStops.Clear(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddNewSegmentCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddNewSegmentCommand.cs new file mode 100644 index 000000000..60128b7d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/AddNewSegmentCommand.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class AddNewSegmentCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private SegmentModel _newSegment; + private int _index; + private double _defaultLength; + + public AddNewSegmentCommand(JobModel job, Int32 segmentIndex, double defaultLength) + { + _jobModel = job; + _index = segmentIndex; + _defaultLength = defaultLength; + } + + public void Execute() + { + _newSegment = _jobModel.AddNewSegment(_defaultLength, _index); + } + + public void UnExecute() + { + _jobModel.Segments.Remove(_newSegment); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeLengthCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeLengthCommand.cs new file mode 100644 index 000000000..558242c48 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeLengthCommand.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class ChangeLengthCommand : IUndoRedoCommand + { + private SegmentModel _segment; + private double _oldValue; + private double _newValue; + + public ChangeLengthCommand(SegmentModel segment, double oldvalue, double newValue) + { + _segment = segment; + _oldValue = oldvalue; + _newValue = newValue; + } + + public void Execute() + { + if (_segment == null) + return; + + _segment.Length = _newValue; + } + + public void UnExecute() + { + if (_segment == null) + return; + + _segment.Length = _oldValue; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeOffsetCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeOffsetCommand.cs new file mode 100644 index 000000000..d96817335 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ChangeOffsetCommand.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public enum OffsetType{ Left, Middle, Right}; + + public class ChangeOffsetCommand : IUndoRedoCommand + { + private SegmentModel _segment; + private double _oldValue; + private double _newValue; + private OffsetType _type; + + public ChangeOffsetCommand(SegmentModel segment, double oldvalue, double newValue, OffsetType type) + { + _segment = segment; + _oldValue = oldvalue; + _newValue = newValue; + _type = type; + } + public void Execute() + { + if (_segment == null) + return; + + switch (_type) + { + case OffsetType.Left: + { + _segment.LeftOffset = _newValue; + break; + } + case OffsetType.Middle: + { + _segment.MiddleOffset = _newValue; + break; + } + case OffsetType.Right: + { + _segment.RightOffset = _newValue; + break; + } + default: break; + + } + } + + public void UnExecute() + { + if (_segment == null) + return; + + switch (_type) + { + case OffsetType.Left: + { + _segment.LeftOffset = _oldValue; + break; + } + case OffsetType.Middle: + { + _segment.MiddleOffset = _oldValue; + break; + } + case OffsetType.Right: + { + _segment.RightOffset = _oldValue; + break; + } + default: break; + + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/CopySegmentCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/CopySegmentCommand.cs new file mode 100644 index 000000000..059fd4bec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/CopySegmentCommand.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class CopySegmentCommand : IUndoRedoCommand + { + private JobModel _jobModel; + + public CopySegmentCommand(JobModel jobModel) + { + _jobModel = jobModel; + } + public void Execute() + { + if (false == _jobModel.Segments.ToList().Any(x => x.IsSelected)) + return; + //LogManager.Log("Copy selected segments."); + + foreach (var segment in _jobModel.Segments.Where(i => i.IsSelected).ToList()) + { + SegmentModel newSegmentModel = segment.Clone(); + newSegmentModel.SegmentIndex = segment.SegmentIndex + 1; + _jobModel.SegmentsToCopy.Add(newSegmentModel); + } + } + + public void UnExecute() + { + _jobModel.SegmentsToCopy.Clear(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/DuplicateSegmentCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/DuplicateSegmentCommand.cs new file mode 100644 index 000000000..24a82d2a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/DuplicateSegmentCommand.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + class DuplicateSegmentCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private SegmentModel _copySegment; + + public DuplicateSegmentCommand(JobModel job, SegmentModel segment) + { + _jobModel = job; + _copySegment = segment.Clone(); + _copySegment.SegmentIndex = segment.SegmentIndex + 1; + _copySegment.RaiseSegmentBrushChanged(); + } + + public void Execute() + { + if (_jobModel.Segments.Count < _copySegment.SegmentIndex) + _jobModel.Segments.Add(_copySegment); + else + { + _jobModel.Segments.Insert(_copySegment.SegmentIndex-1, _copySegment); + } + } + + public void UnExecute() + { + _jobModel.Segments.Remove(_copySegment); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/EditBrushStopColorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/EditBrushStopColorCommand.cs new file mode 100644 index 000000000..9ec3a3cbe --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/EditBrushStopColorCommand.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + class EditBrushStopColorCommand : IUndoRedoCommand + { + private SegmentModel _segment; + private BrushStopModel _brushStopOld; + private BrushStopModel _brushStopNew; + private BrushStopModel _brushStopCopy; + + public EditBrushStopColorCommand( SegmentModel segment, BrushStopModel currentbrush, BrushStopModel newbrush) + { + _segment = segment; + _brushStopOld = currentbrush; + _brushStopNew = newbrush; + _brushStopCopy = currentbrush.Clone(); + + + } + + public void Execute() + { + _segment.SetNewColor(_brushStopOld, _brushStopNew); + } + + public void UnExecute() + { + _segment.SetNewColor(_brushStopOld, _brushStopCopy); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/IUndoRedoCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/IUndoRedoCommand.cs new file mode 100644 index 000000000..09c2df4c3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/IUndoRedoCommand.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public interface IUndoRedoCommand + { + void Execute(); + void UnExecute(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/PasteSegmentsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/PasteSegmentsCommand.cs new file mode 100644 index 000000000..4d9915449 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/PasteSegmentsCommand.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class PasteSegmentsCommand : IUndoRedoCommand + { + private JobModel _jobModel; + public List<SegmentModel> SegmentsToCopy { get; set; } + public int _selectedIndex; + + public PasteSegmentsCommand(JobModel jobModel) + { + _jobModel = jobModel; + + SegmentsToCopy = new List<SegmentModel>(_jobModel.SegmentsToCopy); + _selectedIndex = _jobModel.Segments.OrderBy(x => x.SegmentIndex).ToList().FindIndex(x => x.IsSelected); + } + + public void Execute() + { + if (SegmentsToCopy.Count == 0) + { + return; + } + SegmentsToCopy.ForEach(x => x.RaiseSegmentBrushChanged()); + + if (_selectedIndex == -1 || _selectedIndex == (_jobModel.Segments.Count) - 1) + { + foreach (var newSegmentModel in SegmentsToCopy) + { + _jobModel.Segments.Add(newSegmentModel); + } + } + else + { + int selctedIndex = _selectedIndex; + foreach (var newSegmentModel in SegmentsToCopy) + { + selctedIndex++; + _jobModel.Segments.Insert(selctedIndex, newSegmentModel); + } + } + _jobModel.SegmentsToCopy.Clear(); + } + + public void UnExecute() + { + foreach (var segment in SegmentsToCopy) + { + _jobModel.Segments.Remove(segment); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentCommand.cs new file mode 100644 index 000000000..90ef92924 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentCommand.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class RemoveSegmentCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private SegmentModel _removedSegment; + private int _index; + + public RemoveSegmentCommand(JobModel job, SegmentModel segment) + { + _jobModel = job; + _removedSegment = segment; + _index = _jobModel.Segments.IndexOf(_removedSegment); + } + + public void Execute() + { + _jobModel.Segments.Remove(_removedSegment); + } + + public void UnExecute() + { + if (_jobModel.Segments.Count <= _index) + _jobModel.Segments.Add(_removedSegment); + else + { + _jobModel.Segments.Insert(_index, _removedSegment); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentsCommand.cs new file mode 100644 index 000000000..db44f176c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/RemoveSegmentsCommand.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class RemoveSegmentsCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private Dictionary<int,SegmentModel> _removedSegmentsDict; + + public RemoveSegmentsCommand(JobModel job ) + { + _jobModel = job; + _removedSegmentsDict = _jobModel.Segments.Select((segm, ind) => new { Index = ind, Segment = segm }).Where(x => x.Segment.IsSelected).ToDictionary(i => i.Index, i => i.Segment); ; + } + + public void Execute() + { + foreach (var obj in _removedSegmentsDict) + { + _jobModel.Segments.Remove(obj.Value); + } + } + + public void UnExecute() + { + foreach (var obj in _removedSegmentsDict) + { + if (_jobModel.Segments.Count <= obj.Key) + _jobModel.Segments.Add(obj.Value); + else + { + _jobModel.Segments.Insert(obj.Key, obj.Value); + } + } + + } + } +} +
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ReverseCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ReverseCommand.cs new file mode 100644 index 000000000..94527d236 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/ReverseCommand.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public class ReverseCommand : IUndoRedoCommand + { + private JobModel _jobModel; + private List<int> _indexes; + + public ReverseCommand(JobModel job) + { + _jobModel = job; + _indexes = _jobModel.Segments.Select((segm, ind) => new { Index = ind, Segment = segm }).Where( x=>x.Segment.IsSelected).Select(t=> t.Index).ToList(); + } + + public void Execute() + { + if (_indexes.Count == 0) + return; + + for (int index = 0, endIndex = _indexes.Count -1; index < _indexes.Count && index < endIndex; index++, endIndex--) + { + int firstIndexToSwap = _indexes[index]; + int lastIndexToSwap = _indexes[endIndex]; + + _jobModel.SwapSegments(firstIndexToSwap, lastIndexToSwap); + } + } + + public void UnExecute() + { + if (_indexes.Count == 0) + return; + + for (int index = 0, endIndex = _indexes.Count - 1; index < _indexes.Count && index < endIndex; index++, endIndex--) + { + int firstIndexToSwap = _indexes[index]; + int lastIndexToSwap = _indexes[endIndex]; + + _jobModel.SwapSegments(firstIndexToSwap, lastIndexToSwap); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/UndoRedoManager.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/UndoRedoManager.cs new file mode 100644 index 000000000..3b926f4eb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/UndoRedoCommands/UndoRedoManager.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.UndoRedoCommands +{ + public sealed class UndoRedoManager + { + private Stack<IUndoRedoCommand> _UndoCommands; + private Stack<IUndoRedoCommand> _RedoCommands; + private bool _isBusy; + + private UndoRedoManager() + { + _UndoCommands = new Stack<IUndoRedoCommand>(); + _RedoCommands = new Stack<IUndoRedoCommand>(); + _isBusy = false; + } + private static readonly Lazy<UndoRedoManager> lazy = new Lazy<UndoRedoManager>(() => new UndoRedoManager()); + public static UndoRedoManager Instance + { + get + { + return lazy.Value; + } + } + + public void InsertAndExecuteCommand(IUndoRedoCommand command) + { + _UndoCommands.Push(command); + command.Execute(); + } + + + public void Redo() + { + if (!_isBusy) + { + _isBusy = true; + + if (_RedoCommands.Count != 0) + { + IUndoRedoCommand command = _RedoCommands.Pop(); + command.Execute(); + _UndoCommands.Push(command); + } + _isBusy = false; + } + } + + public void Undo() + { + if (!_isBusy) + { + _isBusy = true; + if (_UndoCommands.Count != 0) + { + IUndoRedoCommand command = _UndoCommands.Pop(); + command.UnExecute(); + _RedoCommands.Push(command); + } + _isBusy = false; + } + } + + public bool IsEnableUndoOperation() + { + return _UndoCommands.Count() > 0; + } + + public bool IsEnableRedoOperation() + { + return _RedoCommands.Count() > 0; + } + + public void ClearAll() + { + _UndoCommands.Clear(); + _RedoCommands.Clear(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobView.cs new file mode 100644 index 000000000..f63d2959e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobView.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Jobs.ViewContracts +{ + /// <summary> + /// Represents the job view contract. + /// </summary> + /// <seealso cref="Tango.PPC.Common.IPPCView" /> + public interface IJobView : IPPCView + { + /// <summary> + /// Displays the sample dye region. + /// </summary> + void DisplaySampleDye(); + + /// <summary> + /// Displays the fine tuning region. + /// </summary> + void DisplayFineTuning(); + + /// <summary> + /// Scrolls to top. + /// </summary> + void ScrollToTop(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobsView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobsView.cs new file mode 100644 index 000000000..7a8907c36 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewContracts/IJobsView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Jobs.ViewContracts +{ + public interface IJobsView : IPPCView + { + void ScrollToTop(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs new file mode 100644 index 000000000..5298cf096 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Jobs.Dialogs; +using Tango.PPC.Jobs.ViewModels; + +namespace Tango.PPC.Jobs +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<JobsViewVM>(); + TangoIOC.Default.Register<JobSummeryViewVM>(); + TangoIOC.Default.Register<JobViewVM>(); + TangoIOC.Default.Register<TwineCatalogViewVM>(); + TangoIOC.Default.Register<JobProgressViewVM>(); + TangoIOC.Default.Register<ColorSelectionViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + + /// <summary> + /// Gets the jobs list VM. + /// </summary> + public static JobsViewVM JobsViewVM + { + get + { + return TangoIOC.Default.GetInstance<JobsViewVM>(); + } + } + + /// <summary> + /// Gets the job summery VM. + /// </summary> + public static JobSummeryViewVM JobSummeryViewVM + { + get + { + return TangoIOC.Default.GetInstance<JobSummeryViewVM>(); + } + } + + /// <summary> + /// Gets the job details VM. + /// </summary> + public static JobViewVM JobViewVM + { + get + { + return TangoIOC.Default.GetInstance<JobViewVM>(); + } + } + + /// <summary> + /// Gets the twine catalog view VM. + /// </summary> + public static TwineCatalogViewVM TwineCatalogViewVM + { + get + { + return TangoIOC.Default.GetInstance<TwineCatalogViewVM>(); + } + } + + /// <summary> + /// Gets the job progress view VM. + /// </summary> + public static JobProgressViewVM JobProgressViewVM + { + get + { + return TangoIOC.Default.GetInstance<JobProgressViewVM>(); + } + } + + + /// <summary> + /// Gets the twine catalog view VM. + /// </summary> + public static ColorSelectionViewVM ColorSelectionToolViewVM + { + get + { + return TangoIOC.Default.GetInstance<ColorSelectionViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs new file mode 100644 index 000000000..8756a6a57 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.Logging; +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; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Jobs.Views; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the job progress view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class JobProgressViewVM : PPCViewModel + { + private StopPrintingButton _stop_job_btn; + private JobHandler _handler; + + #region Properties + + private Job _job; + /// <summary> + /// Gets or sets the job. + /// </summary> + public Job Job + { + get { return _job; } + set { _job = value; RaisePropertyChangedAuto(); } + } + + private RunningJobStatus _runningJobStatus; + /// <summary> + /// Gets or sets the running job status. + /// </summary> + public RunningJobStatus RunningJobStatus + { + get { return _runningJobStatus; } + 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 + + /// <summary> + /// Gets or sets the go to job command. + /// </summary> + /// <value> + /// The go to job command. + /// </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() + { + _stop_job_btn = new StopPrintingButton(); + _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() + { + JobOutlineTicket = _handler.JobTicket; + IsDisplayJobOutline = true; + } + + private void GoToJob() + { + NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = _handler.Job }); + NavigationManager.ClearHistoryExcept<JobsView>(); + } + + #endregion + + #region Override Methods + + /// <summary> + /// Called when the application has been started. + /// </summary> + public override void OnApplicationStarted() + { + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; + MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + } + + /// <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) + { + _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> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param> + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + { + _handler = e.JobHandler; + Job = e.Job; + 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; + } + + private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) + { + LogManager.Log("Printing ended, popping job stop button..."); + + if (_stop_job_btn != null) + { + _stop_job_btn.Pop(); + } + else + { + LogManager.Log("Job stop button instance was null!", LogCategory.Warning); + } + } + + /// <summary> + /// Handles the SpoolChangeRequired event of the JobHandler. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="SpoolChangeRequiredEventArgs"/> instance containing the event data.</param> + private void JobHandler_SpoolChangeRequired(object sender, SpoolChangeRequiredEventArgs e) + { + InvokeUI(async () => + { + if ((await NotificationProvider.ShowDialog(new SpoolChangeViewVM(e))).DialogResult) + { + e.Confirm(); + } + else + { + e.Abort(); + } + }); + } + + /// <summary> + /// Handles the Stopped event of the JobHandler. + /// </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_Stopped(object sender, EventArgs e) + { + if (_handler != null) + { + _handler.StatusChanged -= JobHandler_StatusChanged; + _handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired; + _handler.Stopped -= JobHandler_Stopped; + _handler.CanCancelChanged -= JobHandler_CanCancelChanged; + } + } + + /// <summary> + /// Handles the JobHandler StatusChanged event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The e.</param> + private void JobHandler_StatusChanged(object sender, RunningJobStatus e) + { + InvokeUI(() => + { + RunningJobStatus = e; + }); + } + + /// <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.JobsV2/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs new file mode 100644 index 000000000..467013607 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.ColorConversion; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.PPC.Common; +using Tango.PPC.Common.Messages; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Jobs.Messages; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Jobs.Views; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the job summary view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class JobSummeryViewVM : PPCViewModel, INavigationObjectReceiver<JobSummeryNavigationObject> + { + private ObservablesContext _context; + private bool _canStartJob; + private bool _startingJob; + + private bool _isPreparingJob; + /// <summary> + /// Gets or sets a value indicating whether the job is currently preparing. + /// </summary> + public bool IsPreparingJob + { + get { return _isPreparingJob; } + set { _isPreparingJob = value; RaisePropertyChangedAuto(); } + } + + + private Job _job; + /// <summary> + /// Gets or sets the job. + /// </summary> + public Job Job + { + get { return _job; } + set { _job = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _estimatedDuration; + /// <summary> + /// Gets or sets the duration of the estimated. + /// </summary> + public TimeSpan EstimatedDuration + { + get { return _estimatedDuration; } + set { _estimatedDuration = value; RaisePropertyChangedAuto(); } + } + + private int _btsrSpoolTension; + public int BtsrSpoolTension + { + get { return _btsrSpoolTension; } + set { _btsrSpoolTension = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the dye command. + /// </summary> + public RelayCommand DyeCommand { get; set; } + + /// <summary> + /// Gets or sets the edit command. + /// </summary> + public RelayCommand EditCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="JobSummeryViewVM"/> class. + /// </summary> + public JobSummeryViewVM() + { + DyeCommand = new RelayCommand(StartJob, () => + { + return _canStartJob; + }); + EditCommand = new RelayCommand(EditJob); + } + + /// <summary> + /// Edits the job. + /// </summary> + private void EditJob() + { + LogManager.Log("Edit command pressed."); + NavigationManager.NavigateTo<JobsV2Module>(false, nameof(JobView)); + } + + /// <summary> + /// Starts the job. + /// </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<JobsV2Module>(false, nameof(JobProgressView)); + _startingJob = false; + } + catch (InsufficientLiquidQuantityException) + { + //Ignore.. + } + catch (OperationCanceledException) + { + //Ignore.. + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not start the current job."); + await NotificationProvider.ShowError($"{ex.Message}"); + } + finally + { + _startingJob = false; + _canStartJob = true; + NavigationManager.IsBackEnabled = true; + InvalidateRelayCommands(); + } + } + + /// <summary> + /// Called when the application has been started. + /// </summary> + public override void OnApplicationStarted() + { + + } + + public async void OnNavigatedToWithObject(JobSummeryNavigationObject obj) + { + _canStartJob = false; + InvalidateRelayCommands(); + + _context = obj.Context; + Job = obj.Job; + + IsPreparingJob = true; + + Job = await new JobBuilder(_context).Set(Job.Guid) + .WithConfiguration() + .WithRML() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); + + if (Job.Rml != null && _context != null) + { + BtsrSpoolTension = await Job.Rml.GetRequiredBtsrSpoolTension(_context, Job.SpoolType); + } + + await Task.Factory.StartNew(() => + { + try + { + IColorConverter _converter = new DefaultColorConverter(); + EstimatedDuration = Job.GetEstimatedDuration(_converter.GetRecommendedProcessParameters(Job, true)); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error calculating recommended process parameters."); + } + }); + + IsPreparingJob = false; + + _canStartJob = true; + InvalidateRelayCommands(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs new file mode 100644 index 000000000..d770dbe51 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -0,0 +1,1330 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.PPC.Common; +using Tango.PPC.Jobs.Messages; +using System.Data.Entity; +using Tango.Core.Commands; +using System.Windows; +using Tango.Touch.Controls; +using System.Windows.Media; +using Tango.DragAndDrop; +using System.ComponentModel; +using System.Windows.Data; +using Tango.PPC.Jobs.Dialogs; +using Tango.PPC.Jobs.Views; +using System.Runtime.InteropServices; +using System.Threading; +using Tango.SharedUI.Helpers; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Jobs.ViewContracts; +using System.Collections.ObjectModel; +using Tango.PPC.Common.Models; +using Tango.Logging; +using Tango.PPC.Common.Messages; +using Tango.BL.Builders; +using Tango.PPC.Jobs.AppButtons; +using Tango.Core.Threading; +using System.Diagnostics; +using System.Runtime.ExceptionServices; +using Tango.Explorer; +using Tango.PPC.Storage; +using System.IO; +using Tango.ColorConversion; +using Tango.Integration.Operation; +using Tango.BL.Enumerations; +using Tango.PPC.Common.Lubrication; +using Tango.PPC.Jobs.Models; +using Tango.Core; +using Tango.PPC.Jobs.UndoRedoCommands; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the selected job view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class JobViewVM : PPCViewModel<IJobView>, INavigationObjectReceiver<JobNavigationObject>, INavigationBlocker + { + private ObservablesContext _db; + private bool _can_navigate_back; + private bool _not_show_warning; + //private Thread _check_gamut_thread; + private Job _job_to_load; + private JobNavigationIntent _job_to_load_intent; + private static Dictionary<String, List<FineTuneItem>> _jobs_fine_tune_items; + public static StartPrintingButton _start_printing_btn; + private ActionTimer _volumeConversionTimer; + private IColorConverter _converter; + private string _current_job_string; + private bool startingJob = false; + private List<ColorCatalog> _catalogs; + + #region Properties + + private Job _job; + /// <summary> + /// Gets or sets the selected job. + /// </summary> + public Job Job + { + get { return _job; } + set + { + _job = value; + RaisePropertyChangedAuto(); + } + } + + private JobModel _jobModel; + + public JobModel JobModel + { + get { return _jobModel; } + set + { + _jobModel = value; + RaisePropertyChangedAuto(); + } + } + + + private ICollectionView _segmentsCollectionView; + /// <summary> + /// Gets or sets the job segments collection view. + /// </summary> + public ICollectionView SegmentsCollectionView + { + get { return _segmentsCollectionView; } + set + { + _segmentsCollectionView = value; + RaisePropertyChangedAuto(); + } + } + + private List<ColorSpace> _colorSpaces; + /// <summary> + /// Gets or sets the available color spaces. + /// </summary> + public List<ColorSpace> ColorSpaces + { + get { return _colorSpaces; } + set { _colorSpaces = value; RaisePropertyChangedAuto(); } + } + + private List<Rml> _rmls; + /// <summary> + /// Gets or sets the available RMLS. + /// </summary> + public List<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + /// <summary> + /// Gets or sets the selected RML. + /// </summary> + public Rml SelectedRML + { + get { return _selectedRML; } + set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); } + } + + private List<SpoolType> _spoolTypes; + /// <summary> + /// Gets or sets the available spool types. + /// </summary> + public List<SpoolType> SpoolTypes + { + get { return _spoolTypes; } + set { _spoolTypes = value; RaisePropertyChangedAuto(); } + } + + private List<Customer> _customers; + /// <summary> + /// Gets or sets the available customers. + /// </summary> + public List<Customer> Customers + { + get { return _customers; } + set { _customers = value; RaisePropertyChangedAuto(); } + } + + private String _customersFilter; + /// <summary> + /// Gets or sets the customers filter. + /// </summary> + public String CustomersFilter + { + get { return _customersFilter; } + set { _customersFilter = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the customers automatic complete provider. + /// </summary> + public AutoCompleteProvider<Customer> CustomersAutoCompleteProvider { get; set; } + + private ObservableCollection<FineTuneItem> _fineTuneItems; + /// <summary> + /// Gets or sets the fine tune items. + /// </summary> + public ObservableCollection<FineTuneItem> FineTuneItems + { + get { return _fineTuneItems; } + set { _fineTuneItems = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<FineTuneItem> _approvalFineTuneItems; + /// <summary> + /// Gets or sets the fine tune items. + /// </summary> + public ObservableCollection<FineTuneItem> ApprovalFineTuneItems + { + get { return _approvalFineTuneItems; } + set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); } + } + + //private bool _isFineTuneExpanded; + ///// <summary> + ///// Gets or sets a value indicating whether the fine tuning region is expanded. + ///// </summary> + //public bool IsFineTuneExpanded + //{ + // get { return _isFineTuneExpanded; } + // set + // { + // _isFineTuneExpanded = value; + // RaisePropertyChangedAuto(); + + // if (_isFineTuneExpanded) + // { + // SyncFineTuneItemsToBrushStops(); + // } + // } + //} + + //private bool _isJobDetailsExpanded; + ///// <summary> + ///// Gets or sets a value indicating whether the job details area is expanded. + ///// </summary> + //public bool IsJobDetailsExpanded + //{ + // get { return _isJobDetailsExpanded; } + // set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); } + //} + + /// <summary> + /// Gets or sets the twine catalog automatic complete provider. + /// </summary> + public IAutoCompleteProvider CatalogAutoCompleteProvider { get; set; } + + private List<ColorCatalog> _availableCatalogs; + public List<ColorCatalog> AvailableCatalogs + { + get { return _availableCatalogs; } + set { _availableCatalogs = value; RaisePropertyChangedAuto(); } + } + + + + private bool _isFullMode; + + public bool IsFullMode + { + get { return _isFullMode; } + set + { + _isFullMode = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isSummaryOpened; + + public bool IsSummaryOpened + { + get { return _isSummaryOpened; } + set { _isSummaryOpened = value; + RaisePropertyChangedAuto(); + } + } + + #endregion + + #region Commands + + /// <summary> + /// Gets or sets the add solid segment command. + /// </summary> + public RelayCommand<Int32> AddNewSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the undo last color command. + /// </summary> + public RelayCommand<SegmentModel> UndoLastColorCommand { get; set; } + + + /// <summary> + /// Gets or sets the remove segment command. + /// </summary> + public RelayCommand<SegmentModel> RemoveSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the copy segment command. + /// </summary> + public RelayCommand<SegmentModel> DuplicateSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the remove job command. + /// </summary> + public RelayCommand<SegmentModel> AddColorCommand { get; set; } + + /// <summary> + /// Gets or sets the remove job command. + /// </summary> + public RelayCommand<BrushStopModel> EditColorCommand { get; set; } + + /// <summary> + /// Gets or sets the replace brush stop command. + /// </summary> + public RelayCommand<BrushStop> ReplaceBrushStopCommand { get; set; } + + /// <summary> + /// Gets or sets the twine catalog field tap command. + /// </summary> + //public RelayCommand<BrushStop> OpenCatalogCommand { get; set; } + + /// <summary> + /// Gets or sets the dye command. + /// </summary> + public RelayCommand DyeCommand { get; set; } + + + /// <summary> + /// Gets or sets the export embroidery command. + /// </summary> + public RelayCommand ExportEmbroideryCommand { get; set; } + + public RelayCommand EditJobDetailsCommand { get; set; } + + public RelayCommand RepeatUnitsCommand { get; set; } + + public RelayCommand JobModeSwitchCommand { get; set; } + + #endregion + + #region collapsed mode commands + + public RelayCommand InsertWhiteGapCommand { get; set; } + + public RelayCommand ReverseCommand { get; set; } + + public RelayCommand DeleteSegmentCommand { get; set; } + + public RelayCommand RepeateSegmentCommand { get; set; } + + public RelayCommand PasteCommand { get; set; } + + public RelayCommand CopyCommand { get; set; } + + public RelayCommand UndoCommand { get; set; } + + public RelayCommand RedoCommand { get; set; } + + #endregion + + #region Constructors + + /// <summary> + /// Initializes the <see cref="JobViewVM"/> class. + /// </summary> + static JobViewVM() + { + + _jobs_fine_tune_items = new Dictionary<string, List<FineTuneItem>>(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="JobViewVM"/> class. + /// </summary> + public JobViewVM() + { + _converter = new DefaultColorConverter(); + + _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); + + RegisterForMessage<JobSelectedMessage>(HandleJobSelectedMessage); + + FineTuneItems = new ObservableCollection<FineTuneItem>(); + ApprovalFineTuneItems = new ObservableCollection<FineTuneItem>(); + + CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) => + { + return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); + }); + + + CatalogAutoCompleteProvider = new AutoCompleteProvider<ColorCatalogsItem>((item, filter) => + { + return !String.IsNullOrWhiteSpace(filter) && item.Name.ToLower().StartsWith(filter.ToLower()); + }); + + //Initialize Commands + AddNewSegmentCommand = new RelayCommand<Int32>(AddNewSegment); + UndoLastColorCommand = new RelayCommand<SegmentModel>(UndoLastColor); + RemoveSegmentCommand = new RelayCommand<SegmentModel>(RemoveSegment); + DuplicateSegmentCommand = new RelayCommand<SegmentModel>(DuplicateSegment); + + AddColorCommand = new RelayCommand<SegmentModel>(AddColor); + EditColorCommand = new RelayCommand<BrushStopModel>(EditColor); + + DyeCommand = new RelayCommand(StartJob, CanStartJob); + + ExportEmbroideryCommand = new RelayCommand(ExportEmbroidery); + RepeatUnitsCommand = new RelayCommand(RepeatUnits); + + EditJobDetailsCommand = new RelayCommand(EditJobDetails); + JobModeSwitchCommand = new RelayCommand(JobModeSwitch); + InsertWhiteGapCommand = new RelayCommand(InsertWhiteGap); + ReverseCommand = new RelayCommand(Reverse); + DeleteSegmentCommand = new RelayCommand(DeleteSegments); + RepeateSegmentCommand = new RelayCommand(RepeateSegments); + PasteCommand = new RelayCommand(Paste); + CopyCommand = new RelayCommand(Copy); + UndoCommand = new RelayCommand(Undo);//(x) => { return UndoRedoManager.Instance.IsEnableUndoOperation(); } + RedoCommand = new RelayCommand(Redo);//(x) => { return UndoRedoManager.Instance.IsEnableRedoOperation();} + + IsFullMode = true; + IsSummaryOpened = true; + _not_show_warning = false; + } + + #endregion + + #region Job Management + + /// <summary> + /// Loads the job. + /// </summary> + private async void LoadJob() + { + try + { + if (!(_job_to_load == null || (_job_to_load != null && Job != null && _job_to_load.Guid == Job.Guid))) + { + //View.ScrollToTop(); + + LogManager.Log($"Loading selected job '{_job_to_load.Name}'..."); + IsFree = false; + + _can_navigate_back = false; + + if (_db != null) + { + if (Job != null) + { + //Job.RmlChanged -= OnRmlChanged; + Job.NameChanged -= Job_NameChanged; + } + + if (Rmls != null) + { + Rmls.Where(x => x.Cct != null && x.Cct.Data != null).ToList().ForEach(x => x.Cct.Data = null); + Rmls.ForEach(x => x.Cct = null); + + if (SelectedRML != null) + { + SelectedRML.Cct = null; + SelectedRML = null; + } + + Rmls = null; + } + + _db.Dispose(); + GC.Collect(); + } + + _db = ObservablesContext.CreateDefault(); + + _catalogs = await new CatalogsCollectionBuilder(_db) + .SetAll() + .WithGroups() + .WithItems() + .ForSite(MachineProvider.Machine.SiteGuid) + .BuildListAsync(); + + Job = await new JobBuilder(_db).Set(_job_to_load.Guid) + .WithConfiguration() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); + + Job.NameChanged -= Job_NameChanged; + Job.NameChanged += Job_NameChanged; + + Job.ValidateOnPropertyChanged = true; + + //GetLubricationLevel(); + //await SetSpoolTension(Job.Rml); + + LogManager.Log("Loading RMLS..."); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); + LogManager.Log("Loading Color Spaces..."); + ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync(); + LogManager.Log("Loading Spool Types..."); + SpoolTypes = await _db.SpoolTypes.ToListAsync(); + LogManager.Log("Loading Customers..."); + Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync(); + + AvailableCatalogs = await new CatalogsCollectionBuilder(_db).SetAll().WithGroups().WithItems().ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); + + _selectedRML = Job.Rml; + RaisePropertyChanged(nameof(SelectedRML)); + + await LoadRML(_selectedRML); + + LoadJobModel(); + + _job_to_load = null; + + _current_job_string = Job.ToJobFileWhenLoaded().ToString(); + } + + if (!_jobs_fine_tune_items.ContainsKey(Job.Guid) && Job.JobFineTuningStatus == BL.Enumerations.FineTuningStatuses.PendingApproval) + { + Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified; + } + + LogManager.Log($"Job editing state = '{Job.JobEditingState}'."); + + if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval) + { + LogManager.Log("Directing view to display sample dye region."); + View.DisplaySampleDye(); + } + else if (Job.JobEditingState == BL.Enumerations.EditingStates.FineTuning && Job.JobFineTuningStatus == BL.Enumerations.FineTuningStatuses.PendingApproval) + { + LogManager.Log("Directing view to display fine tuning region."); + View.DisplayFineTuning(); + } + + IsFullMode = true; + DyeCommand.RaiseCanExecuteChanged(); + } + catch (Exception ex) + { + IsFree = true; + LogManager.Log(ex, $"Error loading job '{(_job_to_load != null ? _job_to_load.Name : "null")}'"); + await NotificationProvider.ShowError("An error occurred while trying to load the selected job."); + _can_navigate_back = true; + await NavigationManager.NavigateBack(); + } + finally + { + IsFree = true; + } + } + + private void LoadJobModel() + { + var jobModel = new JobModel(ColorSpaces) + { + Name = Job.Name, + CreationDate = Job.CreationDate, + LengthPercentageFactor = Job.LengthPercentageFactor, + NumberOfUnits = Job.NumberOfUnits, + IsAllSegmentsPerSpool = Job.IsAllSegmentsPerSpool, + Rml = Job.Rml, + ColorSpace = Job.ColorSpace, + SpoolType = Job.SpoolType, + User = Job.User, + Machine = Job.Machine, + InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0 + }; + + foreach (var segm in Job.Segments) + { + if (Job.Version == 1 && segm.BrushStops.Count > 1) + { + int segmentindex = 1; + + var brushes = segm.BrushStops; + Segment currentSegment = segm; + double lengthOfOldSegment = segm.Length; + for (int index = 0; index < (brushes.Count - 1); index++) + { + SegmentModel csegmentModel = new SegmentModel(jobModel, segm.Guid) + { + Name = segm.Name, + Length = segm.Length, + SegmentIndex = segm.SegmentIndex, + IsInterSegment = segm.IsInterSegment, + Job = jobModel + }; + + csegmentModel.SegmentIndex = segmentindex++; + + brushes[index].Segment = currentSegment; + brushes[index + 1].Segment = currentSegment; + csegmentModel.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d); + BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel); + BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel); + csegmentModel.CreateGradientBrushes(brushStopModelFirst, brushStopModelSecond); + + jobModel.Segments.Add(csegmentModel); + } + } + else + { + SegmentModel segmentModel = new SegmentModel(jobModel, segm.Guid) + { + Name = segm.Name, + Length = segm.Length, + SegmentIndex = segm.SegmentIndex, + IsInterSegment = segm.IsInterSegment, + Job = jobModel, + }; + foreach (var brushStop in segm.BrushStops) + { + BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel); + segmentModel.BrushStops.Add(brushStopModel); + } + + segmentModel.ArrangeBrushStopsPosition(); + jobModel.Segments.Add(segmentModel); + } + } + jobModel.Segments.Last().IsLast = true; + JobModel = jobModel; + SegmentsCollectionView = CollectionViewSource.GetDefaultView(JobModel.Segments); + SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(SegmentModel.SegmentIndex), ListSortDirection.Ascending)); + UndoRedoManager.Instance.ClearAll(); + + } + + private void Job_NameChanged(object sender, string e) + { + DyeCommand.RaiseCanExecuteChanged(); + } + + public override void OnBeforeNavigatedFrom() + { + base.OnBeforeNavigatedFrom(); + //Save... + } + + /// <summary> + /// Starts the job. + /// </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..."); + await Save(); + var handler = await PrintingManager.Print(Job, _db); + await NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView)); + startingJob = false; + } + catch (InsufficientLiquidQuantityException) + { + //Ignore.. + } + catch (OperationCanceledException) + { + //Ignore.. + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not start the current job."); + await NotificationProvider.ShowError($"{ex.Message}."); + } + finally + { + startingJob = false; + } + } + + /// <summary> + /// Determines whether this instance [can start job]. + /// </summary> + private bool CanStartJob() + { + try + { + //var test = JobModel != null && !JobModel.Segments.SelectMany(x => x.BrushStops).Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor || x.Position == BrushStopModel.PositionStatus.SecondColor).ToList().Exists(x => x.IsOutOfGamut); + //return Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || (x.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume && x.IsLiquidVolumesOutOfRange)); + return JobModel != null && !JobModel.Segments.ToList().Exists(x => x.BrushStops.Count == 0); + } + catch (Exception ex) + { + Debug.WriteLine(ex); + return false; + } + } + + private async void EditJobDetails() + { + try + { + LogManager.Log("Editing the job details."); + JobCreationViewVM vm = new JobCreationViewVM(_spoolTypes.ToList(), _rmls.ToList(), JobModel.InterSegmentLength, true); + vm.JobName = JobModel.Name; + vm.SelectedRML = JobModel.Rml; + vm.SelectedSpoolType = JobModel.SpoolType; + vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); + + if (!vm.DialogResult) return; + + Job.Name = vm.JobName; + JobModel.Name = vm.JobName; + Job.EnableInterSegment = vm.WhiteGap > 0; + Job.InterSegmentLength = vm.WhiteGap; + JobModel.InterSegmentLength = vm.WhiteGap; + Job.SpoolType = vm.SelectedSpoolType; + JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! + SelectedRML = vm.SelectedRML; + + if (vm.IsDuplicate) + { + try + { + await Save(); + //Duplicate new job + var cloned = Job.Clone(); + cloned.JobIndex = (_db.Jobs.Max(x => x.JobIndex) + 1); + _db.Jobs.Add(cloned); + await _db.SaveChangesAsync(); + _job_to_load = cloned; + LoadJob(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error duplicate job."); + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error editing the job."); + } + } + + private async void RepeatUnits() + { + var maxLength = Job.SpoolType.Length; + var maxRep = (maxLength == 0 ? 999 : (maxLength / JobModel.Length)); + + + var vm = await NotificationProvider.ShowDialog<RepeatJobViewVM>(new RepeatJobViewVM() + { + MaxRepeations = (int)maxRep, + Repeats = JobModel.NumberOfUnits + }); + + if (vm.DialogResult) + { + JobModel.NumberOfUnits = vm.Repeats; + } + } + + #endregion + + #region RML Changed + + private async void OnSelectedRmlChanged() + { + await LoadRML(SelectedRML); + } + + private async Task LoadRML(Rml rml) + { + if (rml != null) + { + if (Job.Rml != rml || rml.Cct == null) + { + bool updateRML = Job.Rml != rml; + + Job.Rml = await new RmlBuilder(_db) + .Set(rml.Guid) + .WithActiveParametersGroup() + .WithCCT() + .WithCAT(MachineProvider.Machine.Guid) + .WithLiquidFactors() + .WithSpools() + .BuildAsync(); + if (JobModel != null) + JobModel.Rml = Job.Rml; + + if (updateRML && JobModel != null) + { + NotificationProvider.SetGlobalBusyMessage("Updating IsOutOfGammut due to the change RML..."); + foreach (var stop in JobModel.Segments.SelectMany(x => x.BrushStops).Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) + { + try + { + stop.OnBrushStopFieldValueChanged(); + //TODO ASK ROY!!!!!! + //output.ApplyOnBrushStopVolumesOnly(stop); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); + } + } + DyeCommand.RaiseCanExecuteChanged(); + NotificationProvider.ReleaseGlobalBusyMessage(); + } + //if (updateVolumes) + //{ + // NotificationProvider.SetGlobalBusyMessage("Updating job liquid volumes..."); + // foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB || x.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) + // { + // try + // { + // var output = await _converter.ConvertAsync(stop, false, false); + // output.ApplyOnBrushStopVolumesOnly(stop); + // } + // catch (Exception ex) + // { + // LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.Segment.SegmentIndex}, stop {stop.StopIndex}."); + // } + // } + // NotificationProvider.ReleaseGlobalBusyMessage(); + //} + } + } + } + + #endregion + + #region Segments Management + + /// <summary> + /// Adds a new segment. + /// </summary> + private void AddNewSegment(Int32 segmentIndex) + { + try + { + LogManager.Log("Adding new segment..."); + + UndoRedoManager.Instance.InsertAndExecuteCommand(new AddNewSegmentCommand(JobModel, segmentIndex, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10)); + ArrangeSegmentsIndixes(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not add a new segment."); + NotificationProvider.ShowError("An error occurred while trying to add a new segment."); + } + } + + /// <summary> + /// Undoes the last color. + /// </summary> + private void UndoLastColor(SegmentModel segment) + { + + } + + /// <summary> + /// Removes the segment. + /// </summary> + private async void RemoveSegment(SegmentModel segment) + { + if (JobModel.Segments.Count > 1) + { + try + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected segment?")) + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentCommand(JobModel, segment)); + ArrangeSegmentsIndixes(); + + DyeCommand.RaiseCanExecuteChanged(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not remove segment."); + await NotificationProvider.ShowError("An error occurred while trying to delete segment."); + } + } + else + { + await NotificationProvider.ShowInfo("A job must contain at least one color segment."); + } + } + + + /// <summary> + /// Duplicates the segment. + /// </summary> + private void DuplicateSegment(SegmentModel segment) + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new DuplicateSegmentCommand(JobModel, segment)); + ArrangeSegmentsIndixes(); + DyeCommand.RaiseCanExecuteChanged(); + } + + private void ArrangeSegmentsIndixes() + { + int index = 1; + int count = JobModel.Segments.Count(); + + foreach (var segment in JobModel.Segments) + { + segment.IsLast = ( index == count)? true : false; + segment.SegmentIndex = index++; + } + + SegmentsCollectionView.Refresh(); + } + + #endregion + + #region Brush Stops Management + + /// <summary> + /// Click on AddColor button. Add newBrush; + /// </summary> + private async void AddColor(SegmentModel segment) + { + LogManager.Log($"Adding new color to segment {segment.SegmentIndex}."); + + if ((segment.IsGradient && segment.Length < 10) || (segment.HasColors && segment.Length < 5)) + { + await NotificationProvider.ShowInfo("Color transitions are best visible with segment length of 5 meters and above."); + } + + var vm = await NotificationProvider.ShowDialog<ColorSelectionViewVM>(new ColorSelectionViewVM() + { + DialogEditObject = new ColorSelectionViewVM.DialogObject() + { + SelectedSegment = segment, + BrushStopForEdit = new BrushStopModel(segment), + IsEditingMode = false, + Catalogs = _catalogs + } + }); + + if (vm.DialogResult) + { + AddBrushStop(segment, vm.SelectedBrushStop); + DyeCommand.RaiseCanExecuteChanged(); + } + // SetSegmentLiquidVolumes(segment); + } + + /// <summary> + /// Click on Edit Color button. Add newBrush; + /// </summary> + private async void EditColor(BrushStopModel brushStop) + { + if (brushStop == null) + { + await NotificationProvider.ShowError("The edit brush is null!"); + return; + } + SegmentModel segment = brushStop.SegmentModel; + LogManager.Log($"Edit brush stop."); + + var vm = await NotificationProvider.ShowDialog<ColorSelectionViewVM>(new ColorSelectionViewVM() + { + DialogEditObject = new ColorSelectionViewVM.DialogObject() + { + SelectedSegment = segment, + BrushStopForEdit = brushStop, + IsEditingMode = true, + Catalogs = _catalogs + } + }); + + + if (vm.DialogResult) + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new EditBrushStopColorCommand(segment, brushStop, vm.SelectedBrushStop)); + DyeCommand.RaiseCanExecuteChanged(); + } + } + + /// <summary> + /// Adds the brush stop. + /// </summary> + public async void AddBrushStop(SegmentModel segment, BrushStopModel newBrushStop) + { + if (newBrushStop == null || segment == null) + return; + + if(segment.IsGradient) + { + if (false == _not_show_warning) + { + var vm = await NotificationProvider.ShowDialog<AddSegmentWarningDialogVM>(new AddSegmentWarningDialogVM()); + if (vm.NotShow) + { + _not_show_warning = true; + } + } + } + UndoRedoManager.Instance.InsertAndExecuteCommand(new AddBrushStopCommand(JobModel, segment, newBrushStop)); + + ArrangeSegmentsIndixes(); + } + #endregion + + #region Job Selection Message + + /// <summary> + /// Handles the job selected message. + /// </summary> + /// <param name="message">The message.</param> + private void HandleJobSelectedMessage(JobSelectedMessage message) + { + _job_to_load = message.Job; + } + + #endregion + + #region Sample Dye + + /// <summary> + /// Starts a sample dye. + /// </summary> + //private async void StartSampleDye() + //{ + // try + // { + // LogManager.Log("Sample dye command pressed..."); + + // await PrintingManager.PrintSample(Job, _db); + + // await NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView)); + // } + // catch (Exception ex) + // { + // LogManager.Log(ex, $"Error executing sample dye for job {Job.Name}."); + // await NotificationProvider.ShowError(ex.Message); + // } + //} + + + #endregion + + + + #region Export Embroidery + + private async void ExportEmbroidery() + { + try + { + if (!StorageProvider.IsConnected) + { + await NotificationProvider.ShowError("No storage device connected."); + return; + } + + var result = await NavigationManager. + NavigateForResult<StorageModule, + Storage.Views.MainView, ExplorerFileItem, + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.SaveFile, + DefaultFileName = Job.Name + Path.GetExtension(Job.EmbroideryFileName), + Filter = Path.GetExtension(Job.EmbroideryFileName), + Title = "Export Embroidery File", + }); + + if (result != null) + { + File.WriteAllBytes(Path.HasExtension(result.Path) ? result.Path : result.Path + Path.GetExtension(Job.EmbroideryFileName), Job.EmbroideryFileData); + await NotificationProvider.ShowSuccess("Embroidery file exported successfully."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting embroidery file."); + await NotificationProvider.ShowError("An error occurred while trying to save the selected embroidery file."); + } + } + + #endregion + + #region IPPC ViewModel Overrides + + /// <summary> + /// Called when the application has been started. + /// </summary> + public override void OnApplicationStarted() + { + base.OnApplicationStarted(); + + MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + } + + private void MachineOperator_PrintingEnded(object sender, Integration.Operation.PrintingEventArgs e) + { + if (IsVisible) + { + _start_printing_btn.Push(); + } + } + + /// <summary> + /// Called when the navigation system has navigated to this VM view. + /// </summary> + public override void OnNavigatedTo() + { + if (!MachineProvider.MachineOperator.IsPrinting) + { + _start_printing_btn.Push(); + } + + base.OnNavigatedTo(); + LoadJob(); + } + + /// <summary> + /// Called when the navigation system has navigated from this VM view. + /// </summary> + public override void OnNavigatedFrom() + { + _start_printing_btn.Pop(); + + base.OnNavigatedFrom(); + _job_to_load_intent = JobNavigationIntent.Default; + } + + public override void OnNavigatedTo(PPCViewModel fromVM) + { + base.OnNavigatedTo(fromVM); + } + + /// <summary> + /// Called before the navigation system navigates back from this object. + /// Return false to abort the navigation. + /// </summary> + /// <returns></returns> + public async override Task<bool> OnNavigateBackRequest() + { + try + { + await Save(); + return true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving job to database."); + await NotificationProvider.ShowError("Error saving the current job."); + return false; + } + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + _start_printing_btn = new StartPrintingButton(DyeCommand, MachineProvider.MachineOperator); + } + #endregion + + #region INavigationObjectReceiver + + public void OnNavigatedToWithObject(JobNavigationObject e) + { + _job_to_load_intent = e.Intent; + _job_to_load = e.Job; + } + + #endregion + + #region collapsed mode + + private void JobModeSwitch() + { + IsFullMode = !IsFullMode; + UndoRedoManager.Instance.ClearAll(); + } + + private void InsertWhiteGap() + { + JobModel.InsertWhiteGapToSelectedSegments(); + } + + private void Reverse() + { + if (false == JobModel.Segments.ToList().Any(x => x.IsSelected)) + return; + + UndoRedoManager.Instance.InsertAndExecuteCommand(new ReverseCommand(JobModel)); + + ArrangeSegmentsIndixes(); + } + + private async void DeleteSegments() + { + if (false == JobModel.Segments.ToList().Any(x => x.IsSelected)) + return; + + if (JobModel.Segments.Count > 1) + { + try + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to remove these selected segments?")) + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentsCommand(JobModel)); + + ArrangeSegmentsIndixes(); + DyeCommand.RaiseCanExecuteChanged(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not remove segments."); + await NotificationProvider.ShowError("An error occurred while trying to delete segments."); + } + } + else + { + await NotificationProvider.ShowInfo("A job must contain at least one color segment."); + } + } + + private void RepeateSegments() + { + + } + + private void Paste() + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new PasteSegmentsCommand(JobModel)); + ArrangeSegmentsIndixes(); + } + + private void Copy() + { + UndoRedoManager.Instance.InsertAndExecuteCommand(new CopySegmentCommand(JobModel)); + } + + private void Undo() + { + UndoRedoManager.Instance.Undo(); + ArrangeSegmentsIndixes(); + DyeCommand.RaiseCanExecuteChanged(); + } + + private void Redo() + { + UndoRedoManager.Instance.Redo(); + ArrangeSegmentsIndixes(); + DyeCommand.RaiseCanExecuteChanged(); + } + + #endregion + + #region Save from models to db + + private async Task Save() + { + if (JobModel == null) + return; + UndoRedoManager.Instance.ClearAll(); + + var colorSpaces = await _db.ColorSpaces.ToListAsync(); + + Job.ColorSpace = colorSpaces.FirstOrDefault(); + Job.Version = 2; + Job.NumberOfUnits = JobModel.NumberOfUnits; + Job.EnableInterSegment = JobModel.InterSegmentLength > 0; + Job.InterSegmentLength = JobModel.InterSegmentLength; + + var oldSegments = Job.Segments.ToList(); + + foreach (var segment in Job.Segments.ToList()) + { + segment.BrushStops.ToList().ForEach(x => + { + _db.BrushStops.Remove(x); + }); + + _db.Segments.Remove(segment); + } + + Job.Segments.Clear(); + + foreach (var segment in JobModel.Segments.OrderBy(x => x.SegmentIndex).ToList()) + { + var dbSegment = new Segment(); + dbSegment.Guid = System.Guid.NewGuid().ToString(); + dbSegment.Name = "Standard Segment"; + + dbSegment.Job = Job; + dbSegment.SegmentIndex = segment.SegmentIndex; + dbSegment.Length = segment.Length; + + _db.Segments.Add(dbSegment); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex).ToList()) + { + var dbStop = new BrushStop(); + dbStop.Segment = dbSegment; + _db.BrushStops.Add(dbStop); + + dbStop.ColorSpace = colorSpaces.FirstOrDefault(x => x.Code == (int)stop.ColorSpace); + dbStop.Red = stop.Red; + dbStop.Green = stop.Green; + dbStop.Blue = stop.Blue; + dbStop.L = stop.L; + dbStop.A = stop.A; + dbStop.B = stop.B; + dbStop.Cyan = stop.Cyan; + dbStop.Magenta = stop.Magenta; + dbStop.Yellow = stop.Yellow; + dbStop.Black = stop.Black; + dbStop.BestMatchR = stop.BestMatchColor.R; + dbStop.BestMatchG = stop.BestMatchColor.G; + dbStop.BestMatchB = stop.BestMatchColor.B; + + dbStop.OffsetPercent = stop.OffsetPercent; + dbStop.StopIndex = stop.StopIndex; + dbStop.IsOutOfGamut = stop.IsOutOfGamut; + + dbStop.SetVolume(LiquidTypes.Cyan, stop.Cyan); + dbStop.SetVolume(LiquidTypes.Magenta, stop.Magenta); + dbStop.SetVolume(LiquidTypes.Yellow, stop.Yellow); + dbStop.SetVolume(LiquidTypes.Black, stop.Black); + + dbStop.ColorCatalog = stop.ColorCatalog; + dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; + } + } + Job.LastUpdated = DateTime.UtcNow; + Job.IsSynchronized = false; + Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + //_current_job_string = Job.ToJobFileWhenLoaded().ToString(); + RaiseMessage(new JobSavedMessage() { Job = Job }); + + await _db.SaveChangesAsync(); + + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs new file mode 100644 index 000000000..3b1d6d9e6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -0,0 +1,1000 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.DragAndDrop; +using Tango.PPC.Common; +using Tango.PPC.Common.Messages; +using Tango.PPC.Jobs.Dialogs; +using Tango.PPC.Jobs.Messages; +using Tango.PPC.Jobs.Views; +using System.Data.Entity; +using Tango.BL.Builders; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Storage; +using Tango.Explorer; +using System.IO; +using Google.Protobuf; +using Tango.PMR.Exports; +using Tango.Settings; +using Tango.Integration.ExternalBridge; +using System.Windows.Media; +using Tango.PMR.TCC; +using Tango.Pulse; +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; +using Tango.BL.Helpers; +using Tango.ColorConversion; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the jobs list view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + 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 ObservableCollection<SpoolType> _spoolTypes; + private List<ColorSpace> _colorSpaces; //Holds the available color spaces. + private bool _isJobsSynchronizationNotificationActive; + + public enum JobsCategory + { + Draft, + History + } + + #region Properties + + private ObservableCollection<Job> _jobs; + /// <summary> + /// Gets or sets the collection of jobs. + /// </summary> + public ObservableCollection<Job> Jobs + { + get { return _jobs; } + set { _jobs = value; RaisePropertyChangedAuto(); } + } + + private ICollectionView _draftJobsCollectionView; + /// <summary> + /// Gets or sets the jobs collection view. + /// </summary> + public ICollectionView DraftJobsCollectionView + { + get { return _draftJobsCollectionView; } + set + { + _draftJobsCollectionView = value; + RaisePropertyChangedAuto(); + } + } + + private ICollectionView _historyJobsCollectionView; + /// <summary> + /// Gets or sets the jobs collection view. + /// </summary> + public ICollectionView HistoryJobsCollectionView + { + get { return _historyJobsCollectionView; } + set + { + _historyJobsCollectionView = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<Job> _selectedJobs; + /// <summary> + /// Gets or sets the selected jobs. + /// </summary> + public ObservableCollection<Job> SelectedJobs + { + get { return _selectedJobs; } + set { _selectedJobs = value; RaisePropertyChangedAuto(); } + } + + private bool _isLoadingJobs; + /// <summary> + /// Gets or sets a value indicating whether this instance is loading jobs. + /// </summary> + public bool IsLoadingJobs + { + get { return _isLoadingJobs; } + set { _isLoadingJobs = value; RaisePropertyChangedAuto(); } + } + + private bool _isMultiSelecting; + /// <summary> + /// Gets or sets a value indicating whether this the jobs list is in multi select mode. + /// </summary> + public bool IsMultiSelecting + { + get { return _isMultiSelecting; } + set { _isMultiSelecting = value; RaisePropertyChangedAuto(); } + } + + private int _selectedCategoryIndex; + /// <summary> + /// Gets or sets the index of the selected category. + /// </summary> + public int SelectedCategoryIndex + { + get { return _selectedCategoryIndex; } + set + { + _selectedCategoryIndex = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(SelectedCategory)); + } + } + + /// <summary> + /// Gets or sets the selected category. + /// </summary> + public JobsCategory SelectedCategory + { + get { return (JobsCategory)SelectedCategoryIndex; } + set + { + if (SelectedCategoryIndex != value.ToInt32()) + { + SelectedCategoryIndex = value.ToInt32(); + Filter = null; + } + } + } + + private String _filter; + /// <summary> + /// Gets or sets the search filter. + /// </summary> + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } + } + + private ICollectionFilter _collectionFilter; + public ICollectionFilter CollectionFilter + { + get { return _collectionFilter; } + set { _collectionFilter = value; RaisePropertyChangedAuto(); } + } + + + #endregion + + #region Commands + + /// <summary> + /// Gets or sets the job selected command. + /// </summary> + public RelayCommand<Object> JobSelectedCommand { get; set; } + + /// <summary> + /// Gets or sets the job drag and drop command. + /// </summary> + public RelayCommand<DropEventArgs> JobDragedDroppedCommand { get; set; } + + /// <summary> + /// Gets or sets the clear selection command. + /// </summary> + public RelayCommand ClearSelectionCommand { get; set; } + + /// <summary> + /// Gets or sets the add job command. + /// </summary> + public RelayCommand AddJobCommand { get; set; } + + /// <summary> + /// Gets or sets the delete jobs command. + /// </summary> + public RelayCommand DeleteJobsCommand { get; set; } + + /// <summary> + /// Gets or sets the clone jobs command. + /// </summary> + public RelayCommand CloneJobsCommand { get; set; } + + /// <summary> + /// Gets or sets the export job command. + /// </summary> + public RelayCommand ExportJobCommand { get; set; } + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="JobsViewVM"/> class. + /// </summary> + public JobsViewVM() + { + Jobs = new ObservableCollection<Job>(); + SelectedJobs = new ObservableCollection<Job>(); + + JobSelectedCommand = new RelayCommand<Object>((x) => SelectJob(x as Job)); + JobDragedDroppedCommand = new RelayCommand<DropEventArgs>((e) => + { + Job draggedJob = e.Draggable.DataContext as Job; + Job droppedJob = e.Droppable.DataContext as Job; + + DragAndDropJob(draggedJob, droppedJob); + }); + + ClearSelectionCommand = new RelayCommand(ClearSelection); + AddJobCommand = new RelayCommand(() => AddNewJob()); + DeleteJobsCommand = new RelayCommand(() => DeleteJobs(SelectedJobs)); + CloneJobsCommand = new RelayCommand(() => CloneJobs(SelectedJobs)); + ExportJobCommand = new RelayCommand(ExportJob); + + RegisterForMessage<JobRemovedMessage>(HandleJobRemovedMessage); + RegisterForMessage<JobSavedMessage>(HandleJobSavedMessage); + RegisterForMessage<NavigatedToJobsModuleMessage>((x) => Filter = null); + + CollectionFilter = new DefaultCollectionFilter(); + CollectionFilter.RegisterFilter(item => + { + var job = item as Job; + + if (job != null) + { + if (String.IsNullOrEmpty(Filter)) + { + return true; + } + else + { + return (job.Name.ToLower().Contains(Filter.ToLower()) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter.ToLower()))); + } + } + else + { + return true; + } + }); + } + + #endregion + + #region Drag & Drop + + /// <summary> + /// Called when a job has been dragged and dropped into another job. + /// </summary> + /// <param name="draggedJob">The dragged job.</param> + /// <param name="droppedJob">The dropped job.</param> + private void DragAndDropJob(Job draggedJob, Job droppedJob) + { + LogManager.Log($"Job Drag & Drop '{draggedJob.Name}' => '{droppedJob.Name}'."); + + if (draggedJob.JobIndex > droppedJob.JobIndex) + { + draggedJob.JobIndex = droppedJob.JobIndex - 1; + } + else + { + draggedJob.JobIndex = droppedJob.JobIndex + 1; + } + + int index = 1; + + foreach (var job in Jobs.OrderBy(x => x.JobIndex)) + { + job.JobIndex = index++; + } + + DraftJobsCollectionView.Refresh(); + } + + #endregion + + #region Job Selection & Loading + + /// <summary> + /// Selects the job. + /// </summary> + /// <param name="job">The job.</param> + public async void SelectJob(Job job, bool directlyToEdit = false) + { + //if (!ApplicationManager.IsInTechnicianMode && job.ColorSpace != null && job.ColorSpace.Code == ColorSpaces.Volume.ToInt32()) + //{ + // await NotificationProvider.ShowError("The selected job is supported only in technician mode."); + // return; + //} + + LogManager.Log($"Job '{job.Name}' selected."); + + RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); + + if (!directlyToEdit && MachineProvider.MachineOperator.CanPrint) + { + await NavigationManager.NavigateWithObject<JobsV2Module, JobSummeryView, JobSummeryNavigationObject>(new JobSummeryNavigationObject() + { + Context = _db, + Job = job, + }); + } + else + { + await NavigationManager.NavigateTo<JobsV2Module>(nameof(JobView)); + } + } + + /// <summary> + /// Loads the jobs from database. + /// </summary> + public void LoadJobs(Action onCompleted = null) + { + try + { + LogManager.Log("Loading machine jobs..."); + + Task.Factory.StartNew(() => + { + IsLoadingJobs = true; + + Thread.Sleep(500); + + _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(() => + { + Jobs = jobs; + DraftJobsCollectionView = new ListCollectionView(Jobs); + DraftJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + DraftJobsCollectionView.Filter = new Predicate<object>(x => + { + var job = x as Job; + return job.JobStatus == JobStatuses.Draft; + }); + + + HistoryJobsCollectionView = new ListCollectionView(Jobs); + HistoryJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + HistoryJobsCollectionView.Filter = new Predicate<object>(x => + { + var job = x as Job; + return job.JobStatus != JobStatuses.Draft; + }); + + IsLoadingJobs = false; + LogManager.Log("Machine jobs loaded!"); + onCompleted?.Invoke(); + }); + }); + } + catch (Exception ex) + { + LogManager.Log(ex); + NotificationProvider.ShowError("An error occurred while trying to load the machine jobs."); + } + } + + /// <summary> + /// Clears the job selection. + /// </summary> + public void ClearSelection() + { + SelectedJobs.Clear(); + IsMultiSelecting = false; + } + + /// <summary> + /// Adds a new job. + /// </summary> + private async void AddNewJob(Color? colorProfile = null, TwnFile twnFile = null) + { + try + { + LogManager.Log("Adding new job..."); + + var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>(); + + var machine = MachineProvider.Machine; + + if(_rmls.Count == 0) + { + await Task.Delay(200); + } + JobCreationViewVM vm = new JobCreationViewVM( _spoolTypes.ToList(), _rmls.ToList(), 0, false ); + var selectedRmlGuid = Settings.DefaultRmlGuid; + var selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid; + vm.SelectedRML = _rmls.FirstOrDefault(x => x.Guid == Settings.DefaultRmlGuid); + vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.DefaultSpoolTypeGuid ); + if (twnFile == null) + { + vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); + if (!vm.DialogResult) return; + + if(vm.SelectedRML != null) + { + selectedRmlGuid = vm.SelectedRML.Guid; + } + if(vm.SelectedSpoolType != null) + { + selectedSpoolTypeGuid = vm.SelectedSpoolType.Guid; + } + + } + + Job job = new Job(); + job.LastUpdated = DateTime.UtcNow; + job.JobSource = JobSource.Local; + job.Name = vm.JobName; + job.NumberOfHeads = 1; + job.NumberOfUnits = 1; + job.SampleUnitsOrMeters = 1; + job.CreationDate = DateTime.UtcNow; + job.JobStatus = JobStatuses.Draft; + job.EnableInterSegment = vm.WhiteGap > 0; + job.InterSegmentLength = vm.WhiteGap; + //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 = selectedRmlGuid; + job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; + job.SpoolTypeGuid = selectedSpoolTypeGuid; + + if (Jobs.Count > 0) + { + job.JobIndex = Jobs.Max(x => x.JobIndex) + 1; + } + + if (colorProfile == null) + { + var segment = job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); + segment.BrushStops.Clear(); + } + else + { + var segment = job.AddSolidSegment(colorProfile.Value, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); + segment.BrushStops.Clear(); + job.Name = $"SnapMatch {colorProfile.Value.R}, {colorProfile.Value.G}, {colorProfile.Value.B}"; + } + + if (twnFile != null) + { + job.Name = twnFile.Name; + job.NumberOfUnits = Math.Max(twnFile.NumberOfCopies, 1); + job.EmbroideryFileName = twnFile.Name + "." + twnFile.EmbroideryFileFormat; + job.EmbroideryFileData = twnFile.EmbroideryFile; + job.EmbroideryJpeg = twnFile.ThumbnailData; + + job.Segments.Clear(); + + int index = 1; + + foreach (var segment in twnFile.Segments) + { + Segment s = new Segment(); + s.Job = job; + s.SegmentIndex = index++; + s.Name = "Embroidery Segment"; + s.Length = segment.Length / 100d; + + int sIndex = 1; + + foreach (var stop in segment.BrushStops) + { + BrushStop st = new BrushStop(); + st.Segment = s; + st.StopIndex = sIndex++; + st.OffsetPercent = stop.Offset * 100d; + st.Red = stop.R; + st.Green = stop.G; + st.Blue = stop.B; + st.ColorSpaceGuid = job.ColorSpaceGuid; + s.BrushStops.Add(st); + } + + job.Segments.Add(s); + } + } + + _db.Jobs.Add(job); + + await _db.SaveChangesAsync(); + + Jobs.Add(job); + + LogManager.Log($"Job {job.Name} added successfully."); + + RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); + + + await Task.Delay(200); + await NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() + { + Job = job, + Intent = JobNavigationIntent.NewJob + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error creating new job."); + await NotificationProvider.ShowError("An error occurred while trying to add a new job."); + } + } + + /// <summary> + /// Deletes the specified jobs from db. + /// </summary> + /// <param name="jobs">The jobs.</param> + private async void DeleteJobs(ObservableCollection<Job> jobs) + { + try + { + LogManager.Log($"Removing selected jobs:\n{jobs.Select(x => x.Name).ToList().ToJsonString()}"); + + if (await NotificationProvider.ShowQuestion("Are you sure you want to delete the selected jobs")) + { + foreach (var job in jobs) + { + await job.DeleteCascadeAsync(_db); + Jobs.Remove(job); + } + + await _db.SaveChangesAsync(); + ClearSelection(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error removing selected jobs."); + await NotificationProvider.ShowError("An error occurred while trying to remove the selected jobs."); + } + } + + /// <summary> + /// Clones the specified jobs. + /// </summary> + /// <param name="jobs">The jobs.</param> + private async void CloneJobs(ObservableCollection<Job> jobs) + { + try + { + LogManager.Log($"Cloning selected jobs:\n{jobs.Select(x => x.Name).ToList().ToJsonString()}"); + + int index = Jobs.Max(x => x.JobIndex); + + List<Job> clonedJobs = new List<Job>(); + + foreach (var job in SelectedJobs) + { + var cloned = job.Clone(); + cloned.JobIndex = ++index; + _db.Jobs.Add(cloned); + clonedJobs.Add(cloned); + } + + await _db.SaveChangesAsync(); + + foreach (var job in clonedJobs) + { + Jobs.Add(job); + } + + ClearSelection(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error cloning selected jobs."); + await NotificationProvider.ShowError("An error occurred while trying to clone the selected jobs."); + } + } + + /// <summary> + /// Called when the search filter has been changed + /// </summary> + private void OnFilterChanged() + { + if (DraftJobsCollectionView != null && HistoryJobsCollectionView != null) + { + CollectionFilter.RaiseFilterChanged(); + View.ScrollToTop(); + } + } + + #endregion + + #region Message Handling + + /// <summary> + /// Handles the job removed message. + /// </summary> + /// <param name="msg">The MSG.</param> + private void HandleJobRemovedMessage(JobRemovedMessage msg) + { + try + { + LogManager.Log("JobRemovedMessage message received, removing job from list..."); + var job = Jobs.SingleOrDefault(x => x.Guid == msg.Job.Guid); + Jobs.Remove(job); + _db.Entry(job).State = System.Data.Entity.EntityState.Detached; + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not remove job"); + } + } + + /// <summary> + /// Handles the job saved message. + /// </summary> + /// <param name="msg">The MSG.</param> + private void HandleJobSavedMessage(JobSavedMessage msg) + { + LogManager.Log("JobSavedMessage message received."); + LoadJobs(); + } + + #endregion + + #region Override Methods + + /// <summary> + /// Called when the application has been started. + /// </summary> + public override void OnApplicationStarted() + { + BrushStop.ColorSynchronizationMode = BrushStop.ColorSynchronizationModes.None; + + LoadJobs(); + ExternalBridgeService.ColorProfileRequest += ExternalBridgeService_ColorProfileRequest; + } + + public async override void OnApplicationReady() + { + base.OnApplicationReady(); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.ColorProfile.Extension, HandleColorProfileFileLoaded); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.CsvFile.Extension, HandleCsvJobFileLoaded); + + //Load catalogs. + using (ObservablesContext db = 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(); + _spoolTypes = db.SpoolTypes.ToObservableCollection(); + } + + MachineDataSynchronizer.SynchronizationEnded += MachineDataSynchronizer_SynchronizationEnded; + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + JobViewVM._start_printing_btn?.Pop(); + Filter = null; + } + + #endregion + + #region Job Export + + private async void ExportJob() + { + 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() + { + Intent = selectedJobs.Count == 1 ? StorageNavigationIntent.SaveFile : StorageNavigationIntent.SaveFiles, + DefaultFileName = selected_job.Name, + Filter = ExplorerFileDefinition.Job.Extension, + Title = selectedJobs.Count == 1 ? "Save Job File" : "Save Job Files", + }); + + if (result != null) + { + if (selectedJobs.Count == 1) + { + try + { + 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) + { + 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}"); + } + } + else + { + 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."); + } + } + } + + #endregion + + #region Handle Job File Loading From Storage + + private async void HandleJobFileLoaded(List<ExplorerFileItem> jobFiles) + { + var vm = await NotificationProvider.ShowDialog<ImportJobViewVM>(); + + if (vm.DialogResult) + { + using (ObservablesContext jobContext = ObservablesContext.CreateDefault()) + { + foreach (var jobFile in jobFiles) + { + try + { + 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}"); + } + } + + LoadJobs(() => + { + //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); + // } + //} + }); + } + } + } + + #endregion + + #region Handle CSV Job File Loading From Storage + + private async void HandleCsvJobFileLoaded(List<ExplorerFileItem> files) + { + var item = files.FirstOrDefault(); + if (item == null) return; + + var vm = new ImportCsvJobViewVM(); + vm.Name = Path.GetFileNameWithoutExtension(item.Name); + await vm.Init(); + await NotificationProvider.ShowDialog<ImportCsvJobViewVM>(vm); + + if (vm.DialogResult && vm.SelectedRml != null) + { + try + { + NotificationProvider.SetGlobalBusyMessage("Importing job from file..."); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var segments = await SegmentsCsvHelper.FromFile(item.Path, MachineProvider.Machine, db); + + Job job = new Job(); + job.LastUpdated = DateTime.UtcNow; + job.JobSource = JobSource.Local; + job.Name = vm.Name; + job.NumberOfHeads = 1; + job.NumberOfUnits = 1; + job.SampleUnitsOrMeters = 1; + job.CreationDate = DateTime.UtcNow; + job.JobStatus = JobStatuses.Draft; + job.JobType = JobTypes.Knitting; + job.EnableLubrication = true; + job.MachineGuid = MachineProvider.Machine.Guid; + job.RmlGuid = vm.SelectedRml.Guid; + job.Machine = await new MachineBuilder(db).Set(job.MachineGuid).WithCats().WithConfiguration().BuildAsync(); + job.Rml = await new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithLiquidFactors().BuildAsync(); + job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; + job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + + foreach (var segment in segments) + { + segment.Job = job; + job.Segments.Add(segment); + } + + IColorConverter converter = new DefaultColorConverter(); + + foreach (var stop in segments.SelectMany(x => x.BrushStops.Where(y => y.BrushColorSpace == ColorSpaces.Volume))) + { + var output = converter.Convert(stop, false); + var suggestion = output.CreateSingleSuggestion(); + stop.Color = suggestion.Color; + } + + db.Jobs.Add(job); + await db.SaveChangesAsync(); + LoadJobs(); + } + + NotificationProvider.ReleaseGlobalBusyMessage(); + } + catch (Exception ex) + { + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, "Error importing job from CSV."); + await NotificationProvider.ShowError($"Error importing job from csv file.\n{ex.FlattenMessage()}"); + } + } + } + + #endregion + + #region Handle TCC File Loading From Storage + + private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles) + { + var tccFile = tccFiles.FirstOrDefault(); + + try + { + DetectionColorFile tcc = DetectionColorFile.Parser.ParseFrom(File.ReadAllBytes(tccFile.Path)); + + var vm = await NotificationProvider.ShowDialog<ImportColorProfileViewVM>(new ImportColorProfileViewVM() + { + Color = Color.FromRgb( + (byte)tcc.ProcessedColor.R, + (byte)tcc.ProcessedColor.G, + (byte)tcc.ProcessedColor.B), + }); + + if (vm.DialogResult) + { + AddNewJob(vm.Color); + } + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error occurred while trying to import detection color from file {tccFile.Path}."); + await NotificationProvider.ShowError($"An error occurred while trying to import the selected detection color.\n{ex.Message}"); + } + } + + #endregion + + #region Handle Pulse TWN Loading From Storage + + private async void HandlePulseFileLoaded(List<ExplorerFileItem> twnFiles) + { + var twnFile = twnFiles.FirstOrDefault(); + + TwnFile twn = TwnFile.FromFile(twnFile.Path); + BitmapSource preview = twn.Thumbnail.ToBitmapSource(); + + var vm = await NotificationProvider.ShowDialog<ImportTwnFileViewVM>(new ImportTwnFileViewVM() + { + Thumbnail = preview, + }); + + if (vm.DialogResult) + { + AddNewJob(null, twn); + } + } + + #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) + { + InvokeUI(async () => + { + var vm = await NotificationProvider.ShowDialog<ColorProfileReceivedViewVM>(new ColorProfileReceivedViewVM() + { + Color = Color.FromRgb( + (byte)e.Request.DetectionColor.R, + (byte)e.Request.DetectionColor.G, + (byte)e.Request.DetectionColor.B), + }); + + if (vm.DialogResult) + { + e.Approve(); + AddNewJob(vm.Color); + } + else + { + e.Decline(); + } + }); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..769a9a5c9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +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; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the main view ViewModel. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + 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. + /// </summary> + public override void OnApplicationStarted() + { + 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) + { + _appBarItem?.Close(); + _appBarItem = null; + } + + 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) + { + _appBarItem = NotificationProvider.PushAppBarItem<JobProgressAppBarItem>(); + _appBarItem.Pressed += (_, __) => + { + _appBarItem?.Close(); + NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView)); + }; + } + } + + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + { + _handler = e.JobHandler; + + if (resuming) + { + resuming = false; + + InvokeUI(() => + { + NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView)); + + if (_last_failed_job_notification != null) + { + _last_failed_job_notification.Close(); + _last_failed_job_notification = null; + } + }); + } + } + + 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."); + InvokeUI(() => + { + NotificationProvider.ShowError("An error occurred while trying to resume a job in progress."); + }); + } + } + + /// <summary> + /// Handles the PrintingFailed event of the MachineOperator. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <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, () => + { + NavigationManager.NavigateWithObject<JobsV2Module, JobView, Job>(e.Job); + NavigationManager.ClearHistoryExcept<JobsView>(); + }, NotificationItem.NotificationPriority.VeryHigh)); + } + + /// <summary> + /// Handles the PrintingCompleted event of the MachineOperator. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="Integration.Operation.PrintingEventArgs"/> instance containing the event data.</param> + private void MachineOperator_PrintingCompleted(object sender, PrintingEventArgs e) + { + LogManager.Log($"'{e.Job.Name}' printing complete. Job designation is {e.Job.Designation}."); + + if (e.Job.Designation == BL.Enumerations.JobDesignations.SampleDye) + { + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' sample dye completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.SampleDye }); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); + } + else if (e.Job.Designation == BL.Enumerations.JobDesignations.FineTuning) + { + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' fine tuning completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.FineTuning }); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); + } + else + { + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' completed successfully", e.Job.Name), "Tap to view this job details.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job }); + NavigationManager.ClearHistoryExcept<JobsView>(); + }, NotificationItem.NotificationPriority.VeryHigh)); + } + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + RaiseMessage<NavigatedToJobsModuleMessage>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/TwineCatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/TwineCatalogViewVM.cs new file mode 100644 index 000000000..937c23588 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/TwineCatalogViewVM.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.Settings; + +namespace Tango.PPC.Jobs.ViewModels +{ + /// <summary> + /// Represents the twine catalog view model. + /// </summary> + /// <seealso cref="PPCViewModel" /> + /// <seealso cref="INavigationResultProvider{CatalogItem, TwineCatalogNavigationObject}" /> + public class TwineCatalogViewVM : PPCViewModel, INavigationResultProvider<ColorCatalogsItem, TwineCatalogNavigationObject> + { + private bool _confirmed; + private ObservablesContext _db; + + private ColorCatalog _catalog; + /// <summary> + /// Gets or sets the catalog. + /// </summary> + public ColorCatalog Catalog + { + get { return _catalog; } + set { _catalog = value; RaisePropertyChangedAuto(); } + } + + private ColorCatalog _recent; + /// <summary> + /// Gets or sets the recent catalog items as a complete catalog. + /// </summary> + public ColorCatalog Recent + { + get { return _recent; } + set { _recent = value; RaisePropertyChangedAuto(); } + } + + private String _filter; + /// <summary> + /// Gets or sets the filter. + /// </summary> + /// <value> + /// The filter. + /// </value> + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); } + } + + private ColorCatalogsItem _selectedItem; + /// <summary> + /// Gets or sets the selected item. + /// </summary> + public ColorCatalogsItem SelectedItem + { + get { return _selectedItem; } + set + { + _selectedItem = value; RaisePropertyChangedAuto(); + } + } + + /// <summary> + /// Gets or sets the OK command. + /// </summary> + public RelayCommand OKCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="TwineCatalogViewVM"/> class. + /// </summary> + public TwineCatalogViewVM() + { + OKCommand = new RelayCommand(Confirm); + } + + /// <summary> + /// Called when the application has been started. + /// </summary> + public override void OnApplicationStarted() + { + _db = ObservablesContext.CreateDefault(); + } + + /// <summary> + /// Called when the navigation system has navigated to this VM view. + /// </summary> + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + _confirmed = false; + Filter = "CATALOG"; + } + + /// <summary> + /// Confirms this instance. + /// </summary> + private void Confirm() + { + if (SelectedItem != null) + { + var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>(); + settings.AddRecentCatalogItem(Catalog, SelectedItem); + SettingsManager.Default.Save(); + } + + _confirmed = true; + NavigationManager.NavigateBack(); + } + + /// <summary> + /// Called when the navigation system requests a result when it is navigating away from this instance. + /// </summary> + /// <returns></returns> + public ColorCatalogsItem GetNavigationResult() + { + if (_confirmed) + { + return SelectedItem; + } + else + { + return null; + } + } + + /// <summary> + /// Called when the navigation object has been received + /// </summary> + /// <param name="brushStop">The brush stop.</param> + public virtual void OnNavigationObjectReceived(TwineCatalogNavigationObject obj) + { + IsFree = false; + + Filter = "CATALOG"; + + Catalog = obj.Catalog; + + ColorCatalog recentCatalog = new ColorCatalog(); + recentCatalog.Name = Catalog.Name; + + var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>(); + + var settingsCatalog = settings.RecentCatalogsItems.SingleOrDefault(x => x.Guid == Catalog.Guid); + if (settingsCatalog != null) + { + var allItems = Catalog.ColorCatalogsGroups.SelectMany(x => x.ColorCatalogsItems).ToList(); + + foreach (var itemGuid in settingsCatalog.RecentItems) + { + var realItem = allItems.SingleOrDefault(x => x.Guid == itemGuid); + + if (realItem != null) + { + var group = recentCatalog.ColorCatalogsGroups.SingleOrDefault(x => x.Guid == realItem.ColorCatalogsGroup.Guid); + if (group == null) + { + group = new ColorCatalogsGroup(); + group.Guid = realItem.ColorCatalogsGroup.Guid; + group.Name = realItem.ColorCatalogsGroup.Name; + group.GroupIndex = realItem.ColorCatalogsGroup.GroupIndex; + recentCatalog.ColorCatalogsGroups.Add(group); + } + + group.ColorCatalogsItems.Add(realItem); + } + } + } + + Recent = recentCatalog; + + SelectedItem = obj.SelectedItem; + + IsFree = true; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml new file mode 100644 index 000000000..ec8801dc1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml @@ -0,0 +1,232 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.JobProgressView" + 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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:JobProgressViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobProgressViewVM}"> + + <UserControl.Resources> + <converters:JobProgressToPositionConverter x:Key="JobProgressToPositionConverter" /> + </UserControl.Resources> + + <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 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> + + <Grid Margin="0 80 0 0"> + + <touch:TouchRingProgress Width="364" Height="364" RingThickness="10"> + <touch:TouchRingProgress.Style> + <Style TargetType="touch:TouchRingProgress"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Maximum" Value="{Binding RunningJobStatus.TotalProgressMinusSettingUp}"></Setter> + <Setter Property="Value" Value="{Binding RunningJobStatus.ProgressMinusSettingUp}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="False"> + <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"> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchRingProgress.Style> + </touch:TouchRingProgress> + + <touch:TouchBusyIndicator Width="360" Height="360" StrokeThickness="10" Maximum="100" Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchBusyIndicator.Style> + <Style TargetType="touch:TouchBusyIndicator"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Value" Value="0"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Setter Property="Value" Value="0"></Setter> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Value" Value="99.9999999"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Value" Value="99.9999999"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchBusyIndicator.Style> + </touch:TouchBusyIndicator> + + <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> + + <StackPanel Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> + <Image Source="../Images/JobProgressView/drop.png" Stretch="None" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Completed</TextBlock> + </StackPanel> + + <TextBlock FontWeight="Light" FontSize="{StaticResource TangoLargeFontSize}" Margin="0 10 0 0" HorizontalAlignment="Center"> + <Run Text="{Binding RunningJobStatus.ProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"></Run><Run Text="/" /><Run Text="{Binding RunningJobStatus.TotalProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"/> + <Run FontSize="16">m</Run> + </TextBlock> + </StackPanel> + + <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> + </StackPanel> + </StackPanel> + + <Rectangle Margin="0 10 0 0" Width="250" Stroke="{StaticResource TangoDividerBrush}" /> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 15 0 0"> + <Image Source="../Images/JobProgressView/clock.png" Stretch="None" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Time Left</TextBlock> + </StackPanel> + + <TextBlock FontWeight="Light" FontSize="{StaticResource TangoLargeFontSize}" Margin="0 10 0 0" HorizontalAlignment="Center"> + <Run Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run> + <Run FontSize="16" Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid Margin="0 150 0 0"> + <StackPanel MaxWidth="600"> + <Canvas Height="80" Margin="0"> + <StackPanel> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Canvas.Left"> + <Setter.Value> + <MultiBinding Converter="{StaticResource JobProgressToPositionConverter}"> + <Binding Path="RunningJobStatus.CurrentUnitProgress" /> + <Binding Path="RunningJobStatus.CurrentUnitTotalProgress" /> + <Binding RelativeSource="{RelativeSource AncestorType=Canvas}" Path="ActualWidth" /> + </MultiBinding> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> + <Setter Property="Canvas.Left" Value="0"></Setter> + </DataTrigger> + </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> + </StackPanel> + </Canvas> + + <Grid> + <controls:RunningJobViewer Height="26" Width="600" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> + + <TextBlock Margin="0 0 -50 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Right"> + <Run Text="x"></Run><Run Text="{Binding RunningJobStatus.RemainingUnits}"></Run> + </TextBlock> + </Grid> + </StackPanel> + </Grid> + + <touch:TouchButton Margin="0 100 0 0" Command="{Binding GoToJobCommand}" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding RunningJobStatus.IsCompleted,Converter={StaticResource BooleanToVisibilityConverter}}"> + 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 IsHitTestVisible="False" 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.JobsV2/Views/JobProgressView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml.cs new file mode 100644 index 000000000..90692296c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml.cs @@ -0,0 +1,28 @@ +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.Views +{ + /// <summary> + /// Interaction logic for JobProgressView.xaml + /// </summary> + public partial class JobProgressView : UserControl + { + public JobProgressView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml new file mode 100644 index 000000000..dd17e4668 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml @@ -0,0 +1,111 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.JobSummeryView" + 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:fa="http://schemas.fontawesome.io/icons/" + xmlns:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobSummeryViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobSummeryViewVM}"> + + <Grid Background="White"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold" Text="Dye Job"></TextBlock> + </Border> + + <Grid Grid.Row="1"> + <Border Padding="50"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <StackPanel> + <Grid> + <touch:TouchButton HorizontalContentAlignment="Stretch" HorizontalAlignment="Left" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Command="{Binding EditCommand}" BorderThickness="2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" RippleBrush="{StaticResource TangoRippleDarkBrush}" Background="Transparent" EnableDropShadow="False" Height="80" Padding="0" Width="270" Foreground="{StaticResource TangoPrimaryAccentBrush}" CornerRadius="40" BlurRadius="20"> + <DockPanel> + <Image DockPanel.Dock="Left" Source="../Images/pencil-blue.png" Width="30" Height="23" VerticalAlignment="Center" Margin="40 0 0 5"></Image> + <TextBlock Margin="0 0 55 0" HorizontalAlignment="Center" VerticalAlignment="Center">EDIT</TextBlock> + </DockPanel> + </touch:TouchButton> + <touch:TouchButton FontSize="{StaticResource TangoExpanderHeaderFontSize}" Margin="20 0 0 0" Height="80" Padding="0" Width="270" CornerRadius="40" BlurRadius="20" HorizontalAlignment="Right" DelayCommand="{Binding DyeCommand}" DelayCommandDuration="00:00:0.3"> + <StackPanel Orientation="Horizontal"> + <touch:TouchBusyIndicator IsIndeterminate="True" Visibility="{Binding IsPreparingJob,Converter={StaticResource BooleanToVisibilityConverter}}" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" Width="32" Height="32" Margin="-30 0 20 0" /> + <TextBlock VerticalAlignment="Center">DYE</TextBlock> + </StackPanel> + </touch:TouchButton> + </Grid> + </StackPanel> + </Grid> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="60*"/> + <RowDefinition Height="400*"/> + <RowDefinition Height="300*"/> + </Grid.RowDefinitions> + + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"></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"> + + </touch:TouchBusyIndicator> + + <UniformGrid Rows="2"> + <Grid> + <StackPanel VerticalAlignment="Center"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 15 0 0"> + <Image Source="../Images/length.png" Stretch="None" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Length</TextBlock> + </StackPanel> + + <TextBlock FontWeight="Light" FontSize="{StaticResource TangoLargeFontSize}" Margin="0 10 0 0" HorizontalAlignment="Center"> + <Run Text="{Binding Job.LengthIncludingNumberOfUnits,Mode=OneWay,StringFormat=0,FallbackValue=0}"/> + <Run FontSize="16">m</Run> + </TextBlock> + </StackPanel> + </Grid> + <Grid> + <Rectangle Margin="40 0" Stroke="{StaticResource TangoDividerBrush}" VerticalAlignment="Top" /> + <StackPanel VerticalAlignment="Center" Margin="0 -40 0 0"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 15 0 0"> + <Image Source="../Images/JobProgressView/clock.png" Stretch="None" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Time</TextBlock> + </StackPanel> + + <TextBlock FontWeight="Light" FontSize="{StaticResource TangoLargeFontSize}" Margin="0 10 0 0" HorizontalAlignment="Center"> + <Run Text="{Binding EstimatedDuration,Mode=OneWay,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run> + <Run FontSize="16" Text="{Binding EstimatedDuration,Mode=OneWay,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run> + </TextBlock> + </StackPanel> + </Grid> + </UniformGrid> + </Grid> + + <StackPanel Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Center" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding MachineProvider.Machine.BtsrInstalled,Converter={StaticResource BooleanToVisibilityConverter}}"> + <DockPanel> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <TextBlock Margin="5 1 0 0" VerticalAlignment="Center"> + <Run>Required tensioner level is </Run> + <Run Text="{Binding BtsrSpoolTension}" FontWeight="Bold"></Run> + </TextBlock> + </DockPanel> + </StackPanel> + + <!--<controls:JobSummeryViewer Height="40" JobModel="{Binding Job}" VerticalAlignment="Center" Margin="20 0" Grid.Row="2" />--> + </Grid> + </DockPanel> + </Border> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml.cs new file mode 100644 index 000000000..e83270e6b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobSummeryView.xaml.cs @@ -0,0 +1,28 @@ +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.Views +{ + /// <summary> + /// Interaction logic for JobView.xaml + /// </summary> + public partial class JobSummeryView : UserControl + { + public JobSummeryView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml new file mode 100644 index 000000000..b8930089d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -0,0 +1,742 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.JobView" + 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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:localConverters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:localControls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:components="clr-namespace:Tango.Touch.Components;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + mc:Ignorable="d" + d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}" x:Name="view"> + + <UserControl.Resources> + + <localConverters:ColorSpaceToVisibilityConverter x:Key="ColorSpaceToVisibilityConverter" /> + <localConverters:JobToEmbroideryImageConverter x:Key="JobToEmbroideryImageConverter" /> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"/> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + <converters:TimeSpanToMinutesConverter x:Key="TimeSpanToMinutesConverter"/> + + <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"> + <Setter Property="Margin" Value="20 15 60 15"></Setter> + </Style> + <Style TargetType="FrameworkElement" x:Key="Level2Container"> + <Setter Property="Margin" Value="80 30 60 0"></Setter> + </Style> + <Style TargetType="FrameworkElement" x:Key="Level2ContainerExtraMargin"> + <Setter Property="Margin" Value="80 40 60 0"></Setter> + </Style> + + <Style x:Key="CollapsedPanelButton" TargetType="{x:Type touch:TouchButton}"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Setter Property="MinHeight" Value="50"/> + <Setter Property="CornerRadius" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="Padding" Value="4"></Setter> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"></Setter> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + <DataTrigger Binding="{Binding JobModel.HasSelectedItems}" Value="false"> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + + <Style x:Key="TouchButtonWithDisableState" TargetType="{x:Type touch:TouchButton}"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"></Setter> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + + <DataTemplate x:Key="HSB_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="3"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="H" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42" Height="29"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Hue, StringFormat=0.0}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="S" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42" Height="29"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Saturation, StringFormat=0.0}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="B" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42" Height="29"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Brightness, StringFormat=0.0}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + + </DataTemplate> + + <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="3" Height="30" > + <StackPanel Orientation="Horizontal"> + <TextBlock Text="R" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.R}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="4 0 0 0"> + <TextBlock Text="G" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.G}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="4 0 0 0"> + <TextBlock Text="B" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.B}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="4" Height="30" > + <StackPanel Orientation="Horizontal"> + <TextBlock Text="C" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Cyan, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> + <TextBlock Text="M" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Magenta, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="Y" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Yellow, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="K" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Black, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="3" Height="30" MinWidth="150"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="L" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchL, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="5 0 0 0"> + <TextBlock Text="A" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchA, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="B" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchB, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="CATALOG_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="2" Height="30" MinWidth="150"> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="Catalog:" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" MinWidth="42" MaxWidth="130"> + <TextBlock Padding="4 0 4 0" FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding ColorCatalog.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="Color:" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" MinWidth="42"> + <TextBlock Padding="4 0 4 0" FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding ColorCatalogsItem.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> + <Grid Height="430" Margin="57 15 57 0"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Height="60"> + <touch:TouchButton Margin="20 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}"> + <Border Height="24" Width="24" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/delete_segment.png"/> + </Border> + </touch:TouchButton> + <touch:TouchButton Margin="20 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ElementName=view,Path=DataContext.DuplicateSegmentCommand}" CommandParameter="{Binding}"> + <Border Height="24" Width="24" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/duplicate.png"/> + </Border> + </touch:TouchButton> + </StackPanel> + <StackPanel Grid.Row="0" DockPanel.Dock="Left"> + <StackPanel Margin="0 0 0 0" Orientation="Horizontal" > + <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}">Segment #</controls:FastTextBlock> + <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding SegmentIndex,Mode=OneWay}"></controls:FastTextBlock> + </StackPanel> + <StackPanel Margin="0 0 0 0" Orientation="Horizontal"> + <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):" FontSize="18"></controls:FastTextBlock> + <touch:TouchNumericTextBox Margin="20 0 0 0" Width="92" DockPanel.Dock="Right" Value="{Binding Length, UpdateSourceTrigger=LostFocus}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" FontSize="18" ValueChangedEnd="Length_ValueChanged" TextGotFocus="Length_BeforeChangeValue"/> + </StackPanel> + </StackPanel> + + </DockPanel> + + <Border Grid.Row="1" x:Name="segmentBrush" Height="90" Margin="0 20 0 0" CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + + <Border Background="{Binding SegmentBrush}" CornerRadius="20"> + <DockPanel> + <touch:TouchButton Margin="0 0 20 0" VerticalAlignment="Center" DockPanel.Dock="Right" Command="{Binding ElementName=view,Path=DataContext.EditColorCommand}" CommandParameter="{Binding SecondBrushStop}" Visibility="{Binding IsGradient, Converter={StaticResource BooleanToVisibilityConverter}}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> + <Border Height="40" Width="40" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/Edit_color.png"/> + </Border> + </touch:TouchButton> + <touch:TouchButton Margin="20 0 0 0" VerticalAlignment="Center" DockPanel.Dock="Left" Command="{Binding ElementName=view,Path=DataContext.EditColorCommand}" CommandParameter="{Binding FirstBrushStop}" Visibility="{Binding HasColors, Converter={StaticResource BooleanToVisibilityConverter}}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> + <Border Height="40" Width="40" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/Edit_color.png"/> + </Border> + </touch:TouchButton> + <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> + <!--<touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.AddColorCommand}" CommandParameter="{Binding}" + Height="40" Width="40" Style="{StaticResource TangoRoundTouchIconButton}" Icon="Plus" Background="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoLightForegroundBrush}" Padding="12" Margin="20 0 0 0" />--> + <touch:TouchButton Margin="20 0 0 0" VerticalAlignment="Center" DockPanel.Dock="Left" Command="{Binding ElementName=view,Path=DataContext.AddColorCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> + <Border Height="40" Width="40" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/AddColor.png"/> + </Border> + </touch:TouchButton> + <TextBlock VerticalAlignment="Center" Margin="20 5 0 0" FontSize="{StaticResource TangoSmallFontSize}" Visibility="{Binding HasColors, Converter={StaticResource BooleanToVisibilityInverseConverter}}" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}">Add Color</TextBlock> + </StackPanel> + </DockPanel> + </Border> + </Border> + <!--<Canvas Grid.Row="1" x:Name="alert_canvas_segment" Width="30" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="-40 -10 0 0" > + <touch:TouchButton Height="22" Width="24" Canvas.Left="0" Canvas.Top="0" x:Name="addmyColors" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding HasOutOfGamutBrush, Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/Exclamation_black.png"/> + </Border> + </touch:TouchButton> + </Canvas>--> + + <Grid Grid.Row="2" x:Name="sliderThreeThumbs" Visibility="{Binding IsGradient, Converter={StaticResource BooleanToVisibilityConverter}}" > + <touch:TouchSliderThreeThumbs Height="40" MinimumMiddleRange="5.0" Length="{Binding Length}" LowerValue="{Binding LeftOffset, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MiddleValue="{Binding MiddleOffset, Mode=TwoWay}" UpperValue="{Binding RightOffset, Mode=TwoWay}" + LowerValueEndChanging ="{Binding LeftOffsetChangeComleted}" LowerValueStartChanging="{Binding LeftOffsetStartChanging}" + UpperValueStartChanging ="{Binding RightOffsetStartChanging}" UpperValueEndChanging="{Binding RightOffsetChangeComleted}" + MiddleValueStartChanging ="{Binding MiddleOffsetStartChanging}" MiddleValueEndChanging ="{Binding MiddleOffsetChangeComleted}"/> + </Grid> + + <Grid Grid.Row="3" Margin="0 10 0 0" x:Name="colorSpacesSegment" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*" MinWidth="10"/> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <ContentControl x:Name="leftColorSpaceValues" Grid.Column="0" Focusable="False" Margin="0 0 0 0" HorizontalAlignment="Left" Content="{Binding FirstBrushStop}" Visibility="{Binding HasColors, Converter={StaticResource BooleanToVisibilityConverter}}"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate/> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="HSB"> + <Setter Property="ContentTemplate" Value="{StaticResource HSB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="Catalog"> + <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + <Border Grid.Column="1"></Border> + <ContentControl x:Name="rightColorSpaceValues" Grid.Column="2" Focusable="False" Margin="0 0 0 0" + HorizontalAlignment="Right" + Visibility="{Binding IsGradient, Converter={StaticResource BooleanToVisibilityConverter}}" Content="{Binding SecondBrushStop}"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate/> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="HSB"> + <Setter Property="ContentTemplate" Value="{StaticResource HSB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=TwoWay}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="Catalog"> + <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + + </Grid> + + <Grid Grid.Row="4" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> + + <Border x:Name="gapBorder" Margin="0 0 0 0" Height="24" ClipToBounds="False" CornerRadius="10" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="gapBorder" Path="ActualWidth" /> + <Binding ElementName="gapBorder" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <TextBlock FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="4"> + <Run Text="{Binding InterSegmentLength, Mode=OneWay}"></Run> + <Run Text="m Gap"></Run> + </TextBlock> + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="12" RadiusY="12" /> + </Grid> + </Border> + + <DockPanel Margin="0 20 0 0" Grid.Row="1"> + <!--<Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}">--> + <Grid DockPanel.Dock="Right" Visibility="Collapsed"> + <touch:TouchButton x:Name="deletegap" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteGapCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Delete Gap</TextBlock> + </touch:TouchButton> + <touch:TouchButton x:Name="addGap" DockPanel.Dock="Right" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding AddGapCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Orientation="Horizontal"> + <Border Height="35" Width="35" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/add_gap.png"/> + </Border> + <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Add Gap</TextBlock> + </StackPanel> + </touch:TouchButton> + </Grid> + <touch:TouchButton DockPanel.Dock="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding DataContext.AddNewSegmentCommand, ElementName=listSegments}" CommandParameter="{Binding SegmentIndex}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> + <StackPanel Orientation="Horizontal"> + <Border Height="35" Width="35" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/AddNewSegment.png"/> + </Border> + <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Add New Segments</TextBlock> + </StackPanel> + </touch:TouchButton> + </DockPanel> + + <Rectangle Margin="0 10 0 0" Grid.Row="2" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Bottom"/> + </Grid> + </Grid> + </DataTemplate> + + <DataTemplate x:Key="CollapsedSegment_Template" DataType="{x:Type entities:Segment}"> + <Grid Height="180" Margin="57 15 57 0"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <DockPanel> + <Rectangle DockPanel.Dock="Top" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" Margin="0 0 0 10"/> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Height="40"> + <touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}"> + <Border Height="24" Width="24" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/delete_segment.png"/> + </Border> + </touch:TouchButton> + <touch:TouchButton Margin="20 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ElementName=view,Path=DataContext.DuplicateSegmentCommand}" CommandParameter="{Binding}"> + <Border Height="24" Width="24" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/duplicate.png"/> + </Border> + </touch:TouchButton> + </StackPanel> + <StackPanel DockPanel.Dock="Left"> + <StackPanel Margin="0 10 0 0" Orientation="Horizontal" > + <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}">Segment #</controls:FastTextBlock> + <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding SegmentIndex,Mode=OneWay}"></controls:FastTextBlock> + </StackPanel> + </StackPanel> + </DockPanel> + + <StackPanel Grid.Row="1" Orientation="Vertical"> + <Border Height="50" x:Name="segmentBrush" Margin="0 10 0 0" CornerRadius="25" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border Background="{Binding SegmentBrush}" CornerRadius="25" /> + </Border> + <Border x:Name="gapBorder" Margin="0 20 0 0" Height="24" ClipToBounds="False" CornerRadius="10" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="gapBorder" Path="ActualWidth" /> + <Binding ElementName="gapBorder" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <TextBlock FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="4"> + <Run Text="5m"></Run> + <Run Text=" Gap"></Run> + </TextBlock> + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="12" RadiusY="12" /> + </Grid> + </Border> + + </StackPanel> + + <Canvas Grid.Row="1" x:Name="select_canvas_segment" Width="24" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="-50 -35 0 0" > + <touch:TouchCheckBox Height="22" Width="24" Margin="20 -20 0 0" Style="{StaticResource TouchRoundCheckBox}" Canvas.Left="0" Canvas.Top="0" x:Name="selectItem" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center"/> + </Canvas> + + </Grid> + </DataTemplate> + + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}" SnapsToDevicePixels="False"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Border Grid.Row="0" x:Name="jobDetailsBorder" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoLightBorderBrush}" Margin="0 0 0 0"> + + <Grid x:Name="job_details" HorizontalAlignment="Stretch" > + <DockPanel Height="72" HorizontalAlignment="Stretch"> + + <touch:TouchButton Margin="0 0 30 0" DockPanel.Dock="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding EditJobDetailsCommand}" > + <Border Height="20" Width="20" BorderThickness="0" Background="Transparent" HorizontalAlignment="Right"> + <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/job_details.png"/> + </Border> + </touch:TouchButton> + + <Grid DockPanel.Dock="Left" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0 0 30 0" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + + <StackPanel Margin="10 0 0 0" VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left"> + <StackPanel.ToolTip> + <ToolTip> + <TextBlock Text="{Binding JobModel.Name}" /> + </ToolTip> + </StackPanel.ToolTip> + <TextBlock TextTrimming="CharacterEllipsis" VerticalAlignment="Center" FontWeight="Medium" FontSize="{StaticResource TangoMenuItemFontSize}" Text="{Binding JobModel.Name,FallbackValue='Job Name'}" MaxWidth="300"/> + </StackPanel> + <StackPanel Margin="10 0 0 0" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left"> + <StackPanel.ToolTip> + <ToolTip> + <TextBlock Text="{Binding JobModel.Rml.Name}" /> + </ToolTip> + </StackPanel.ToolTip> + <TextBlock Text="Thread Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" ></TextBlock> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontWeight="Medium" Text="{Binding JobModel.Rml.Name}"/> + + </StackPanel> + <StackPanel Margin="10 0 0 0" Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center"> + <StackPanel.ToolTip> + <ToolTip> + <TextBlock Text="{Binding JobModel.SpoolType.Name}" /> + </ToolTip> + </StackPanel.ToolTip> + <TextBlock Text="Spool Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" ></TextBlock> + <TextBlock Text="{Binding JobModel.SpoolType.Name}" Margin="10 0 0 0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontWeight="Medium"/> + </StackPanel> + </Grid> + </DockPanel> + </Grid> + </Border> + + <touch:TouchLoadingPanel Grid.Row="1" IsLoading="{Binding IsBusy}"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid> + <Grid > + <DockPanel VerticalAlignment="Top" x:Name="collapsedToolbar" Margin="0 2 20 0" HorizontalAlignment="Stretch" Height="66"> + + <Border DockPanel.Dock="Right" Width="613" Height="62" CornerRadius="31" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="1" Background="{StaticResource TangoPrimaryBackgroundBrush}" Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <Border.Effect> + <DropShadowEffect Opacity="0.5" ShadowDepth="6" Color="Silver" BlurRadius="10" Direction="270"/> + </Border.Effect> + <UniformGrid Columns="6" Rows="1" DockPanel.Dock="Left" HorizontalAlignment="Stretch" > + <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding RepeateSegmentCommand}" IsEnabled="False"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" > + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/repeat.png"/> + <TextBlock FontWeight="Medium" Margin="0 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Repeat</TextBlock> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding ReverseCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/reverse.png"/> + <TextBlock FontWeight="Medium" Margin="0 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Reverse</TextBlock> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding DeleteSegmentCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/delete_segment.png"/> + <TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Delete</TextBlock> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding PasteCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}" > + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/paste.png"/> + <TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Paste</TextBlock> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding CopyCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/duplicate.png"/> + <TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Copy</TextBlock> + </StackPanel> + </touch:TouchButton> + </UniformGrid> + </Border> + <Grid DockPanel.Dock="Left" HorizontalAlignment="Left" Margin="40 0 30 0"> + <StackPanel DockPanel.Dock="Left" HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Center"> + <touch:TouchButton Margin="0" Style="{StaticResource TouchButtonWithDisableState}" VerticalAlignment="Center" HorizontalAlignment="Left" EnableDropShadow="False" Command="{Binding UndoCommand}" ToolTip="Undone" > + <Border Padding="0" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <Image Height="28" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/undo.png"/> + </Border> + </touch:TouchButton> + <touch:TouchButton Margin="16 0 0 0" Style="{StaticResource TouchButtonWithDisableState}" VerticalAlignment="Center" HorizontalAlignment="Left" EnableDropShadow="False" Command="{Binding RedoCommand}" ToolTip="Restore"> + <Border Padding="0" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <Image Height="28" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/redo.png"/> + </Border> + </touch:TouchButton> + </StackPanel> + </Grid> + </DockPanel> + <Canvas Width="70" Height="70" Margin="0 3 40 0" HorizontalAlignment="Right" VerticalAlignment="Center"> + <touch:TouchButton HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding JobModeSwitchCommand}" > + <Border BorderThickness="0" Background="Transparent" HorizontalAlignment="Right"> + <Image Height="70" Width="70" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/job_mode.png"/> + </Border> + </touch:TouchButton> + </Canvas> + </Grid> + </Grid> + <Grid Grid.Row="1" x:Name="segmentsGrid" Grid.RowSpan="3" > + <Grid x:Name="Container" keyboard:KeyboardView.ContainerOffset="40" Margin="10 0 10 0" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <touch:TouchDropShadowBorder Margin="0 0 0 0" Padding="0 0 0 40" > + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Grid Grid.Row="0"> + <DockPanel> + <StackPanel x:Name="colorAndLength" DockPanel.Dock="Top" Orientation="Horizontal" VerticalAlignment="Top"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Margin" Value="20 15 10 15"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsFullMode}" Value="false"> + <Setter Property="Margin" Value="20 15 60 15"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <Image Source="../Images/JobView/color-length.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Color & Length</TextBlock> + </StackPanel> + <touch:TouchCheckBox x:Name="selectAll" Width="120" Height="22" Style="{StaticResource TouchRoundCheckBox}" Margin="28 0 0 20" IsChecked="{Binding JobModel.SelectAllSegments}" DockPanel.Dock="Top" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Left" Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}" Foreground="{StaticResource TangoMidAccentBrush}"> Select All</TextBlock> + </touch:TouchCheckBox> + </DockPanel> + </Grid> + <Grid Grid.Row="1" Margin="0 10 0 0"> + <!--Border x:Name="borderDockFloat" Height="10" Margin="0 0 0 0" BorderBrush="Transparent" > + <DockPanel x:Name="dockEdit" LastChildFill="False" Height="10" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"/> + </Border> --> + <ListBox x:Name="listSegments" Margin="10 0 10 40" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}" Style="{StaticResource SegmentsListBox}" + ScrollViewer.VerticalScrollBarVisibility="Visible" + Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityConverter}}" /> + + + <ListBox x:Name="collapsedListSegments" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource CollapsedSegment_Template}" Style="{StaticResource SegmentsListBox}" + ScrollViewer.VerticalScrollBarVisibility="Visible" + Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin=" 0 0 0 40"/> + + <!--<StackPanel x:Name="stackOutput" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"/>--> + + </Grid> + </Grid> + </touch:TouchDropShadowBorder> + </Grid> + <Border VerticalAlignment="Top" x:Name="borderEditDock" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 0" BorderBrush="{StaticResource TangoDividerBrush}" Padding="0 0 0 10" Margin="10 0 10 0"/> + </Grid> + + <Grid Grid.Row="2"> + <!--<Grid IsHitTestVisible="False"> + <Grid.Background> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="#AEFFFFFF" /> + <GradientStop Offset="1" Color="{StaticResource TangoPrimaryBackgroundColor}" /> + </LinearGradientBrush> + </Grid.Background> + <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> + </Grid>--> + </Grid> + + <!--<touch:TouchDropShadowBorder Grid.Row="3" Margin="10 0 10 15" CornerRadius="0" BorderThickness="0" Padding="0" >--> + <Border Grid.Row="3" Margin="10 0 10 15" BorderThickness="0"> + <touch:TouchExpander x:Name="summaryExpander" IsExpanded="{Binding IsSummaryOpened, Mode=TwoWay}" Grid.Row="3" Margin="15 0 15 0 " FontSize="{StaticResource TangoTitleFontSize}" BorderThickness="0" Style="{StaticResource TouchRoundedExpander}"> + <touch:TouchExpander.Header> + <DockPanel > + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 20 0" Visibility="{Binding IsSummaryOpened, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"> + <touch:TouchButton HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding RepeatUnitsCommand}" > + <Border CornerRadius="20" Width="130" Height="40" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}"> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">Repeat All</TextBlock> + </Border> + </touch:TouchButton> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" FontWeight="SemiBold" Foreground="{StaticResource TangoPrimaryAccentBrush}"> + <Run Text="x"></Run> + <Run Text="{Binding JobModel.NumberOfUnits,Mode=OneWay}"/> + </TextBlock> + </StackPanel> + <StackPanel DockPanel.Dock="Left" 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> + </DockPanel> + + </touch:TouchExpander.Header> + <StackPanel Margin="40 0 40 0"> + <TextBlock VerticalAlignment="Top" DockPanel.Dock="Top" Foreground="{StaticResource TangoDarkForegroundBrush}"> + <Run Text="Unit: "></Run> + <Run Text="{Binding JobModel.Length,Mode=OneWay}"/> + <Run Text="m"></Run> + </TextBlock> + + <Grid Margin=" 0 10 0 0"> + <!--<touch:TouchVirtualizedContentReplaceControl MinHeight="40"> + <DataTemplate>--> + <localControls:JobSummeryViewer JobModel="{Binding JobModel}" Height="20" DisplayMarkers="False" /> + <!--</DataTemplate> + </touch:TouchVirtualizedContentReplaceControl>--> + </Grid> + + <DockPanel Margin="0 20 0 0" LastChildFill="False"> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> + <TextBlock> + <Run Text="Total:"></Run> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnits,Mode=OneWay}"></Run> + <Run Text="m"></Run> + </TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobModel.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 JobModel.Length,Mode=OneWay}"></Run><Run>+</Run><Run Text="{Binding JobModel.LengthPercentageFactor,Mode=OneWay}"></Run><Run>%</Run><Run>)</Run> + </TextBlock> + </StackPanel> + + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> + <TextBlock Margin="0 3 0 0" VerticalAlignment="Bottom"> + <!--<Run Text="Factor: +"></Run>--> + <Run Text="Duration: "></Run> + <Run Text="{Binding JobModel.GetEstimatedDuration, Converter={StaticResource TimeSpanToMinutesConverter},FallbackValue=0, Mode=OneWay,StringFormat=0.0}"></Run> + <Run Text="min"></Run> + </TextBlock> + + <!--<touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding JobModel.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock>--> + </StackPanel> + </DockPanel> + </StackPanel> + </touch:TouchExpander> + </Border> + <!--</touch:TouchDropShadowBorder>--> + + <!--<dragAndDrop:DraggingSurface x:Name="DraggingSurface" />--> + </Grid> + </touch:TouchLoadingPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs new file mode 100644 index 000000000..31a7f7918 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +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; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core.DI; +using Tango.PPC.Jobs.Models; +using Tango.PPC.Jobs.ViewContracts; +using Tango.PPC.Jobs.ViewModels; +using static Tango.SharedUI.Controls.NavigationControl; + +namespace Tango.PPC.Jobs.Views +{ + /// <summary> + /// Interaction logic for JobView.xaml + /// </summary> + public partial class JobView : UserControl, INavigationView, IJobView + { + private JobViewVM _vm; + + + public JobView() + { + InitializeComponent(); + + Loaded += (_, __) => + { + _vm = DataContext as JobViewVM; + }; + + TangoIOC.Default.Register<IJobView>(this); + } + + public void OnNavigatedTo() + { + + } + + //private void OnBrushStopFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + //{ + // _vm.OnBrushStopFieldValueChanged((sender as FrameworkElement).DataContext as BrushStop); + //} + + public void DisplaySampleDye() + { + //expander_sample_dye.IsExpanded = true; + //await Task.Delay(500); + //scrollViewer.ScrollToElement(expander_sample_dye); + } + + public void DisplayFineTuning() + { + //expander_fine_tuning.IsExpanded = true; + //await Task.Delay(500); + //scrollViewer.ScrollToElement(expander_fine_tuning); + } + + public void OnNavigatedFrom() + { + + } + + //private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + //{ + // if (_vm.JobModel != null && _vm.JobModel.Segments != null && _vm.JobModel.Segments.Count > 3) + // { + // var position = scrollViewer.GetElementPosition(listSegments); + // var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); + + // if (stackOutputPosition.Y > 100) + // { + // if (position.Y < 110 && !_is_edit_docked) + // { + // DockEditing(); + // } + // else if (position.Y > 110 && _is_edit_docked) + // { + // FloatEditing(); + // } + // } + // else + // { + // borderEditDock.Visibility = Visibility.Collapsed; + // } + // } + // else if (_is_edit_docked) + // { + // FloatEditing(); + // } + //} + + //private void DockEditing() + //{ + // _is_edit_docked = true; + // borderDockFloat.Child = null; + // borderEditDock.Child = dockEdit; + // borderEditDock.Visibility = Visibility.Visible; + //} + + //private void FloatEditing() + //{ + // _is_edit_docked = false; + // borderEditDock.Child = null; + // borderDockFloat.Child = dockEdit; + // borderEditDock.Visibility = Visibility.Collapsed; + //} + + //private void OnLiquidVolumeFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + //{ + // var liquidVolume = (sender as FrameworkElement).DataContext as LiquidVolume; + + // if (liquidVolume != null) + // { + // _vm.OnBrushStopFieldValueChanged(liquidVolume.BrushStop); + // } + //} + + public void ScrollToTop() + { + if(listSegments.IsVisible && listSegments.Items.Count > 0) + { + listSegments.ScrollIntoView(listSegments.Items[0]); + + } + //FloatEditing(); + //scrollViewer.ScrollToTop(); + } + + private void Length_ValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + { + var segmentModel = (sender as FrameworkElement).DataContext as SegmentModel; + if(segmentModel != null) + { + segmentModel.LengthChanged(e.Value); + } + + } + private void Length_BeforeChangeValue(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + { + var segmentModel = (sender as FrameworkElement).DataContext as SegmentModel; + if (segmentModel != null) + { + segmentModel.LengthBeforeChange(e.Value); + } + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml new file mode 100644 index 000000000..e7823d33d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml @@ -0,0 +1,355 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.JobsView" + 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:touchComponents="clr-namespace:Tango.Touch.Components;assembly=Tango.Touch" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:views="clr-namespace:Tango.PPC.Jobs.Views" + xmlns:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobsViewVM}"> + + <UserControl.Resources> + + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Styles.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <converters:JobToPieImageConverter x:Key="JobToPieImageConverter" /> + <sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> + <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> + <converters:JobsCategoryToVisibilityConverter x:Key="JobsCategoryToVisibilityConverter" /> + <converters:JobsCategoryToOpacityConverter x:Key="JobsCategoryToOpacityConverter" /> + </ResourceDictionary> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Jobs V2</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <Grid.RowDefinitions> + <RowDefinition Height="100"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -28 30 0"> + <StackPanel Orientation="Horizontal" Height="58" RenderTransformOrigin="0.5,0.5"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Opacity" Value="0"></Setter> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="100" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMultiSelecting}" Value="True"> + <Setter Property="IsHitTestVisible" Value="True"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" To="0" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" To="100" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <touch:TouchIconButton Command="{Binding ClearSelectionCommand}" Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 0 30 0" Padding="20" Icon="Undo"> + <touch:TouchIconButton.Style> + <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> + <Setter Property="IconAngle" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMultiSelecting}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="360" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="0" Duration="00:00:00"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIconButton.Style> + </touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding ExportJobCommand}" Margin="0 0 30 0" Padding="20" Icon="HddRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding CloneJobsCommand}" Margin="0 0 30 0" Padding="20" Icon="CopyRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding DeleteJobsCommand}" Padding="20" Icon="TrashAltRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> + </StackPanel> + <touch:TouchIconButton Command="{Binding AddJobCommand}" RenderTransformOrigin="0.5,0.5" Margin="0 -15 0 0" Padding="20" Height="80" Icon="Plus" HorizontalAlignment="Right"> + <touch:TouchIconButton.Style> + <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> + <Setter Property="Opacity" Value="1"></Setter> + <Setter Property="IsHitTestVisible" Value="True"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMultiSelecting}" Value="True"> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0.5" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0.5" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIconButton.Style> + </touch:TouchIconButton> + </Grid> + + <DockPanel> + <touch:TouchNavigationLinks DockPanel.Dock="Left" x:Name="navigationLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" SelectedIndex="{Binding SelectedCategoryIndex,Mode=TwoWay}" IsEnabled="{Binding IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> + <TextBlock>DRAFT</TextBlock> + <TextBlock>HISTORY</TextBlock> + </touch:TouchNavigationLinks> + + <Grid VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0 5 0 0"> + <DockPanel> + <Rectangle Margin="0 0 20 0" HorizontalAlignment="Center" VerticalAlignment="Bottom" Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" Height="25"></Rectangle> + <touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" /> + <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay}" Watermark="find name, customer..."></touch:TouchTextBox> + </DockPanel> + </Grid> + </DockPanel> + + <Grid Grid.Row="1" x:Name="moveGrid"> + <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid.Columns> + <touch:LightTouchDataGridColumn Width="90"> + <touch:LightTouchDataGridColumn.Header> + <Image Source="../Images/warning.png" Width="24" /> + </touch:LightTouchDataGridColumn.Header> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <Grid Margin="5 0 0 0" Width="40" Height="40"> + <Image HorizontalAlignment="Left" VerticalAlignment="Top" Width="20"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/sample_approved_small_gray.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobSampleDyeStatus}" Value="Approved"> + <Setter Property="Source" Value="../Images/sample_approved_small.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <Image HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="20"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/color_approved_small_gray.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobFineTuningStatus}" Value="Approved"> + <Setter Property="Source" Value="../Images/color_approved_small.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </Grid> + </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'}"></TextBlock> + </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> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25',IsAsync=True}" Width="25" Height="25" HorizontalAlignment="Left"></Image> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn SortMember="JobIndex" SortDirection="{x:Null}" Width="78" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DisplayChevron="False" ForcedSortDirection="Ascending"> + <touch:LightTouchDataGridColumn.HeaderTemplate> + <DataTemplate> + <Border CornerRadius="0 5 5 0"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SortDirection}" Value="Ascending"> + <Setter Property="Background" Value="{StaticResource TangoLowAccentBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <Rectangle HorizontalAlignment="Left" StrokeThickness="2" Stroke="{StaticResource TangoColumnDividerBrush}" /> + <Image Source="/Images/arrows.png" Width="28" /> + </Grid> + </Border> + </DataTemplate> + </touch:LightTouchDataGridColumn.HeaderTemplate> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <dragAndDrop:DragThumb IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" Background="Transparent" touchComponents:Ripple.PreventRipple="True" touchComponents:TransformationHelper.PreventTransform="True"> + <dragAndDrop:DragThumb.Style> + <Style TargetType="dragAndDrop:DragThumb"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:LightTouchDataGridCell},Path=Column.SortDirection}" Value="Ascending"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </dragAndDrop:DragThumb.Style> + <StackPanel Width="30" IsHitTestVisible="False" VerticalAlignment="Center"> + <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" /> + <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="0 5 0 0" /> + </StackPanel> + </dragAndDrop:DragThumb> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + </touch:LightTouchDataGrid.Columns> + </touch:LightTouchDataGrid> + </touch:TouchLoadingPanel> + + <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='History'}"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid.Columns> + <touch:LightTouchDataGridColumn Width="50"> + <touch:LightTouchDataGridColumn.Header> + <Image Source="../Images/warning.png" Width="24" /> + </touch:LightTouchDataGridColumn.Header> + <touch:LightTouchDataGridColumn.CellTemplate > + <DataTemplate> + <touch:TouchIcon Width="26" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobStatus}" Value="Disrupted"> + <Setter Property="Icon" Value="AlertCircleOutline"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <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> + </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> + </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> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25',IsAsync=True}" Width="25" Height="25" HorizontalAlignment="Left"></Image> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + </touch:LightTouchDataGrid.Columns> + </touch:LightTouchDataGrid> + </touch:TouchLoadingPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml.cs new file mode 100644 index 000000000..23785881d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml.cs @@ -0,0 +1,63 @@ +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; +using Tango.Core.DI; +using Tango.PPC.Jobs.ViewContracts; + +namespace Tango.PPC.Jobs.Views +{ + /// <summary> + /// Interaction logic for JobsView.xaml + /// </summary> + public partial class JobsView : UserControl, IJobsView + { + public JobsView() + { + InitializeComponent(); + TangoIOC.Default.Register<IJobsView>(this); + } + + private async void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (dataGridJobs != null) + { + await Task.Delay(200); + + if (navigationLinks.SelectedIndex == 0) + { + dataGridJobs.LayoutRows(false); + dataGridJobs.ScrollViewer.ScrollToTop(); + } + else + { + dataGridJobsHistory.LayoutRows(false); + dataGridJobsHistory.ScrollViewer.ScrollToTop(); + } + } + } + + public void ScrollToTop() + { + if (dataGridJobs != null && dataGridJobs.ScrollViewer != null) + { + dataGridJobs.ScrollViewer.ScrollToTop(); + } + + if (dataGridJobsHistory != null && dataGridJobsHistory.ScrollViewer != null) + { + dataGridJobsHistory.ScrollViewer.ScrollToTop(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml new file mode 100644 index 000000000..505ccc312 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml @@ -0,0 +1,22 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.MainView" + 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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:views="clr-namespace:Tango.PPC.Jobs.Views" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <controls:NavigationControl TransitionType="Slide" TransitionDuration="00:00:0.2" KeepElementsAttached="True"> + <views:JobsView /> + <views:JobSummeryView /> + <views:JobView /> + <views:TwineCatalogView /> + <views:JobProgressView /> + </controls:NavigationControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml.cs new file mode 100644 index 000000000..afba4c396 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/MainView.xaml.cs @@ -0,0 +1,28 @@ +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.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml new file mode 100644 index 000000000..19e1f722f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="Tango.PPC.Jobs.Views.TwineCatalogView" + 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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:global="clr-namespace:Tango.PPC.Jobs" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:TwineCatalogViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.TwineCatalogViewVM}"> + <Grid> + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold"> + <Run Text="{Binding Catalog.Name}"></Run> + <Run>Catalog</Run> + </TextBlock> + </Border> + + <Grid Grid.Row="1"> + <touch:TouchLoadingPanel IsLoading="{Binding IsBusy}"> + <DockPanel Margin="10"> + <Border DockPanel.Dock="Bottom" Height="100"> + <touch:TouchButton Command="{Binding OKCommand}" FontSize="{StaticResource TangoButtonFontSize}" HorizontalAlignment="Right" VerticalAlignment="Center" Content="SELECT" Height="60" Width="200" Style="{StaticResource TangoHollowButton}" Margin="0 0 20 0" /> + </Border> + + <Border Style="{StaticResource TangoTouchBorder}" Padding="20 20 20 100" Margin="0 10 0 0"> + <controls:TwineCatalogViewer Catalog="{Binding Catalog,Mode=TwoWay}" Recent="{Binding Recent}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" Filter="{Binding Filter,Mode=TwoWay}" /> + </Border> + </DockPanel> + </touch:TouchLoadingPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml.cs new file mode 100644 index 000000000..57600322f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/TwineCatalogView.xaml.cs @@ -0,0 +1,28 @@ +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.Views +{ + /// <summary> + /// Interaction logic for TwineCatalogColorCorrectionView.xaml + /// </summary> + public partial class TwineCatalogView : UserControl + { + public TwineCatalogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/app.config new file mode 100644 index 000000000..ec465920b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/app.config @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/packages.config new file mode 100644 index 000000000..4cf1b4859 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/packages.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 0eb93cc45..bf8777200 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -366,6 +366,11 @@ </DockPanel> <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Use Legacy Jobs Module</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.UseJobsModuleV2,Converter={StaticResource BooleanInverseConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> <TextBlock VerticalAlignment="Center">Always Start in Technician Mode</TextBlock> <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableTechnicianModeByDefault}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> </DockPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml index c4d047d39..7a8b2908d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml @@ -17,9 +17,9 @@ <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> - <touch:LightTouchScrollViewer x:Name="scrollViewer" ScrollBarVisibility="Collapsed"> + <touch:LightTouchScrollViewer x:Name="scrollViewer" ScrollBarVisibility="Collapsed" > <!--<Border Background="White">--> - <local:TwineCatalogRenderer x:Name="renderer" Groups="{Binding ColorCatalogsGroups}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}"></local:TwineCatalogRenderer> + <local:TwineCatalogRenderer x:Name="renderer" Groups="{Binding ColorCatalogsGroups}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={ x:Type local:TwineCatalogControl}},Path=SelectedItem,Mode=TwoWay }"></local:TwineCatalogRenderer> <!--</Border>--> </touch:LightTouchScrollViewer> @@ -93,7 +93,7 @@ </touch:TouchListBox.ItemTemplate> </touch:TouchListBox>--> - <Grid Grid.Column="1"> + <Grid Grid.Column="1" Margin="10 60 0 20"> <!--<Rectangle Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Left" />--> <Grid> <Grid.ColumnDefinitions> @@ -130,8 +130,8 @@ </ItemsControl> </Border> - <Grid Grid.Column="1"> - <touch:TouchSlider x:Name="slider" ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding ColorCatalogsGroups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False"> + <Grid Grid.Column="1" > + <touch:TouchSlider x:Name="slider" ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding ColorCatalogsGroups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False"> <touch:TouchSlider.ThumbTemplate> <ControlTemplate> <touch:TouchIcon Foreground="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchSlider},Path=Foreground}" Width="40" Height="40" Icon="Water" Angle="-90" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index 6ef7d92e8..8b7ea81c5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -13,6 +13,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Tango.BL.Entities; +using Tango.Touch.Components; using Tango.Touch.Controls; namespace Tango.PPC.Common.Controls @@ -27,6 +28,7 @@ namespace Tango.PPC.Common.Controls private ColorCatalog _catalog; private bool _preventChange; private double _lastScrollPosition = 0; + private bool _findInProcess = false; /// <summary> /// Gets or sets the selected catalog item. @@ -37,7 +39,35 @@ namespace Tango.PPC.Common.Controls set { SetValue(SelectedItemProperty, value); } } public static readonly DependencyProperty SelectedItemProperty = - DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogControl), new PropertyMetadata(null)); + DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnSelectedItemPropertyChanged))); + + + private static void OnSelectedItemPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + TwineCatalogControl twineCatalogControl = (TwineCatalogControl)d; + if(e.OldValue != e.NewValue) + { + twineCatalogControl.SelectedItemPropertyChanged(); + } + } + + /// <summary> + /// Gets or sets the collection filter. + /// </summary> + public ICollectionFilter CollectionFilter + { + get { return (ICollectionFilter)GetValue(CollectionFilterProperty); } + set { SetValue(CollectionFilterProperty, value); } + } + public static readonly DependencyProperty CollectionFilterProperty = + DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(TwineCatalogControl), new PropertyMetadata(null, (d, e) => (d as TwineCatalogControl).OnCollectionFilterChanged())); + + + public void SelectedItemPropertyChanged() + { + // if(renderer.SelectedItem != this.SelectedItem) + // renderer.SelectedItem = this.SelectedItem; + } /// <summary> /// Initializes a new instance of the <see cref="TwineCatalogControl"/> class. @@ -100,7 +130,7 @@ namespace Tango.PPC.Common.Controls if (!_preventChange) { - if (_catalog != null) + if (_catalog != null && scrollViewer != null) { _preventChange = true; var group = _catalog.ColorCatalogsGroupsOrdered.ElementAt(_catalog.ColorCatalogsGroupsOrdered.Count - 1 - (int)e.NewValue); @@ -114,5 +144,26 @@ namespace Tango.PPC.Common.Controls slider.Foreground = new SolidColorBrush(_catalog.ColorCatalogsGroupsOrdered.ElementAt(_catalog.ColorCatalogsGroupsOrdered.Count - 1 - (int)e.NewValue).Color); } } + + private void OnCollectionFilterChanged() + { + if (_findInProcess) + return; + if (CollectionFilter != null) + { + CollectionFilter.FilterChanged -= CollectionFilter_FilterChanged; + CollectionFilter.FilterChanged += CollectionFilter_FilterChanged; + } + } + + private void CollectionFilter_FilterChanged(object sender, EventArgs e) + { + _findInProcess = true; + if (CollectionFilter != null ) + { + renderer.ScrollToFirstFindItem(CollectionFilter); + } + _findInProcess = false; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs index a3b65d17a..9b865c18b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs @@ -9,7 +9,9 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.Touch.Components; using Tango.Touch.Controls; namespace Tango.PPC.Common.Controls @@ -21,6 +23,7 @@ namespace Tango.PPC.Common.Controls public DrawingVisual Visual { get; set; } public ColorCatalogsItem Item { get; set; } public double PositionY { get; set; } + public Rect ImageRect { get; set; } } private class GroupContainer @@ -40,14 +43,19 @@ namespace Tango.PPC.Common.Controls private readonly VisualCollection _children; private List<ItemContainer> _catalogItems; private List<GroupContainer> _groupItems; - private double ellipseWidth = 60; - private double ellipseHeight = 60; - private double textHeight = 30; - private double ellipseMargin = 20; - private double textMargin = 5; - private double groupMargin = 60; + private double ellipseWidth = 70; + private double ellipseHeight = 70; + private double textHeight = 20; + private double ellipseMarginX = 18; + private double ellipseMarginY = 50; + private double textMargin = 8; + private double groupMargin = 50; private bool selectedFromClick; private LightTouchScrollViewer _scrollViewer; + private BitmapSource _myColorBitmap; + private double imageWidth = 24; + private double imageHeight = 22; + private Point _lastMouseClickPoint; public IEnumerable<ColorCatalogsGroup> Groups { @@ -92,6 +100,7 @@ namespace Tango.PPC.Common.Controls this.PreviewMouseUp += TwineCatalogRenderer_MouseLeftButtonUp; this.Loaded += TwineCatalogRenderer_Loaded; + _myColorBitmap = new BitmapImage(new Uri($"pack://application:,,,/Tango.PPC.JobsV2;component/Images/ColorSelection/Heart.png", UriKind.Absolute)); } private void TwineCatalogRenderer_Loaded(object sender, RoutedEventArgs e) @@ -136,12 +145,12 @@ namespace Tango.PPC.Common.Controls { // Retreive the coordinates of the mouse button event. Point pt = e.GetPosition((UIElement)this); - + _lastMouseClickPoint = pt; // Initiate the hit test by setting up a hit test result callback method. VisualTreeHelper.HitTest(this, null, HitTestCallback, new PointHitTestParameters(pt)); } } - + // If a child visual object is hit, toggle its opacity to visually indicate a hit. public HitTestResultBehavior HitTestCallback(HitTestResult result) { @@ -152,9 +161,13 @@ namespace Tango.PPC.Common.Controls if (visual != null) { var container = _catalogItems.SingleOrDefault(x => x.Visual == visual); - + if (container != null && container.Item is ColorCatalogsItem) { + if (container.ImageRect.Contains(_lastMouseClickPoint)) + { + // clicked on image + } selectedFromClick = true; SelectedItem = container.Item; selectedFromClick = false; @@ -176,8 +189,9 @@ namespace Tango.PPC.Common.Controls (newItem.Visual.Transform as ScaleTransform).ScaleX = 1.3; (newItem.Visual.Transform as ScaleTransform).ScaleY = 1.3; - if (!selectedFromClick) + if (!selectedFromClick && _scrollViewer != null) { + _scrollViewer.ScrollToPosition(newItem.PositionY - _scrollViewer.ActualHeight / 2); } } @@ -189,7 +203,7 @@ namespace Tango.PPC.Common.Controls } } - private ItemContainer AddCatalogItem(DrawingVisual visual, ColorCatalogsItem item, double y) + private ItemContainer AddCatalogItem(DrawingVisual visual, ColorCatalogsItem item, double y, Rect imageRect) { _children.Add(visual); @@ -198,6 +212,7 @@ namespace Tango.PPC.Common.Controls Visual = visual, Item = item, PositionY = y, + ImageRect = imageRect }; _catalogItems.Add(container); @@ -238,40 +253,49 @@ namespace Tango.PPC.Common.Controls var groupContainer = AddGroupItem(CreateGroup(group.Name, position_y), group, position_y); - position_y += ellipseMargin; + position_y += ellipseMarginX; foreach (var item in group.ColorCatalogsItems.OrderBy(x => x.ItemIndex)) { - double x = position_x + ellipseMargin; + double x = position_x + ellipseMarginX; if (x + ellipseWidth > ActualWidth) { position_x = 0; - position_y += (ellipseHeight + ellipseMargin + textMargin + textHeight); + position_y += (ellipseHeight + ellipseMarginY + textMargin + textHeight); } - - var itemContainer = AddCatalogItem(CreateItem(item, position_x + ellipseMargin, position_y + ellipseMargin), item, position_y + ellipseMargin); + Rect imageRect = new Rect(new Point(position_x + ellipseWidth, position_y + ellipseMarginY/2 + 2), new Size( imageWidth, imageHeight)); + var itemContainer = AddCatalogItem(CreateItem(item, position_x + ellipseMarginX, position_y + ellipseMarginY, imageRect), item, position_y + ellipseMarginY, imageRect); groupContainer.Items.Add(itemContainer); - position_x += ellipseWidth + ellipseMargin; + position_x += ellipseWidth + ellipseMarginX; } - position_y += (ellipseHeight + ellipseMargin + textMargin + textHeight + groupMargin); + position_y += (ellipseHeight + ellipseMarginY + textMargin + textHeight + groupMargin); } Height = position_y; } + + UpdateLayout(); + if (SelectedItem != null) + { + OnSelectedItemChanged( null, SelectedItem); + } + //InvalidateVisual(); } - private DrawingVisual CreateItem(ColorCatalogsItem item, double x, double y) + private DrawingVisual CreateItem(ColorCatalogsItem item, double x, double y, Rect imageRect) { DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); + + drawingContext.DrawImage(_myColorBitmap, imageRect); drawingContext.DrawEllipse(new SolidColorBrush(item.Color), null, new Point(x + ellipseWidth / 2, y + ellipseHeight / 2), ellipseWidth / 2, ellipseHeight / 2); - + var formattedText = new FormattedText(item.Name, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, @@ -279,7 +303,7 @@ namespace Tango.PPC.Common.Controls 16, Foreground); - formattedText.MaxTextWidth = ellipseWidth + ellipseMargin; + formattedText.MaxTextWidth = ellipseWidth + ellipseMarginX; drawingContext.DrawText(formattedText, new Point((x + (ellipseWidth / 2)) - (formattedText.Width / 2), y + ellipseHeight + textMargin)); @@ -313,12 +337,13 @@ namespace Tango.PPC.Common.Controls CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Flexo"), - 25, + 23, Foreground); //formattedText.SetFontWeight(FontWeights.SemiBold); - drawingContext.DrawText(formattedText, new Point((ActualWidth / 2) - (formattedText.Width / 2), y)); + // drawingContext.DrawText(formattedText, new Point((ActualWidth / 2) - (formattedText.Width / 2), y)); + drawingContext.DrawText(formattedText, new Point(ellipseMarginX, y)); drawingContext.Close(); @@ -338,5 +363,20 @@ namespace Tango.PPC.Common.Controls return _children[index]; } + + public void ScrollToFirstFindItem(ICollectionFilter collectionFilter) + { + foreach (var group in _groupItems.Where(x => x.Items.Count > 0).Reverse().ToList()) + { + foreach( var item in group.Items) + { + if(collectionFilter.Filter(item.Item)) + { + _scrollViewer.ScrollToPosition(item.PositionY - _scrollViewer.ActualHeight / 2); + break; + } + } + } + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index e02352b9b..ff6dbce08 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -304,6 +304,11 @@ namespace Tango.PPC.Common public bool EnableProxifier { get; set; } /// <summary> + /// Gets or sets a value indicating whether to use the new jobs module. + /// </summary> + public bool UseJobsModuleV2 { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> /// <returns></returns> @@ -363,6 +368,7 @@ namespace Tango.PPC.Common EnableSpoolReplacementDialog = true; EnableProxifier = true; + UseJobsModuleV2 = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index b742c3b73..bb0a694cf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -10,11 +10,17 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Resources/Colors.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Resources/Fonts.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/Shared.xaml"/> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchSlider.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchToggleSlider.xaml"/> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchIconButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchListBox.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchCheckBox.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchExpander.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchNumericUpDownControl.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchExpander.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchNativeListBox.xaml" /> <!--PPC--> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Styles.xaml index 317b2f13f..bb1890e7f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Styles.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Styles.xaml @@ -44,6 +44,32 @@ <Setter Property="ItemContainerStyle" Value="{StaticResource BlankListBoxItem}"></Setter> </Style> + <Style TargetType="{x:Type ListBox}" x:Key="SegmentsListBox" BasedOn="{StaticResource BlankListBox}"> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel"></Setter> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel" /> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ListBox}"> + <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> + <touch:TouchScrollViewer CanContentScroll="True" + Padding="{TemplateBinding Padding}" + Focusable="False" + HorizontalScrollBarVisibility="Hidden"> + <ItemsPresenter /> + </touch:TouchScrollViewer> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style TargetType="touch:TouchSimpleDataGrid" x:Key="TechGrid" BasedOn="{StaticResource {x:Type touch:TouchSimpleDataGrid}}"> <Style.Resources> <Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config index 5272eb35d..4d7554231 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -13,7 +13,7 @@ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <!--Required for cefCharp--> - <probing privatePath="x86"/> + <probing privatePath="x86" /> <!--<dependentAssembly> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -24,6 +24,78 @@ <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /> </dependentAssembly>--> + <dependentAssembly> + + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /> + + </dependentAssembly> + + <dependentAssembly> + + <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> + + </dependentAssembly> + </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs index bbabed225..d0f6484ab 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs @@ -15,6 +15,7 @@ using Tango.PPC.Common; using Tango.PPC.Jobs; using System.Windows.Data; using Tango.Core.DI; +using Tango.Settings; namespace Tango.PPC.UI.Modules { @@ -84,11 +85,21 @@ namespace Tango.PPC.UI.Modules /// </summary> public void LoadModules() { + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + if (!_loaded) { //Preloaded - LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); - AllModules.Add(new JobsModule()); + if (settings.UseJobsModuleV2) + { + LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsV2Module))); + AllModules.Add(new JobsV2Module()); + } + else + { + LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); + AllModules.Add(new JobsModule()); + } //Preloaded AllModules.Clear(); @@ -129,6 +140,17 @@ namespace Tango.PPC.UI.Modules AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute<PPCModuleAttribute>().Index).ToObservableCollection(); + if (settings.UseJobsModuleV2) + { + var legacyJobsModule = AllModules.SingleOrDefault(x => x.GetType() == typeof(JobsModule)); + AllModules.Remove(legacyJobsModule); + } + else + { + var newJobsModule = AllModules.SingleOrDefault(x => x.GetType() == typeof(JobsV2Module)); + AllModules.Remove(newJobsModule); + } + UserModules.Clear(); if (_authenticationProvider.AuthenticationRequired && _authenticationProvider.CurrentUser != null) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index e812b4a7f..8ff836354 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -597,6 +597,10 @@ <Project>{a8077b3e-8dd6-4572-8ec4-a27bdc91b70a}</Project> <Name>Tango.PPC.Events</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.PPC.JobsV2\Tango.PPC.JobsV2.csproj"> + <Project>{dbbd90f4-4135-475d-a8f8-6795d3a8f697}</Project> + <Name>Tango.PPC.JobsV2</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.PPC.Jobs\Tango.PPC.Jobs.csproj"> <Project>{096f16c8-6d06-4b5f-9496-b9d2df2d94a3}</Project> <Name>Tango.PPC.Jobs</Name> @@ -795,7 +799,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</ </PropertyGroup> <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/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 0ae50defa..9dc4684c2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -75,7 +75,7 @@ namespace Tango.PPC.UI.ViewModels { base.OnApplicationReady(); MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; - MachineProvider.MachineOperator.FirmwareStarted += MachineOperator_FirmwareStarted; + //MachineProvider.MachineOperator.FirmwareStarted += MachineOperator_FirmwareStarted; MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; |
