diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-10-21 09:07:26 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-10-21 09:07:26 +0300 |
| commit | e44b1c8459db5a1cc75e1653d3e059c4825e1b68 (patch) | |
| tree | 98c107bf6f8a2c55b298d4e554fb90d71e1a0411 /Software/Visual_Studio/PPC | |
| parent | 63c1f7b5d85d2f1e6b4eeac612d5bb02d30481c7 (diff) | |
| download | Tango-e44b1c8459db5a1cc75e1653d3e059c4825e1b68.tar.gz Tango-e44b1c8459db5a1cc75e1653d3e059c4825e1b68.zip | |
Added Collapsed mode, Changes in converters CMYK.
Diffstat (limited to 'Software/Visual_Studio/PPC')
21 files changed, 969 insertions, 331 deletions
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 index a8fff7c63..8c84777a3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/JobSummeryViewer.xaml @@ -34,7 +34,7 @@ <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="JobModel.Length"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="LengthWithFactor"></Binding> + <Binding Path="LengthWithInterSegment"></Binding> </MultiBinding> </Grid.Width> @@ -49,7 +49,7 @@ </Style.Triggers> </Style> </DockPanel.Style> - <controls:FastTextBlock Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}" /> + <controls:FastTextBlock Text="{Binding LengthWithInterSegment,Mode=OneWay,StringFormat=N0}" /> <controls:FastTextBlock Text="m" /> </DockPanel> </Grid> @@ -82,7 +82,7 @@ <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="JobModel.Length"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="LengthWithFactor"></Binding> + <Binding Path="LengthWithInterSegment"></Binding> </MultiBinding> </Grid.Width> <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> 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 index e81563b59..f571cd519 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs @@ -22,6 +22,7 @@ namespace Tango.PPC.Jobs.Dialogs get { return _jobName; } set { _jobName = value; RaisePropertyChangedAuto(); + InvalidateRelayCommands(); } } @@ -74,8 +75,14 @@ namespace Tango.PPC.Jobs.Dialogs /// <param name="supportedColorSpaces">The supported color spaces</param> public JobCreationViewVM(List<SpoolType> spoolTypes, List<Rml> rmls) : base() { + JobName = "Unnamed"; SpoolTypes = spoolTypes; - Rmls = rmls; + Rmls = rmls.OrderBy(x => x.Name).ToList(); + } + + protected override bool CanOK() + { + return false == String.IsNullOrEmpty(JobName); } } } 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 differindex d0644c917..9b6cae8c0 100644 --- 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 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/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..1ccee4475 --- /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/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/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/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/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 85d608eee..78ce8f1a7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -25,6 +25,8 @@ namespace Tango.PPC.Jobs.Models #region Property + public bool PreventPropertyUpdate { get; set; } + protected Double _cyan; /// <summary> @@ -582,6 +584,7 @@ namespace Tango.PPC.Jobs.Models _displayedColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); Color = Colors.White; ColorSpace = ColorSpaces.RGB; + PreventPropertyUpdate = false; } #region Methods @@ -613,6 +616,8 @@ namespace Tango.PPC.Jobs.Models public void SetNewColor( BrushStopModel newBrushStop) { ColorSpace = newBrushStop.ColorSpace; + PreventPropertyUpdate = true; + Red = newBrushStop.Red; Green = newBrushStop.Green; Blue = newBrushStop.Blue; @@ -625,6 +630,8 @@ namespace Tango.PPC.Jobs.Models Yellow = newBrushStop.Yellow; Black = newBrushStop.Black; + PreventPropertyUpdate = false; + ColorCatalogsItem = newBrushStop.ColorCatalogsItem; Color = newBrushStop.Color; DisplayedColor = newBrushStop.DisplayedColor; @@ -640,11 +647,13 @@ namespace Tango.PPC.Jobs.Models BrushStop s = new BrushStop(); s.ColorSpace = list.FirstOrDefault(x => x.Space == colorSpace); - if (s.ColorSpace.Space == ColorSpaces.Volume) - { 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); @@ -656,9 +665,6 @@ namespace Tango.PPC.Jobs.Models s.L = this.L; s.A = this.A; s.B = this.B; - s.Red = this.Red; - s.Green = this.Green; - s.Blue = this.Blue; } else if (s.ColorSpace.Space == ColorSpaces.RGB) { @@ -681,6 +687,7 @@ namespace Tango.PPC.Jobs.Models public BrushStopModel Clone() { var cloned = (BrushStopModel)Activator.CreateInstance(typeof(BrushStopModel), SegmentModel); + cloned.PreventPropertyUpdate = true; foreach (var prop in typeof(BrushStopModel).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.SetMethod != null)) { @@ -689,9 +696,8 @@ namespace Tango.PPC.Jobs.Models prop.SetValue(cloned, prop.GetValue(this)); } } - cloned.SegmentModel = SegmentModel; - + cloned.PreventPropertyUpdate = false; return cloned; } @@ -715,38 +721,45 @@ namespace Tango.PPC.Jobs.Models private void OnCMYKChanged() { + if (PreventPropertyUpdate) + return; ColorSpace = ColorSpaces.CMYK; - Rgb rgb = GetRGBColor(); - _red = (int)rgb.R; - _green = (int)rgb.G; - _blue = (int)rgb.B; - RaisePropertyChanged("IsCMYKLiquidVolumesOutOfRange"); + RaisePropertyChanged(nameof(IsCMYKLiquidVolumesOutOfRange)); 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(); } @@ -768,12 +781,6 @@ namespace Tango.PPC.Jobs.Models Rgb rgb = new Rgb(lab.ToRgb()); return rgb; } - if(ColorSpace == ColorSpaces.CMYK) - { - Cmyk cmyk = new Cmyk(Cyan/100, Magenta/100, Yellow/100, Black/100); - Rgb rgb = new Rgb(cmyk.ToRgb()); - return rgb; - } if(ColorSpace == ColorSpaces.HSB) { Hsb hsb = new Hsb(Hue, Saturation / 100, Brightness / 100); @@ -791,8 +798,26 @@ namespace Tango.PPC.Jobs.Models if (ColorSpace == ColorSpaces.CMYK) { - Cmyk cmyk = new Cmyk(Cyan / 100, Magenta / 100, Yellow / 100, Black / 100); - hsb = new Hsb(cmyk.To<Hsb>()); + 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 = _converter.IsOutOfGamut(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml); + } + 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) { @@ -809,9 +834,9 @@ namespace Tango.PPC.Jobs.Models _hue = hsb.H; _saturation = hsb.S * 100; ; _brightness = hsb.B * 100; ; - RaisePropertyChanged("Hue"); - RaisePropertyChanged("Saturation"); - RaisePropertyChanged("Brightness"); + RaisePropertyChanged(nameof(Hue)); + RaisePropertyChanged(nameof(Saturation)); + RaisePropertyChanged(nameof(Brightness)); } } } @@ -820,13 +845,38 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace != ColorSpaces.RGB) { - Rgb rgb = GetRGBColor(); - _red = (int)rgb.R; - _green = (int)rgb.G; - _blue = (int)rgb.B; - RaisePropertyChanged("Red"); - RaisePropertyChanged("Green"); - RaisePropertyChanged("Blue"); + if (ColorSpace == ColorSpaces.CMYK) + { + 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 = _converter.IsOutOfGamut(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml); + } + 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)); } } @@ -837,8 +887,24 @@ namespace Tango.PPC.Jobs.Models Lab lab = null; if (ColorSpace == ColorSpaces.CMYK) { - Cmyk cmyk = new Cmyk(Cyan / 100, Magenta / 100, Yellow / 100, Black / 100); - lab = new Lab(cmyk.To<Lab>()); + 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 = _converter.IsOutOfGamut(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + } + finally + { + IsBusy = false; + } } else if (ColorSpace == ColorSpaces.HSB) { @@ -855,10 +921,11 @@ namespace Tango.PPC.Jobs.Models _l = lab.L; _a = lab.A; _b = lab.B; - RaisePropertyChanged("L"); - RaisePropertyChanged("A"); - RaisePropertyChanged("B"); + } + RaisePropertyChanged(nameof(L)); + RaisePropertyChanged(nameof(A)); + RaisePropertyChanged(nameof(B)); } } @@ -866,33 +933,35 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace != ColorSpaces.CMYK) { - Cmyk cmyk = null; - if (ColorSpace == ColorSpaces.LAB) + ColorSpaces colorSpace = ColorSpace; + if (ColorSpace == ColorSpaces.HSB) { - Lab lab = new Lab(L, A, B); - cmyk = new Cmyk(lab.To<Cmyk>()); + colorSpace = ColorSpaces.RGB; } - else if (ColorSpace == ColorSpaces.HSB) + BrushStop stop = CreateBrushStop(colorSpace); + try { - Hsb hsb = new Hsb(Hue, Saturation / 100, Brightness / 100); - cmyk = new Cmyk(hsb.To<Cmyk>()); + 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.Magenta).Volume; + IsOutOfGamut = false; + RaisePropertyChanged(nameof(Cyan)); + RaisePropertyChanged(nameof(Yellow)); + RaisePropertyChanged(nameof(Magenta)); + RaisePropertyChanged(nameof(Black)); + RaisePropertyChanged(nameof(IsCMYKLiquidVolumesOutOfRange)); } - else if(ColorSpace == ColorSpaces.RGB) + catch (Exception ex) { - Rgb rgb = new Rgb(Red, Green, Blue); - cmyk = new Cmyk(rgb.To<Cmyk>()); + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); } - if(cmyk != null) + finally { - _cyan = cmyk.C *100; - _yellow = cmyk.Y * 100; - _magenta = cmyk.M * 100; - _black = cmyk.K * 100; - RaisePropertyChanged("Cyan"); - RaisePropertyChanged("Yellow"); - RaisePropertyChanged("Magenta"); - RaisePropertyChanged("Black"); - OnBrushStopFieldValueChanged(); + IsBusy = false; } } } @@ -901,9 +970,6 @@ namespace Tango.PPC.Jobs.Models { RaisePropertyChanged(nameof(OffsetPercent)); RaisePropertyChanged(nameof(OffsetMeters)); - //RaisePropertyChanged(nameof(IsFirst)); - //RaisePropertyChanged(nameof(IsLast)); - //RaisePropertyChanged(nameof(IsMiddle)); } #endregion @@ -963,10 +1029,9 @@ namespace Tango.PPC.Jobs.Models public void OnBrushStopFieldValueChanged() { - InitColor(); IsBusy = true; - _volumeConversionTimer.ResetReplace(() => + _volumeConversionTimer.ResetReplace( () => { try { @@ -979,13 +1044,12 @@ namespace Tango.PPC.Jobs.Models { colorSpace = ColorSpaces.Volume; } - BrushStop stop = CreateBrushStop(colorSpace); Configuration configuration = SegmentModel.Job.Machine.Configuration; Rml rml = SegmentModel.Job.Rml; - RaisePropertyChanged("IsCMYKLiquidVolumesOutOfRange"); + RaisePropertyChanged(nameof(IsCMYKLiquidVolumesOutOfRange)); if ( ColorSpace == BL.Enumerations.ColorSpaces.CMYK) { if(IsCMYKLiquidVolumesOutOfRange) @@ -995,52 +1059,45 @@ namespace Tango.PPC.Jobs.Models } } - var output = _converter.Convert(stop, configuration, rml, false, false, false); - //IsOutOfGamut = output.OutOfGamut; + 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; - DisplayedColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + InitColor(); + DisplayedColor = 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); Lab lab = new Lab(output.SingleCoordinates.L, output.SingleCoordinates.A, output.SingleCoordinates.B); - //Rgb rgb = new Rgb(lab.ToRgb()); - if (rml.ColorConversionVersion < 4) - { - IsOutOfGamut = output.OutOfGamut; - } - else - { - IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - } - DisplayedColor = (true == IsOutOfGamut) ? Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue) : Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + Rgb rgb = new Rgb(lab.ToRgb()); + DisplayedColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + //TODO ASK ROY + // DisplayedColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) { - if (rml.ColorConversionVersion < 4) - { - IsOutOfGamut = output.OutOfGamut; - } - else - { - IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - } - DisplayedColor = (true == IsOutOfGamut) ? Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue) : Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + DisplayedColor = 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."); + DisplayedColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); } finally { IsBusy = false; } - }); } 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 index ef8d3f0fb..349b9049b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -13,7 +13,8 @@ namespace Tango.PPC.Jobs.Models { public class JobModel : ViewModel { - + private bool _preventChange; + #region Properties protected String _name; @@ -68,7 +69,8 @@ namespace Tango.PPC.Jobs.Models { if (Segments != null) { - return Segments.Sum(x => x.LengthWithFactor) + ((EnableInterSegment && IsAllSegmentsPerSpool) ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); + 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 { @@ -121,28 +123,28 @@ namespace Tango.PPC.Jobs.Models } } - protected Boolean _enableintersegment; + //protected Boolean _enableintersegment; - /// <summary> - /// Gets or sets the JobModel enable inter segment. - /// </summary> - public Boolean EnableInterSegment - { - get - { - return _enableintersegment; - } + ///// <summary> + ///// Gets or sets the JobModel enable inter segment. + ///// </summary> + //public Boolean EnableInterSegment + //{ + // get + // { + // return _enableintersegment; + // } - set - { - if (_enableintersegment != value) - { - _enableintersegment = value; - RaisePropertyChangedAuto(); + // set + // { + // if (_enableintersegment != value) + // { + // _enableintersegment = value; + // RaisePropertyChangedAuto(); - } - } - } + // } + // } + //} protected Double _intersegmentlength; @@ -186,10 +188,11 @@ namespace Tango.PPC.Jobs.Models _lastLength = GetLength(); var l = _lastLength * Math.Max(NumberOfUnits, 1); - if (EnableInterSegment && NumberOfUnits > 1) - { - l += ((NumberOfUnits - 1) * InterSegmentLength); - } + //TODO ASK ROY + //if (EnableInterSegment && NumberOfUnits > 1) + //{ + // l += ((NumberOfUnits - 1) * InterSegmentLength); + //} return l; } @@ -338,7 +341,7 @@ namespace Tango.PPC.Jobs.Models /// Gets or sets the JobModel segments. /// </summary> - public virtual SynchronizedObservableCollection<SegmentModel> Segments + public SynchronizedObservableCollection<SegmentModel> Segments { get { @@ -349,6 +352,7 @@ namespace Tango.PPC.Jobs.Models if (_segments != value) { _segments = value; + RaisePropertyChangedAuto(); //OnSegmentsChanged(value); } } @@ -358,7 +362,8 @@ namespace Tango.PPC.Jobs.Models { get { - if (EnableInterSegment && IsAllSegmentsPerSpool) + //if (EnableInterSegment && IsAllSegmentsPerSpool) + if( IsAllSegmentsPerSpool) { int max = Segments.Max(x => x.SegmentIndex); @@ -368,7 +373,7 @@ namespace Tango.PPC.Jobs.Models { effectiveSegments.Add(s); - if (s.SegmentIndex != max) + if (s.SegmentIndex != max && s.EnableInterSegment) { effectiveSegments.Add(CreateInterSegment(InterSegmentLength)); } @@ -383,14 +388,33 @@ namespace Tango.PPC.Jobs.Models } } + private bool _selectAllSegments; + + public bool SelectAllSegments + { + get { return _selectAllSegments; } + set + { + _selectAllSegments = value; + OnSelectAllChanged(); + RaisePropertyChangedAuto(); + } + } + + public List<SegmentModel> SegmentsToCopy { get; set; } + #endregion public JobModel(List<ColorSpace> list) { ColorSpacesList = list; - _segments = new SynchronizedObservableCollection<SegmentModel>(); + Segments = new SynchronizedObservableCollection<SegmentModel>(); + SegmentsToCopy = new List<SegmentModel>(); + Segments.CollectionChanged -= Segments_CollectionChanged; Segments.CollectionChanged += Segments_CollectionChanged; + SelectAllSegments = false; + InterSegmentLength = 5; } #region modifications @@ -457,20 +481,33 @@ namespace Tango.PPC.Jobs.Models /// </summary> private void Segment_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - if (e.PropertyName == nameof(Segment.Length)) + if (e.PropertyName == nameof(SegmentModel.Length)) { OnLengthChanged(); } - else if (e.PropertyName == nameof(Segment.SegmentIndex)) + else if (e.PropertyName == nameof(SegmentModel.SegmentIndex)) { 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("SelectAllSegments"); + } } /// <summary> /// Called when the <see cref="Length"/> property has been changed /// </summary> - protected virtual void OnLengthChanged() + public void OnLengthChanged() { if (_lastLength != GetLength()) { @@ -479,6 +516,63 @@ namespace Tango.PPC.Jobs.Models } } + private void OnSelectAllChanged() + { + if (Segments != null ) + { + _preventChange = true; + Segments.ToList().ForEach(x => x.IsSelected = SelectAllSegments); + _preventChange = false; + } + } + + #endregion + + #region collapsed mode actions + + public void CopySegments() + { + if (false == Segments.ToList().Any(x => x.IsSelected)) + return; + LogManager.Log("Copy selected segments."); + + foreach (var segment in Segments.Where(i => i.IsSelected).ToList()) + { + SegmentModel newSegmentModel = segment.Clone(); + newSegmentModel.SegmentIndex = segment.SegmentIndex + 1; + SegmentsToCopy.Add(newSegmentModel); + } + } + + public void PasteSegments() + { + if(SegmentsToCopy.Count == 0) + { + return; + } + SegmentsToCopy.ForEach(x => x.RaiseSegmentBrushChanged()); + + var selected = Segments.ToList().FindIndex(x => x.IsSelected); + if(selected != -1) + { + Segments.ToList().InsertRange(selected, SegmentsToCopy); + } + else + { + Segments.ToList().AddRange(SegmentsToCopy); + } + SegmentsToCopy.Clear(); + } + + public void InsertWhiteGapToSelectedSegments() + { + if (false == Segments.ToList().Any(x => x.IsSelected)) + return; + LogManager.Log("Copy selected segments."); + + Segments.Where(i => i.IsSelected).ToList().ForEach(y => y.EnableInterSegment = true); + } + #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 index 06f7e64b7..c7edecd41 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -13,6 +13,7 @@ using System.Collections.Specialized; using System.Reflection; using Tango.BL.Enumerations; using System.Diagnostics; +using Tango.Core.Commands; namespace Tango.PPC.Jobs.Models { @@ -96,9 +97,34 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChangedAuto(); } } - public double LengthWithFactor + protected Boolean _enableintersegment; + public Boolean EnableInterSegment { - get { return Job != null && !IsInterSegment ? (Length + Length * (Job.LengthPercentageFactor / 100)) : Length; } + get { return _enableintersegment; } + set + { + if (_enableintersegment != value) + { + _enableintersegment = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(LengthWithInterSegment)); + Job.OnLengthChanged(); + } + } + } + + 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; + } } protected SynchronizedObservableCollection<BrushStopModel> _brushstops; @@ -277,26 +303,47 @@ namespace Tango.PPC.Jobs.Models } } + private bool _isSelected; + + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; + RaisePropertyChangedAuto(); + } + } + + #endregion + + #region command + + public RelayCommand AddGapCommand { get; set; } + public RelayCommand DeleteGapCommand { get; set; } #endregion public SegmentModel(JobModel jobModel) { - BrushStops = new SynchronizedObservableCollection<BrushStopModel>(); - Length = 5; + InitnewSegment(); Job = jobModel; - LeftOffset = 0; - MiddleOffset = 50; - RightOffset = 100; - IsOffsetChanged = false; } public SegmentModel() { + InitnewSegment(); + } + + public void InitnewSegment() + { BrushStops = new SynchronizedObservableCollection<BrushStopModel>(); LeftOffset = 0; MiddleOffset = 50; RightOffset = 100; IsOffsetChanged = false; + Length = 5; + IsSelected = false; + _enableintersegment = false; + AddGapCommand = new RelayCommand(x => AddGap()); + DeleteGapCommand = new RelayCommand(x => DeleteGap()); } #region Public Methods @@ -360,6 +407,17 @@ namespace Tango.PPC.Jobs.Models 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> @@ -429,7 +487,8 @@ namespace Tango.PPC.Jobs.Models public void SetNewColor(BrushStopModel target, BrushStopModel source ) { target.SetNewColor(source); - if(target.IsFirstColorBrush) + target.IsOutOfGamut = source.IsOutOfGamut; + if (target.IsFirstColorBrush) { BrushStopModel first = BrushStops.Where(x => x.IsFirst).FirstOrDefault(); if(first != null) @@ -525,7 +584,8 @@ namespace Tango.PPC.Jobs.Models { BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); _lastLength = Length; - RaisePropertyChanged(nameof(LengthWithFactor)); + //RaisePropertyChanged(nameof(LengthWithFactor)); + RaisePropertyChanged(nameof(LengthWithInterSegment)); } } @@ -549,7 +609,15 @@ namespace Tango.PPC.Jobs.Models } } + private void AddGap() + { + EnableInterSegment = true; + } + private void DeleteGap() + { + EnableInterSegment = false; + } #endregion } 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 index 3f13caebc..d816fa42e 100644 --- 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 @@ -559,7 +559,7 @@ <Resource Include="Images\JobView\Exclamation_black.png" /> </ItemGroup> <ItemGroup> - <Resource Include="Images\JobView\Redo.png" /> + <Resource Include="Images\JobView\undo.png" /> </ItemGroup> <ItemGroup> <Resource Include="Images\JobView\AddNewSegment.png" /> @@ -573,10 +573,27 @@ <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> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/ColorSelectionToolViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/ColorSelectionToolViewVM.cs index 02c085121..e5fda5b6f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/ColorSelectionToolViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/ColorSelectionToolViewVM.cs @@ -153,8 +153,11 @@ namespace Tango.PPC.Jobs.ViewModels if (obj.IsEditingMode) { InitialBrushStop = obj.BrushStopForEdit; - SelectedBrushStop = new BrushStopModel(obj.SelectedSegment); + // InitialBrushStop.ConvertColorToRGB(); + // InitialBrushStop.InitColor(); + SelectedBrushStop = InitialBrushStop.Clone(); SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; + if(SelectedBrushStop.ColorSpace == BL.Enumerations.ColorSpaces.RGB) SelectedColorTab = ColorTab.RGB; else if (SelectedBrushStop.ColorSpace == BL.Enumerations.ColorSpaces.LAB) @@ -164,9 +167,6 @@ namespace Tango.PPC.Jobs.ViewModels else if (SelectedBrushStop.ColorSpace == BL.Enumerations.ColorSpaces.Catalog) SelectedColorTab = ColorTab.Catalogs; else SelectedColorTab = ColorTab.HSB; - - InitialBrushStop.InitColor(); - } else { 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 index fbe25a831..6b3e2af88 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -40,6 +40,7 @@ using Tango.Integration.Operation; using Tango.BL.Enumerations; using Tango.PPC.Common.Lubrication; using Tango.PPC.Jobs.Models; +using Tango.Core; namespace Tango.PPC.Jobs.ViewModels { @@ -239,6 +240,16 @@ namespace Tango.PPC.Jobs.ViewModels set { _btsrSpoolTension = value; RaisePropertyChangedAuto(); } } + private bool _isFullMode; + + public bool IsFullMode + { + get { return _isFullMode; } + set { _isFullMode = value; + RaisePropertyChangedAuto(); + } + } + #endregion #region Commands @@ -287,7 +298,7 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Gets or sets the twine catalog field tap command. /// </summary> - public RelayCommand<BrushStop> OpenCatalogCommand { get; set; } + //public RelayCommand<BrushStop> OpenCatalogCommand { get; set; } /// <summary> /// Gets or sets the increase decrease samples to dye command. @@ -349,6 +360,30 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public RelayCommand ExportEmbroideryCommand { get; set; } + public RelayCommand EditJobDetailsCommand { 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 @@ -430,8 +465,21 @@ namespace Tango.PPC.Jobs.ViewModels StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected) && CanStartJob()); RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); - OpenCatalogCommand = new RelayCommand<BrushStop>(OpenCatalog); + //OpenCatalogCommand = new RelayCommand<BrushStop>(OpenCatalog); ExportEmbroideryCommand = new RelayCommand(ExportEmbroidery); + + EditJobDetailsCommand = new RelayCommand(EditJobDetails); + JobModeSwitchCommand = new RelayCommand(JobModeSwitch); + InsertWhiteGapCommand = new RelayCommand(InsertWhiteGap); + ReverseCommand = new RelayCommand(Reverse); + DeleteSegmentCommand = new RelayCommand(DeleteSegment); + RepeateSegmentCommand = new RelayCommand(RepeateSegment); + PasteCommand = new RelayCommand(Paste); + CopyCommand = new RelayCommand(Copy); + UndoCommand = new RelayCommand(Undo); + RedoCommand = new RelayCommand(Redo); + + IsFullMode = true; } #endregion @@ -693,9 +741,7 @@ namespace Tango.PPC.Jobs.ViewModels await NotificationProvider.ShowError("An error occurred while trying to save the job."); } } - - /// <summary> /// Starts the job. /// </summary> @@ -747,6 +793,55 @@ namespace Tango.PPC.Jobs.ViewModels } } + private async void EditJobDetails() + { + try + { + LogManager.Log("Editing the job details."); + JobCreationViewVM vm = new JobCreationViewVM( + _spoolTypes.ToList(), + _rmls.ToList() + ); + 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; + bool updateVolumes = JobModel.Rml != vm.SelectedRML; + JobModel. Rml = vm.SelectedRML; + SelectedRML = vm.SelectedRML; + JobModel.Rml = vm.SelectedRML; + Job.SpoolType = vm.SelectedSpoolType; + JobModel.SpoolType = vm.SelectedSpoolType; + + if(updateVolumes) + { + NotificationProvider.SetGlobalBusyMessage("Updating job liquid volumes..."); + 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}."); + } + } + NotificationProvider.ReleaseGlobalBusyMessage(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error editing the job."); + } + } + #endregion #region RML Changed @@ -1121,25 +1216,25 @@ namespace Tango.PPC.Jobs.ViewModels /// Opens the twine catalog for the specified brush stop. /// </summary> /// <param name="stop">The stop.</param> - private async void OpenCatalog(BrushStop stop) - { - if (stop.ColorCatalog == null) - { - await NotificationProvider.ShowInfo("Please select a color catalog first."); - return; - } + //private async void OpenCatalog(BrushStop stop) + //{ + // if (stop.ColorCatalog == null) + // { + // await NotificationProvider.ShowInfo("Please select a color catalog first."); + // return; + // } - var catalogItem = await NavigationManager.NavigateForResult<JobsV2Module, TwineCatalogView, ColorCatalogsItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject() - { - SelectedItem = stop.ColorCatalogsItem, - Catalog = stop.ColorCatalog - }, true); + // var catalogItem = await NavigationManager.NavigateForResult<JobsV2Module, TwineCatalogView, ColorCatalogsItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject() + // { + // SelectedItem = stop.ColorCatalogsItem, + // Catalog = stop.ColorCatalog + // }, true); - if (catalogItem != null) - { - stop.ColorCatalogsItem = catalogItem; - } - } + // if (catalogItem != null) + // { + // stop.ColorCatalogsItem = catalogItem; + // } + //} private void ArrangeBrushStopsIndices(Segment segment) { @@ -1712,5 +1807,92 @@ namespace Tango.PPC.Jobs.ViewModels } #endregion + + #region collapsed mode + + private void JobModeSwitch() + { + IsFullMode = !IsFullMode; + } + + private void InsertWhiteGap() + { + JobModel.InsertWhiteGapToSelectedSegments(); + } + + private void Reverse() + { + if (false == JobModel.Segments.ToList().Any(x => x.IsSelected)) + return; + var firstIndex = JobModel.Segments.ToList().FindIndex(i => i.IsSelected == true); + var lastIndex = JobModel.Segments.ToList().FindLastIndex(i => i.IsSelected == true); + if(firstIndex < lastIndex) + { + //TODO function! + //var copy = JobModel.Segments.ToList(); + //copy.Reverse(firstIndex, (lastIndex - firstIndex + 1)); + //JobModel.Segments = new SynchronizedObservableCollection<SegmentModel>(copy); + //ArrangeSegmentsIndixes(); + } + } + + private async void DeleteSegment() + { + 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?")) + { + foreach( var segment in JobModel.Segments.Where(i => i.IsSelected).ToList()) + { + JobModel.Segments.Remove(segment); + } + 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 RepeateSegment() + { + + } + + private void Paste() + { + JobModel.PasteSegments(); + ArrangeSegmentsIndixes(); + } + + private void Copy() + { + JobModel.CopySegments(); + } + + private void Undo() + { + + } + + private void Redo() + { + + } + + #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 index 9de55ddb7..0a1ce7df7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -221,7 +221,7 @@ namespace Tango.PPC.Jobs.ViewModels /// Gets or sets the export job command. /// </summary> public RelayCommand ExportJobCommand { get; set; } - + #endregion #region Constructors @@ -248,7 +248,7 @@ namespace Tango.PPC.Jobs.ViewModels 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); @@ -417,31 +417,32 @@ namespace Tango.PPC.Jobs.ViewModels 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() ); + string selectedRmlGuid = (Settings.DefaultRmlGuid != null && _rmls.Select(x => x.Guid).Contains(Settings.DefaultRmlGuid)) ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; + string selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; ; 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; + } } - else - { - //vm.SelectedJobType = Settings.SupportedJobTypes.First(); - //vm.SelectedColorSpace = Settings.SupportedColorSpaces.First(); - } - //settings.LastJobType = vm.SelectedJobType; - //settings.LastJobColorSpace = vm.SelectedColorSpace; - - //if (vm.SelectedColorSpace == ColorSpaces.Catalog) - //{ - // settings.LastSelectedCatalogGuid = catalogVM.SelectedCatalog.Guid; - //} - - //settings.Save(); Job job = new Job(); job.LastUpdated = DateTime.UtcNow; @@ -458,9 +459,9 @@ namespace Tango.PPC.Jobs.ViewModels //job.ColorSpace = _colorSpaces.SingleOrDefault(x => x.Guid == job.ColorSpaceGuid); job.MachineGuid = MachineProvider.Machine.Guid; job.UserGuid = null; - job.RmlGuid = (Settings.DefaultRmlGuid != null && _rmls.Select(x => x.Guid).Contains(Settings.DefaultRmlGuid)) ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; + job.RmlGuid = selectedRmlGuid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + job.SpoolTypeGuid = selectedSpoolTypeGuid; if (Jobs.Count > 0) { @@ -471,7 +472,6 @@ namespace Tango.PPC.Jobs.ViewModels { var segment = job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); segment.BrushStops.Clear(); - } else { @@ -543,7 +543,7 @@ namespace Tango.PPC.Jobs.ViewModels await NotificationProvider.ShowError("An error occurred while trying to add a new job."); } } - + /// <summary> /// Deletes the specified jobs from db. /// </summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/ColorSelectionToolView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/ColorSelectionToolView.xaml index b680bdfc8..8a952032d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/ColorSelectionToolView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/ColorSelectionToolView.xaml @@ -211,7 +211,7 @@ <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" Width="576" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" H="{Binding SelectedBrushStop.Hue, Mode=TwoWay}" S="{Binding SelectedBrushStop.Saturation, Mode=TwoWay}" B="{Binding SelectedBrushStop.Brightness, Mode=TwoWay}" - SelectedColor="{Binding SelectedBrushStop.Color, Mode=TwoWay}" /> + /> </Grid> @@ -241,7 +241,7 @@ MinWidth="200" Width="576" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" L="{Binding SelectedBrushStop.L, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" A="{Binding SelectedBrushStop.A, Mode=TwoWay}" B="{ Binding SelectedBrushStop.B, Mode=TwoWay}" - SelectedColor="{Binding SelectedBrushStop.Color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + /> </Grid> @@ -265,10 +265,10 @@ <Grid Grid.Row="2" Margin="80 0 60 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" Width="576" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" - R="{Binding SelectedBrushStop.Red, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, TargetNullValue=255}" - G="{Binding SelectedBrushStop.Green, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, TargetNullValue=255}" - B="{ Binding SelectedBrushStop.Blue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, TargetNullValue=255}" - SelectedColor="{Binding SelectedBrushStop.Color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + 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> @@ -297,7 +297,7 @@ MinWidth="200" Width="576" 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}" - SelectedColor="{Binding SelectedBrushStop.Color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + /> </Grid> 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 index 415bbd70f..569d45115 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -15,6 +15,7 @@ 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"> @@ -24,6 +25,7 @@ <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"/> <BitmapImage x:Key="Image_Out_Of_Gamut" UriSource="../Images/JobView/error.png" /> @@ -48,19 +50,19 @@ <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}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + <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="10" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + <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="10" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Brightness, StringFormat=0.0}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> </Border> </StackPanel> </UniformGrid> @@ -95,25 +97,25 @@ <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}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Cyan, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="10 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}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <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}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <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}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Black, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> </UniformGrid> @@ -124,19 +126,19 @@ <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 L}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding L, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="10 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 A}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding A, 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 B}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding B, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> </UniformGrid> @@ -157,11 +159,6 @@ <DockPanel> <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Height="60"> - <touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ElementName=view,Path=DataContext.UndoLastColorCommand}" 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/Redo.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.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"/> @@ -287,9 +284,8 @@ </ContentControl> </Grid> - - <Grid Grid.Row="4" x:Name="add_new_segment" HorizontalAlignment="Stretch" Margin="0 30 0 0" > + <Grid Grid.Row="4" x:Name="add_new_segment" HorizontalAlignment="Stretch" Margin="0 30 0 0" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> @@ -297,15 +293,55 @@ </Grid.RowDefinitions> <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> - <touch:TouchButton Margin="0 20 0 0" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" DockPanel.Dock="Left" Command="{Binding DataContext.AddNewSegmentCommand, ElementName=listSegments}" 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> - + <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> + <!--<Border.BorderBrush> + <VisualBrush> + <VisualBrush.Visual> + <Rectangle Stroke="{StaticResource TangoDividerBrush}" Fill="{StaticResource TangoGrayBrush}" StrokeDashArray="5 5 5 5" StrokeThickness="1" Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}" /> + </VisualBrush.Visual> + </VisualBrush> + </Border.BorderBrush>--> + <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> + + <DockPanel Margin="0 20 0 0" Grid.Row="1"> + <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> + <touch:TouchButton DockPanel.Dock="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding DataContext.AddNewSegmentCommand, ElementName=listSegments}" 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 20 0 0" Grid.Row="2" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Bottom"/> </Grid> </Grid> @@ -313,6 +349,75 @@ </touch:TouchVirtualizedContentReplaceControl.Content> </touch:TouchVirtualizedContentReplaceControl> </DataTemplate> + + <DataTemplate x:Key="CollapsedSegment_Template" DataType="{x:Type entities:Segment}"> + <touch:TouchVirtualizedContentReplaceControl Margin="57 0 0 15" MinHeight="165" Disconnect="False"> + <touch:TouchVirtualizedContentReplaceControl.Content> + <DataTemplate> + <Grid> + <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="-70 0 -50 20"/> + <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 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> + </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="0 0 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> + </touch:TouchVirtualizedContentReplaceControl.Content> + </touch:TouchVirtualizedContentReplaceControl> + </DataTemplate> + </UserControl.Resources> <Grid Background="{StaticResource TangoMidBackgroundBrush}" SnapsToDevicePixels="False"> @@ -320,110 +425,190 @@ <RowDefinition Height="Auto"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> + <Border Grid.Row="0" x:Name="jobDetailsBorder" Background="{StaticResource TangoMidAccentBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoMidAccentBrush}" Width="780" Margin="0 20 0 15"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <Grid x:Name="job_details"> + <DockPanel Width="773" HorizontalAlignment="Left" Height="74" > + + <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 50 0" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + + <TextBlock MaxWidth="220" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" Foreground="{StaticResource TangoLightSelectedBrush}" Text="{Binding JobModel.Name,FallbackValue='Job Name'}"/> + + <StackPanel Margin="20 0 0 0" Grid.Column="1" VerticalAlignment="Center" MaxWidth="220" Orientation="Horizontal" HorizontalAlignment="Center"> + <TextBlock Text="Thread Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoLightSelectedBrush}"></TextBlock> + <TextBlock Margin="10 0 0 0" Foreground="{StaticResource TangoLightSelectedBrush}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontWeight="Medium"> + <Run Text="{Binding JobModel.Rml.Name}"></Run> + </TextBlock> + </StackPanel> + <StackPanel Margin="20 0 0 0" Grid.Column="2" VerticalAlignment="Center" MaxWidth="220" Orientation="Horizontal" HorizontalAlignment="Center"> + <TextBlock Text="Spool Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoLightSelectedBrush}"></TextBlock> + <TextBlock Text="{Binding JobModel.SpoolType.Name}" Margin="10 0 0 0" Foreground="{StaticResource TangoLightSelectedBrush}" 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 x:Name="Container" keyboard:KeyboardView.ContainerOffset="40" Grid.RowSpan="2"> - <touch:LightTouchScrollViewer x:Name="scrollViewer" Scrolling="scrollViewer_Scrolling"> - <StackPanel Margin="10 10 10 0"> - <StackPanel> - - <touch:TouchDropShadowBorder Margin="0 12 0 0" Padding="0 0 0 40"> - <Grid> - <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Style="{StaticResource Level1Container}"> - <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> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid > + <DockPanel VerticalAlignment="Top" x:Name="collapsedToolbar" Margin="0 0 20 0" HorizontalAlignment="Stretch" Height="64"> + <StackPanel DockPanel.Dock="Left" HorizontalAlignment="Left" Orientation="Horizontal" Margin="40 0 30 0" VerticalAlignment="Center"> + <touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding UndoCommand}" > + <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" VerticalAlignment="Center" HorizontalAlignment="Left" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding RedoCommand}" > + <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> + <Border DockPanel.Dock="Right" Width="613" Height="63" 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 Margin="0 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding InsertWhiteGapCommand}" > + <Border Padding="4" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/white_gap.png"/> + <TextBlock FontWeight="Medium" Margin="0 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">WG</TextBlock> </StackPanel> - <StackPanel Style="{StaticResource Level1Container}" > - <Border x:Name="borderDockFloat" Height="80" Margin="0 0 0 0" > - <DockPanel x:Name="dockEdit" LastChildFill="False" Height="50" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"> - <touch:TouchIconButton DockPanel.Dock="Right" Margin="0 0 0 0" Padding="0" Icon="PencilCircle" Height="50" Foreground="{StaticResource TangoMidAccentBrush}" Background="Transparent"></touch:TouchIconButton> - </DockPanel> - </Border> - - <ItemsControl x:Name="listSegments" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}"></ItemsControl> - - <StackPanel x:Name="stackOutput" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <!--<Image Source="../Images/JobView/output.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Output</TextBlock>--> - </StackPanel> + </Border> + </touch:TouchButton> + <touch:TouchButton Padding="4" Margin="0 0 0 0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ReverseCommand}" > + <Border BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <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> - </Grid> - </touch:TouchDropShadowBorder> - - <touch:TouchDropShadowBorder Padding="0 20 0 50" Margin="0 0 0 15"> - <StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <Image Source="../Images/JobView/job-summary.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> + </Border> + </touch:TouchButton> + <touch:TouchButton Padding="4" Margin="0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DeleteSegmentCommand}"> + <Border BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <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> + </Border> + </touch:TouchButton> + <touch:TouchButton Padding="4" Margin="0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding PasteCommand}" > + <Border BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <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> + </Border> + </touch:TouchButton> + <touch:TouchButton Padding="4" Margin="0" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CopyCommand}" > + <Border BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> + <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> + </Border> + </touch:TouchButton> + </UniformGrid> + </Border> + </DockPanel> + <Canvas Width="70" Height="70" Margin="0 0 40 0" HorizontalAlignment="Right" VerticalAlignment="Center"> + <touch:TouchButton HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding JobModeSwitchCommand}" Click="TouchButton_Click"> + <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> + <touch:TouchDropShadowBorder Margin="10 15 10 0" Grid.Row="1"> + <Grid> + <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> + </touch:TouchDropShadowBorder> + </Grid> + <Grid Grid.Row="1" x:Name="segmentsGrid" Grid.RowSpan="2" > + <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"> + <touch:LightTouchScrollViewer x:Name="scrollViewer" Scrolling="scrollViewer_Scrolling"> + <Grid> + <StackPanel x:Name="fullModeSegments" Style="{StaticResource Level1Container}" > - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> - <Grid> - <touch:TouchVirtualizedContentReplaceControl MinHeight="40"> - <DataTemplate> - <localControls:JobSummeryViewer JobModel="{Binding JobModel}" Height="40" DisplayMarkers="False" /> - </DataTemplate> - </touch:TouchVirtualizedContentReplaceControl> - </Grid> - - <DockPanel Margin="0 30 0 0" LastChildFill="False"> - - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> - <TextBlock> - <Run Text="Job length (m):"></Run> - <Run Text="{Binding JobModel.Length,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding 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" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> - <Run Text="Factor: +"></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> + <Border x:Name="borderDockFloat" Height="10" Margin="0 0 0 0" > + <DockPanel x:Name="dockEdit" LastChildFill="False" Height="10" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"/> + </Border> + <ItemsControl x:Name="listSegments" ItemsSource="{Binding SegmentsCollectionView}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <ContentControl Content="{Binding}"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate" Value="{StaticResource Segment_Template}"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsFullMode}" Value="false"> + <Setter Property="ContentTemplate" Value="{StaticResource CollapsedSegment_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> - </StackPanel> - </DockPanel> - </StackPanel> - </StackPanel> - </touch:TouchDropShadowBorder> + <StackPanel x:Name="stackOutput" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"/> - <StackPanel Visibility="Collapsed" HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Additional Tools</TextBlock> </StackPanel> - </StackPanel> - </StackPanel> - </touch:LightTouchScrollViewer> + </Grid> + </touch:LightTouchScrollViewer> + </touch:TouchDropShadowBorder> </Grid> - - <Border VerticalAlignment="Top" x:Name="borderEditDock" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="0 0 0 10"> - - </Border> + <Border VerticalAlignment="Top" x:Name="borderEditDock" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="0 0 0 10"/> </Grid> - <Grid Grid.Row="1"> + <Grid Grid.Row="2"> <Grid IsHitTestVisible="False"> <Grid.Background> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> @@ -435,41 +620,63 @@ </Grid> </Grid> - <dragAndDrop:DraggingSurface x:Name="DraggingSurface" /> - </Grid> - </touch:TouchLoadingPanel> + <touch:TouchDropShadowBorder Grid.Row="3" Margin="10 0 10 15" > + <touch:TouchExpander IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <touch:TouchExpander.Header> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/JobView/job-summary.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> + </StackPanel> + </touch:TouchExpander.Header> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <Grid> + <!--<touch:TouchVirtualizedContentReplaceControl MinHeight="40"> + <DataTemplate>--> + <localControls:JobSummeryViewer JobModel="{Binding JobModel}" Height="40" DisplayMarkers="False" /> + <!--</DataTemplate> + </touch:TouchVirtualizedContentReplaceControl>--> + </Grid> - <Border Padding="10" Background="{StaticResource TangoMidAccentBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoMidAccentBrush}" Width="773" Margin="0 22 0 22"> - <Border.Effect> - <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> - </Border.Effect> + <DockPanel Margin="0 30 0 0" LastChildFill="False"> - <Grid x:Name="job_details"> - <DockPanel Width="773" HorizontalAlignment="Left" Height="74" > - <touch:TouchIconButton Margin="0 0 30 0" Padding="10" DockPanel.Dock="Right" Icon="SquareEditOutline" Style="{StaticResource TangoFlatButton}" Foreground="{StaticResource TangoLightSelectedBrush}" VerticalAlignment="Center" HorizontalAlignment="Center"/> - <UniformGrid DockPanel.Dock="Left" Columns="3" Rows="1"> - <TextBlock MaxWidth="220" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" FontWeight="SemiBold" Foreground="{StaticResource TangoLightSelectedBrush}" Text="{Binding JobModel.Name,FallbackValue='Job Name'}"/> - <!--<TextBlock Margin="20 0 0 5" VerticalAlignment="Bottom" Foreground="{StaticResource TangoLightSelectedBrush}"> - <Run>(</Run><Run Text="{Binding Job.JobType,FallbackValue=Embroidery}"></Run><Run>)</Run> - </TextBlock>--> - <StackPanel Margin="20 0 0 0" VerticalAlignment="Center" MaxWidth="220" Orientation="Horizontal"> - <TextBlock Text="Thread Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoLightSelectedBrush}"></TextBlock> - <TextBlock Margin="10 0 0 0" Foreground="{StaticResource TangoLightSelectedBrush}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontWeight="Medium"> - <Run Text="{Binding JobModel.Rml.Name}"></Run> - </TextBlock> - </StackPanel> - <StackPanel Margin="20 0 0 0" VerticalAlignment="Center" MaxWidth="220" Orientation="Horizontal"> - <TextBlock Text="Spool Type:" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoLightSelectedBrush}"></TextBlock> - <TextBlock Text="{Binding JobModel.SpoolType.Name}" Margin="10 0 0 0" Foreground="{StaticResource TangoLightSelectedBrush}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontWeight="Medium"/> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> + <TextBlock> + <Run Text="Job length (m):"></Run> + <Run Text="{Binding JobModel.Length,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding 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" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> + <Run Text="Factor: +"></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> + + <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> + </StackPanel> + </DockPanel> </StackPanel> - </UniformGrid> - </DockPanel> - <!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="57" Margin="0 0 30 -45"> - <touch:TouchIconButton Margin="0 0 30 0" Padding="17" Style="{StaticResource TangoRoundTouchIconButton}" Icon="EllipsisVSolid" /> - <touch:TouchIconButton Command="{Binding RemoveJobCommand}" Margin="0 0 30 0" Padding="17" Style="{StaticResource TangoRoundTouchIconButton}" Icon="TrashAltRegular" /> - <touch:TouchIconButton Command="{Binding SaveJobCommand}" Padding="18" Style="{StaticResource TangoRoundTouchIconButton}" Icon="SaveRegular" /> - </StackPanel>--> + </touch:TouchExpander> + </touch:TouchDropShadowBorder> + + <!--<dragAndDrop:DraggingSurface x:Name="DraggingSurface" />--> </Grid> - </Border> + </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 index 710f92e40..4c85b96c6 100644 --- 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 @@ -73,7 +73,7 @@ namespace Tango.PPC.Jobs.Views private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { - if (_vm.Job != null && _vm.Job.Segments != null && _vm.Job.Segments.Count > 3) + if (_vm.JobModel != null && _vm.JobModel.Segments != null && _vm.JobModel.Segments.Count > 3) { var position = scrollViewer.GetElementPosition(listSegments); var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); @@ -131,5 +131,10 @@ namespace Tango.PPC.Jobs.Views FloatEditing(); scrollViewer.ScrollToTop(); } + + private void TouchButton_Click(object sender, RoutedEventArgs e) + { + ScrollToTop(); + } } } 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 189454b9f..c33e90e76 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -16,6 +16,7 @@ <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/Controls/TouchNativeListBox.xaml" /> <!--PPC--> |
