diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-02-20 16:45:00 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-02-20 16:45:00 +0200 |
| commit | 6c208c90bc45aff4a7fa214356a42fe7757c5e6f (patch) | |
| tree | 0d77bc6a0ecfbb53cf42c5462ee19212197ee1bd /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer | |
| parent | b0823127f152fe97a6e8fce29e427c7f3db9cf5a (diff) | |
| parent | 1a573aaa346ec4b8bd58a0e35ab9df571a09b855 (diff) | |
| download | Tango-6c208c90bc45aff4a7fa214356a42fe7757c5e6f.tar.gz Tango-6c208c90bc45aff4a7fa214356a42fe7757c5e6f.zip | |
MERGE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
55 files changed, 4939 insertions, 54 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopCMYKToColorConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopCMYKToColorConverter.cs new file mode 100644 index 000000000..5bc163b18 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopCMYKToColorConverter.cs @@ -0,0 +1,53 @@ +using ColorMine.ColorSpaces; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopCMYKToColorConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Cmyk cmyk = new Cmyk(); + + cmyk.C = System.Convert.ToDouble(values[0]) / 100d; + cmyk.M = System.Convert.ToDouble(values[1]) / 100d; + cmyk.Y = System.Convert.ToDouble(values[2]) / 100d; + cmyk.K = System.Convert.ToDouble(values[3]) / 100d; + + IRgb rgb = cmyk.ToRgb(); + + return Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + try + { + Color color = (Color)value; + Rgb rgb = new Rgb(color.R, color.G, color.B); + Cmyk cmyk = rgb.To<Cmyk>(); + + return new object[] { cmyk.C * 100, cmyk.M * 100, cmyk.Y * 100, cmyk.K * 100 }; + } + catch + { + return null; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopLabToColorConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopLabToColorConverter.cs new file mode 100644 index 000000000..f3dc07d3e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopLabToColorConverter.cs @@ -0,0 +1,52 @@ +using ColorMine.ColorSpaces; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopLabToColorConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Lab lab = new Lab(); + + lab.L = System.Convert.ToDouble(values[0]); + lab.A = System.Convert.ToDouble(values[1]); + lab.B = System.Convert.ToDouble(values[2]); + + IRgb rgb = lab.ToRgb(); + + return Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + try + { + Color color = (Color)value; + Rgb rgb = new Rgb(color.R, color.G, color.B); + Lab cmyk = rgb.To<Lab>(); + + return new object[] { cmyk.L, cmyk.A, cmyk.B }; + } + catch + { + return null; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToColorConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToColorConverter.cs new file mode 100644 index 000000000..33cd8cc78 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToColorConverter.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopToColorConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + double r = System.Convert.ToDouble(values[0]); + double g = System.Convert.ToDouble(values[1]); + double b = System.Convert.ToDouble(values[2]); + + return Color.FromRgb((byte)r, (byte)g, (byte)b); + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + try + { + Color color = (Color)value; + return new object[] { color.R, color.G, color.B }; + } + catch + { + return null; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs new file mode 100644 index 000000000..96c44a5a0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetLimitConverter.cs @@ -0,0 +1,54 @@ +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.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopToOffsetLimitConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + BrushStop stop = values[0] as BrushStop; + Segment segment = values[1] as Segment; + String sign = parameter.ToString(); + + if (stop != null && segment != null) + { + + if (stop.IsLast) + { + return 100d; + } + else if (stop.IsFirst) + { + return 0d; + } + else + { + return sign == "min" ? 0 : 100d; + } + } + else + { + return 100d; + } + } + catch + { + return 100d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs new file mode 100644 index 000000000..d78ef0c8e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs @@ -0,0 +1,52 @@ +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.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class BrushStopToOffsetValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + BrushStop stop = values[0] as BrushStop; + Segment segment = values[1] as Segment; + + if (stop != null && segment != null) + { + if (stop.IsLast) + { + return 100d; + } + else if (stop.IsFirst) + { + return 0d; + } + else + { + return stop.OffsetPercent; + } + } + else + { + return 0d; + } + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/InkVolumeToLiquidRmlFactor.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/InkVolumeToLiquidRmlFactor.cs new file mode 100644 index 000000000..3b675d23e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/InkVolumeToLiquidRmlFactor.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; +using static Tango.Integration.Observables.BrushStop; + +namespace Tango.MachineStudio.Developer.Converters +{ + //public class InkVolumeToLiquidRmlFactor : IMultiValueConverter + //{ + // public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + // { + // InkVolume inkVolume = values[0] as InkVolume; + // Rml selectedRml = values[1] as Rml; + + // if (inkVolume != null && selectedRml != null) + // { + // return inkVolume.GetLiquidMaxNanoliterPerCentimeter().ToString(); + // } + + // return String.Empty; + // } + + // public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + // { + // throw new NotImplementedException(); + // } + //} +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs new file mode 100644 index 000000000..9865b26f8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.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.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class JobProgressToPositionConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Job job = values[0] as Job; + + if (job != null) + { + double progress = System.Convert.ToDouble(values[1]); + double parentElementWidth = System.Convert.ToDouble(values[2]); + + return (progress / job.Length) * parentElementWidth; + } + else + { + return 0d; + } + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs new file mode 100644 index 000000000..ac6e53be8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.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; +using System.Windows.Controls; +using System.Windows.Data; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class JobToColumnDefinitionsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Job job = value as Job; + + List<ColumnDefinition> columns = new List<ColumnDefinition>(); + + double totalLength = job.Segments.Sum(x => x.Length); + + foreach (var segment in job.Segments) + { + columns.Add(new ColumnDefinition() { Width = new GridLength(segment.Length / totalLength, GridUnitType.Star) }); + } + + return columns; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs new file mode 100644 index 000000000..15bfd6add --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class ObjectsNotEqualToBooleanConveter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return (values[0] != values[1]); + } + catch + { + return true; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs new file mode 100644 index 000000000..292de5cb4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class OneToPercentConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) * 100d; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) / 100d; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs new file mode 100644 index 000000000..b632d9d12 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs @@ -0,0 +1,53 @@ +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.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class SegmentLengthToWidthConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Length == 4) + { + Job job = values[0] as Job; + + if (job != null && values[1] is double) + { + double jobLength = System.Convert.ToDouble(values[1]); + double elementWidth = System.Convert.ToDouble(values[2]); + double segmentLength = System.Convert.ToDouble(values[3]); + double totalLength = job.Length; + + return (segmentLength / totalLength) * elementWidth; + } + else + { + return 0d; + } + } + else + { + return 0d; + } + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs new file mode 100644 index 000000000..1ac498070 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs @@ -0,0 +1,48 @@ +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 System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class SegmentToBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = value as Segment; + + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0,0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + return brush; + } + catch + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs new file mode 100644 index 000000000..41c1dd4df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs @@ -0,0 +1,53 @@ +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 System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class SegmentToBrushConverterMulti : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = values[0] as Segment; + + if (segment != null) + { + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0, 0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + return brush; + } + + return null; + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs new file mode 100644 index 000000000..f28a0b594 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class SegmentToGradientStopsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = value as Segment; + + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + return stops; + } + catch + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverterMulti.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverterMulti.cs new file mode 100644 index 000000000..c50fbb06c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverterMulti.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class SegmentToGradientStopsConverterMulti : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = values[0] as Segment; + + if (segment != null) + { + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + return stops; + } + + return null; + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index c3d351468..6cdda4bc8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -5,42 +5,50 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; -using Tango.DAL.Observables; +using Tango.Integration.Observables; using Tango.MachineStudio.Common; using Tango.MachineStudio.Developer.Views; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Developer { - public class DeveloperModule : IStudioModule + /// <summary> + /// Represents the Machine Studio developer module. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.StudioModuleBase" /> + public class DeveloperModule : StudioModuleBase { - private bool _isInitialized; + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name => "Developer"; - public string Name => "Developer"; + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description => "Research and development, manage RML, STRIP and Process."; - public string Description => "Research and development, manage RML, STRIP and Process."; + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image => ResourceHelper.GetImageFromResources("Images/developer.jpg"); - public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/developer.jpg"); + /// <summary> + /// Gets the module entry point view. + /// </summary> + public override FrameworkElement MainView => new MainView(); - public FrameworkElement MainView => new MainView(); + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission => Permissions.RunDeveloperModule; - public bool IsInitialized => _isInitialized; - - public Permissions Permission => Permissions.RunDeveloperModule; - - public void Dispose() - { - throw new NotImplementedException(); - } - - public void Initialize() + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() { - if (!_isInitialized) - { - //Initialize.. - - _isInitialized = true; - } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/White-Background.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/White-Background.jpg Binary files differnew file mode 100644 index 000000000..3810e060f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/White-Background.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg Binary files differnew file mode 100644 index 000000000..7ed5c3eb2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/calendar.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/calendar.png Binary files differnew file mode 100644 index 000000000..763783514 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/calendar.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/camera.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/camera.png Binary files differnew file mode 100644 index 000000000..526573632 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/camera.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png Binary files differnew file mode 100644 index 000000000..b1c58876f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png Binary files differnew file mode 100644 index 000000000..fca9f226e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/description.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/description.png Binary files differnew file mode 100644 index 000000000..d6e3d76ea --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/description.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/graphs.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/graphs.png Binary files differnew file mode 100644 index 000000000..6a211693d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/graphs.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/inter-segment.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/inter-segment.png Binary files differnew file mode 100644 index 000000000..e7c25faa2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/inter-segment.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/line_graph.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/line_graph.png Binary files differnew file mode 100644 index 000000000..7e21f4e97 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/line_graph.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/lubrication.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/lubrication.png Binary files differnew file mode 100644 index 000000000..bba463b31 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/lubrication.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/machine-trans.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/machine-trans.png Binary files differnew file mode 100644 index 000000000..a7cf65852 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/machine-trans.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/name.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/name.png Binary files differnew file mode 100644 index 000000000..a25bded5c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/name.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/no-signal.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/no-signal.jpg Binary files differnew file mode 100644 index 000000000..e8b1313c9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/no-signal.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/rgb.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/rgb.png Binary files differnew file mode 100644 index 000000000..42f69513b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/rgb.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png Binary files differnew file mode 100644 index 000000000..173e4c204 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png Binary files differnew file mode 100644 index 000000000..016666122 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png Binary files differnew file mode 100644 index 000000000..d0f85b83f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/tape.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/tape.png Binary files differnew file mode 100644 index 000000000..8a4739b23 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/tape.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png Binary files differnew file mode 100644 index 000000000..9c29dc438 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/wind.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/wind.png Binary files differnew file mode 100644 index 000000000..23d2e0035 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/wind.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs new file mode 100644 index 000000000..03e022380 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.MachineStudio.Common.Navigation; +using Tango.MachineStudio.Developer.Views; + +namespace Tango.MachineStudio.Developer.Navigation +{ + public class DeveloperNavigationManager + { + public void NavigateTo(DeveloperNavigationView view) + { + LogManager.Log(String.Format("Navigating to view {0}...", view.ToString())); + MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationView.cs new file mode 100644 index 000000000..6d1c6669e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationView.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Developer.Navigation +{ + public enum DeveloperNavigationView + { + MachineJobSelectionView, + JobView, + RunningJobView + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml new file mode 100644 index 000000000..a44a8191c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml @@ -0,0 +1,126 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Resources"> + + <FontFamily x:Key="FontName">Segoe UI</FontFamily> + <FontFamily x:Key="NotesFont">Lucida Console</FontFamily> + + <sys:Double x:Key="ExtraExtraLargeFontSize">28</sys:Double> + <sys:Double x:Key="ExtraLargeFontSize">26</sys:Double> + <sys:Double x:Key="LargeFontSize">20</sys:Double> + <sys:Double x:Key="MediumFontSize">16</sys:Double> + <sys:Double x:Key="SmallFontSize">14</sys:Double> + <sys:Double x:Key="MiniFontSize">12</sys:Double> + <sys:Double x:Key="TinyFontSize">9</sys:Double> + + <!--Colors--> + <Color x:Key="borderColor">Silver</Color> + <Color x:Key="graphGridLinesColor">#FFE9E9E9</Color> + <Color x:Key="graphsMarkerColor">Gray</Color> + <Color x:Key="materialColor">#03A9F4</Color> + + + <!--Brushes--> + <SolidColorBrush x:Key="borderBrush" Color="{StaticResource borderColor}"></SolidColorBrush> + <SolidColorBrush x:Key="graphGridLinesBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> + <SolidColorBrush x:Key="BlackBrush" Color="#545454"></SolidColorBrush> + + <SolidColorBrush x:Key="graphGridLinesLightBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> + <SolidColorBrush x:Key="graphGridLinesDarkBrush" Color="#FF2E2E2E"></SolidColorBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundLight"> + <GradientStop Color="White"/> + <GradientStop Color="#FFE9E9E9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundDark"> + <GradientStop Color="Black"/> + <GradientStop Color="#FF333333" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackground"> + <GradientStop Color="White"/> + <GradientStop Color="#FFE9E9E9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLabelBackground" Opacity="0.7"> + <GradientStop Color="White"/> + <GradientStop Color="#FFD9D9D9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLegendBackground" Opacity="0.7"> + <GradientStop Color="#FFE9E9E9"/> + <GradientStop Color="#FFBDBDBD" Offset="1"/> + </LinearGradientBrush> + + <SolidColorBrush Color="#FFF1F1F1" x:Key="topBarBackgroundBrush"></SolidColorBrush> + + <!--Navigation Link Button--> + <Style x:Key="LinkButton" TargetType="Button"> + <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <TextBlock FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"> + <ContentPresenter /></TextBlock> + </ControlTemplate> + </Setter.Value> + </Setter> + <Setter Property="Foreground" Value="{StaticResource BlackBrush}" /> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + <EventTrigger RoutedEvent="TouchUp"> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Foreground.Color" Duration="0" To="{StaticResource BlackColor}"></ColorAnimation> + </Storyboard> + </BeginStoryboard> + </EventTrigger> + </Style.Triggers> + </Style> + <!--Navigation Link Button--> + + + <!--Graph Label--> + <Style x:Key="graphLabel" TargetType="Label"> + <Style.Setters> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <Setter Property="Margin" Value="-1 -1 0 0"></Setter> + <Setter Property="HorizontalAlignment" Value="Left"></Setter> + <Setter Property="VerticalAlignment" Value="Top"></Setter> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Border Width="Auto" Padding="0 0 20 0" Height="25" BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1" CornerRadius="0 0 30 0" Background="{StaticResource graphLabelBackground}" > + <TextBlock Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TinyFontSize}" Text="{Binding}"></TextBlock> + </Border> + </DataTemplate> + </Setter.Value> + </Setter> + </Style.Setters> + </Style> + <!--Graph Label--> + + + <!--Graph Ticks Template--> + <DataTemplate x:Key="graphTicksTemplate"> + <Ellipse Width="3" Height="3" Margin="0 0 0 0" Fill="{StaticResource AccentColorBrush}"></Ellipse> + </DataTemplate> + <!--Graph Ticks Template--> + + <DataTemplate x:Key="graphTooltipTemplate"> + <Border CornerRadius="5" BorderThickness="1" BorderBrush="White" Padding="8" MinWidth="50" Margin="20 0 20 0"> + <Border.Background> + <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush> + </Border.Background> + <TextBlock Foreground="White" FontSize="10" HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding StringFormat='0.000'}"></TextBlock> + </Border> + </DataTemplate> +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 44b50b443..364b8573a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -31,8 +31,61 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="DeepEqual, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\DeepEqual.1.6.0.0\lib\net40\DeepEqual.dll</HintPath> + </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.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.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.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="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> + </Reference> <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.PlatformServices, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath> + </Reference> + <Reference Include="System.Windows" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> @@ -47,25 +100,62 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Converters\BrushStopLabToColorConverter.cs" /> + <Compile Include="Converters\BrushStopCMYKToColorConverter.cs" /> + <Compile Include="Converters\BrushStopToColorConverter.cs" /> + <Compile Include="Converters\BrushStopToOffsetLimitConverter.cs" /> + <Compile Include="Converters\BrushStopToOffsetValueConverter.cs" /> + <Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" /> + <Compile Include="Converters\JobProgressToPositionConverter.cs" /> + <Compile Include="Converters\JobToColumnDefinitionsConverter.cs" /> + <Compile Include="Converters\ObjectsNotEqualToBooleanConveter.cs" /> + <Compile Include="Converters\OneToPercentConverter.cs" /> + <Compile Include="Converters\SegmentLengthToWidthConverter.cs" /> + <Compile Include="Converters\SegmentToBrushConverter.cs" /> + <Compile Include="Converters\SegmentToBrushConverterMulti.cs" /> + <Compile Include="Converters\SegmentToGradientStopsConverterMulti.cs" /> + <Compile Include="Converters\SegmentToGradientStopsConverter.cs" /> <Compile Include="DeveloperModule.cs" /> + <Compile Include="Navigation\DeveloperNavigationManager.cs" /> + <Compile Include="Navigation\DeveloperNavigationView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> - <Page Include="UserControl1.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> + <Compile Include="Views\IMainView.cs" /> + <Compile Include="Views\JobView.xaml.cs"> + <DependentUpon>JobView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MachineJobSelectionView.xaml.cs"> + <DependentUpon>MachineJobSelectionView.xaml</DependentUpon> + </Compile> <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="UserControl1.xaml.cs"> - <DependentUpon>UserControl1.xaml</DependentUpon> - <SubType>Code</SubType> + <Compile Include="Views\RunningJobView.xaml.cs"> + <DependentUpon>RunningJobView.xaml</DependentUpon> </Compile> + <Page Include="Resources\GraphEx.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\JobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MachineJobSelectionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\RunningJobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -86,32 +176,142 @@ <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="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> + <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> + <Name>RealTimeGraphEx</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.ColorPicker\Tango.ColorPicker.csproj"> + <Project>{a2f5af44-29ff-45d6-9d25-ecda5cce88b5}</Project> + <Name>Tango.ColorPicker</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> - <ProjectReference Include="..\..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> - <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> - <Name>Tango.DAL.Observables</Name> + <ProjectReference Include="..\..\..\Tango.DAL.Remote\Tango.DAL.Remote.csproj"> + <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> + <Name>Tango.DAL.Remote</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</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.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.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Video\Tango.Video.csproj"> + <Project>{9652f972-2bd1-4283-99cb-fc6240434c17}</Project> + <Name>Tango.Video</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj"> + <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> + <Name>Tango.MachineStudio.DB</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.MachineDesigner\Tango.MachineStudio.MachineDesigner.csproj"> + <Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project> + <Name>Tango.MachineStudio.MachineDesigner</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.Technician\Tango.MachineStudio.Technician.csproj"> + <Project>{5d39c1e1-3ecd-4634-bd1b-2bcf71c54a15}</Project> + <Name>Tango.MachineStudio.Technician</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\rgb.png" /> </ItemGroup> - <ItemGroup /> <ItemGroup> <Resource Include="Images\developer.jpg" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\description.png" /> + <Resource Include="Images\inter-segment.png" /> + <Resource Include="Images\lubrication.png" /> + <Resource Include="Images\name.png" /> + <Resource Include="Images\wind.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\calendar.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine-trans.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\graphs.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\line_graph.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\no-signal.jpg" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\camera.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\video-frame.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\segment.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\segment-single.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ruler.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\color-palette.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\colorspace.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\White-Background.jpg" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\tape.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\black-screen.jpg" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Controls\" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/UserControl1.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/UserControl1.xaml deleted file mode 100644 index 95416b906..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/UserControl1.xaml +++ /dev/null @@ -1,12 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Developer.UserControl1" - 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.MachineStudio.Developer" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - <Grid> - - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs new file mode 100644 index 000000000..c5ed7d385 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -0,0 +1,36 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Developer.Navigation; +using Tango.MachineStudio.Developer.ViewModels; +using Tango.MachineStudio.Developer.Views; + +namespace Tango.MachineStudio.Developer +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + SimpleIoc.Default.Register<IMainView>(() => MainView.Instance); + SimpleIoc.Default.Register<MainViewVM>(); + SimpleIoc.Default.Register<DeveloperNavigationManager, DeveloperNavigationManager>(); + } + + public static MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MainViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..cf66efbd6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -0,0 +1,1567 @@ +using GalaSoft.MvvmLight.Ioc; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Core.Commands; +using Tango.Integration.Observables; +using Tango.Integration.Operators; +using Tango.Integration.Services; +using Tango.Logging; +using Tango.MachineStudio.Common.Authentication; +using Tango.MachineStudio.Common.Controls; +using Tango.MachineStudio.Common.Diagnostics; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common.Video; +using Tango.MachineStudio.Developer.Navigation; +using Tango.MachineStudio.Developer.Views; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Transport; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + /// <summary> + /// Represents the developer module main view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public class MainViewVM : ViewModel<IMainView>, IShutdownRequestBlocker, IShutdownListener + { + private static object _syncLock = new object(); + + private INotificationProvider _notification; + private TimeSpan _runningJobEstimatedDuration; + private JobHandler _jobHandler; + private DeveloperNavigationManager _navigation; + private bool _blockInvalidateCommands; + private IAuthenticationProvider _authentication; + private ObservablesContext _machineDbContext; + private ObservablesContext _activeJobDbContext; + + #region Properties + + private ObservableCollection<Machine> _machines; + /// <summary> + /// Gets or sets the machines. + /// </summary> + public ObservableCollection<Machine> Machines + { + get { return _machines; } + set { _machines = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<ColorSpace> _colorSpaces; + /// <summary> + /// Gets or sets the color spaces. + /// </summary> + public ObservableCollection<ColorSpace> ColorSpaces + { + get { return _colorSpaces; } + set { _colorSpaces = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<Rml> _rmls; + /// <summary> + /// Gets or sets the RMLS. + /// </summary> + public ObservableCollection<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<WindingMethod> _windingMethods; + /// <summary> + /// Gets or sets the winding methods. + /// </summary> + public ObservableCollection<WindingMethod> WindingMethods + { + get { return _windingMethods; } + set { _windingMethods = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the application manager. + /// </summary> + public IStudioApplicationManager ApplicationManager { get; set; } + + /// <summary> + /// Gets or sets the video capture provider. + /// </summary> + public IVideoCaptureProvider VideoCaptureProvider { get; set; } + + protected Machine _selectedMachine; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + public Machine SelectedMachine + { + get { return _selectedMachine; } + set + { + _selectedMachine = value; + OnSelectedMachineChanged(); + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + + if (_selectedMachine != null) + { + _selectedMachine.Saved -= SelectedMachine_Saved; + _selectedMachine.Saved += SelectedMachine_Saved; + } + } + } + + private List<LiquidTypesRml> _liquidTypesRmls; + /// <summary> + /// Gets or sets the liquid types RMLS. + /// </summary> + public List<LiquidTypesRml> LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ProcessParametersTablesGroup _rmlProcessParametersTablesGroup; + /// <summary> + /// Gets or sets the RML process parameters table group (cloned). + /// </summary> + public ProcessParametersTablesGroup RmlProcessParametersTableGroup + { + get { return _rmlProcessParametersTablesGroup; } + set + { _rmlProcessParametersTablesGroup = value; RaisePropertyChangedAuto(); OnProcessParametersTableGroupChanged(); } + } + + private ObservableCollection<ProcessParametersTablesGroup> _groupsHistory; + /// <summary> + /// Gets or sets the RML process parameters groups history. + /// </summary> + public ObservableCollection<ProcessParametersTablesGroup> GroupsHistory + { + get { return _groupsHistory; } + set { _groupsHistory = value; RaisePropertyChangedAuto(); } + } + + private ProcessParametersTablesGroup _selectedGroupHistory; + /// <summary> + /// Gets or sets the selected process parameters tables group history. + /// </summary> + public ProcessParametersTablesGroup SelectedGroupHistory + { + get { return _selectedGroupHistory; } + set { _selectedGroupHistory = value; RaisePropertyChangedAuto(); OnSelectedGroupHistoryChanged(); } + } + + private ProcessParametersTable _selectedProcessParametersTable; + /// <summary> + /// Gets or sets the selected process parameters table. + /// </summary> + public ProcessParametersTable SelectedProcessParametersTable + { + get { return _selectedProcessParametersTable; } + set { _selectedProcessParametersTable = value; RaisePropertyChangedAuto(); OnSelectedParametersTableChanged(); } + } + + private Job _activeJob; + /// <summary> + /// Gets or sets the selected machine job. + /// </summary> + public Job ActiveJob + { + get { return _activeJob; } + set + { + _activeJob = value; + RaisePropertyChangedAuto(); + OnActiveJobChanged(); + } + } + + private Job _selectedMachineJob; + /// <summary> + /// Gets or sets the selected machine job. + /// </summary> + public Job SelectedMachineJob + { + get { return _selectedMachineJob; } + set { _selectedMachineJob = 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 Segment _selectedSegment; + /// <summary> + /// Gets or sets the job selected segment. + /// </summary> + public Segment SelectedSegment + { + get { return _selectedSegment; } + set { _selectedSegment = value; RaisePropertyChangedAuto(); OnSelectedSegmentChanged(); } + } + + private ObservableCollection<Segment> _selectedSegments; + /// <summary> + /// Gets or sets the selected segments. + /// </summary> + public ObservableCollection<Segment> SelectedSegments + { + get { return _selectedSegments; } + set { _selectedSegments = value; RaisePropertyChangedAuto(); } + } + + private BrushStop _selectedBrushStop; + /// <summary> + /// Gets or sets the selected segment selected brush stop. + /// </summary> + public BrushStop SelectedBrushStop + { + get { return _selectedBrushStop; } + set { _selectedBrushStop = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<BrushStop> _selectedBrushStops; + /// <summary> + /// Gets or sets the selected brush stops. + /// </summary> + public ObservableCollection<BrushStop> SelectedBrushStops + { + get { return _selectedBrushStops; } + set { _selectedBrushStops = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + /// <summary> + /// Gets or sets the selected RML. + /// </summary> + public Rml SelectedRML + { + get { return _selectedRML; } + set + { + _selectedRML = value; + InvalidateLiquidFactorsAndProcessTables(); + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + } + } + + private bool _isSideBarOpened; + /// <summary> + /// Gets or sets a value indicating whether the configuration panels are opened. + /// </summary> + public bool IsSideBarOpened + { + get { return _isSideBarOpened; } + set { _isSideBarOpened = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _estimatedDuration; + /// <summary> + /// Gets or sets the estimated duration for the selected job. + /// </summary> + public TimeSpan EstimatedDuration + { + get { return _estimatedDuration; } + set { _estimatedDuration = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobRunning; + /// <summary> + /// Gets or sets a value indicating whether a job is currently running. + /// </summary> + public bool IsJobRunning + { + get { return _isJobRunning; } + set { _isJobRunning = value; RaisePropertyChangedAuto(); } + } + + private Job _runningJob; + /// <summary> + /// Gets or sets the currently running job. + /// </summary> + public Job RunningJob + { + get { return _runningJob; } + set { _runningJob = value; RaisePropertyChangedAuto(); } + } + + private double _runningJobProgress; + /// <summary> + /// Gets or sets the running job current progress. + /// </summary> + public double RunningJobProgress + { + get { return _runningJobProgress; } + set { _runningJobProgress = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _runningJobRemainingTime; + /// <summary> + /// Gets or sets the job remaining time. + /// </summary> + public TimeSpan RunningJobRemainingTime + { + get { return _runningJobRemainingTime; } + set { _runningJobRemainingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCompleted; + /// <summary> + /// Gets or sets a value indicating whether the running job has completed successfully. + /// </summary> + public bool IsJobCompleted + { + get { return _isJobCompleted; } + set { _isJobCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobFailed; + /// <summary> + /// Gets or sets a value indicating whether the running job has failed. + /// </summary> + public bool IsJobFailed + { + get { return _isJobFailed; } + set { _isJobFailed = value; RaisePropertyChangedAuto(); } + } + + private bool _showJobStatus; + /// <summary> + /// Gets or sets a value indicating whether to show all the relevant job status areas. + /// </summary> + public bool ShowJobStatus + { + get { return _showJobStatus; } + set { _showJobStatus = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCanceled; + /// <summary> + /// Gets or sets a value indicating whether the last running job was canceled. + /// </summary> + public bool IsJobCanceled + { + get { return _isJobCanceled; } + set { _isJobCanceled = value; RaisePropertyChangedAuto(); } + } + + private IMachineOperator _machineOperator; + /// <summary> + /// Gets or sets the machine operator. + /// </summary> + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + + private IRealTimeGraph _fullScreenGraph; + /// <summary> + /// Gets or sets the full screen graph. + /// </summary> + public IRealTimeGraph FullScreenGraph + { + get { return _fullScreenGraph; } + set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } + } + + private List<Segment> _runningJobSegments; + /// <summary> + /// Gets or sets the running job segments. + /// </summary> + public List<Segment> RunningJobSegments + { + get { return _runningJobSegments; } + set { _runningJobSegments = value; RaisePropertyChangedAuto(); } + } + + private ICollectionView _jobsCollectionView; + /// <summary> + /// Gets or sets the jobs collection view. + /// </summary> + public ICollectionView JobsCollectionView + { + get { return _jobsCollectionView; } + set + { + _jobsCollectionView = value; + BindingOperations.EnableCollectionSynchronization(_jobsCollectionView, _syncLock); + + RaisePropertyChangedAuto(); + } + } + + private ICollectionView _segmentsCollectionView; + /// <summary> + /// Gets or sets the segments collection view. + /// </summary> + public ICollectionView SegmentsCollectionView + { + get { return _segmentsCollectionView; } + set + { + _segmentsCollectionView = value; + BindingOperations.EnableCollectionSynchronization(_segmentsCollectionView, _syncLock); + RaisePropertyChangedAuto(); + } + } + + private ICollectionView _brushStopsCollectionView; + /// <summary> + /// Gets or sets the brush stops collection view. + /// </summary> + public ICollectionView BrushStopsCollectionView + { + get { return _brushStopsCollectionView; } + set + { + _brushStopsCollectionView = value; + BindingOperations.EnableCollectionSynchronization(_brushStopsCollectionView, _syncLock); + RaisePropertyChangedAuto(); + } + } + + private String _jobFilter; + /// <summary> + /// Gets or sets the job filter. + /// </summary> + public String JobFilter + { + get { return _jobFilter; } + set { _jobFilter = value; RaisePropertyChangedAuto(); OnJobFilterChanged(); } + } + + #endregion + + #region Commands + + /// <summary> + /// Gets or sets the edit machine command. + /// </summary> + public RelayCommand EditMachineCommand { get; set; } + + /// <summary> + /// Gets or sets the edit RML command. + /// </summary> + public RelayCommand EditRMLCommand { get; set; } + + /// <summary> + /// Gets or sets the toggle side bar command. + /// </summary> + public RelayCommand ToggleSideBarCommand { get; set; } + + /// <summary> + /// Gets or sets the save process parameters command. + /// </summary> + public RelayCommand SaveProcessParametersCommand { get; set; } + + /// <summary> + /// Gets or sets the save liquid factors command. + /// </summary> + public RelayCommand SaveLiquidFactorsCommand { get; set; } + + /// <summary> + /// Gets or sets the add segment command. + /// </summary> + public RelayCommand AddSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the remove segment command. + /// </summary> + public RelayCommand RemoveSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the add job command. + /// </summary> + public RelayCommand AddJobCommand { get; set; } + + /// <summary> + /// Gets or sets the remove job command. + /// </summary> + public RelayCommand RemoveJobCommand { get; set; } + + /// <summary> + /// Gets or sets the add brush stop command. + /// </summary> + public RelayCommand AddBrushStopCommand { get; set; } + + /// <summary> + /// Gets or sets the remove brush stop command. + /// </summary> + public RelayCommand RemoveBrushStopCommand { get; set; } + + /// <summary> + /// Gets or sets the save job command. + /// </summary> + public RelayCommand SaveJobCommand { get; set; } + + /// <summary> + /// Gets or sets the discard job command. + /// </summary> + public RelayCommand DiscardJobCommand { get; set; } + + /// <summary> + /// Gets or sets the start job command. + /// </summary> + public RelayCommand StartJobCommand { get; set; } + + /// <summary> + /// Gets or sets the stop job command. + /// </summary> + public RelayCommand StopJobCommand { get; set; } + + /// <summary> + /// Gets or sets the close job completion status command. + /// </summary> + public RelayCommand CloseJobCompletionStatusCommand { get; set; } + + /// <summary> + /// Gets or sets the load job command. + /// </summary> + public RelayCommand LoadJobCommand { get; set; } + + /// <summary> + /// Gets or sets the duplicate job command. + /// </summary> + public RelayCommand DuplicateJobCommand { get; set; } + + /// <summary> + /// Gets or sets the duplicate segment command. + /// </summary> + public RelayCommand DuplicateSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the duplicate brush stop command. + /// </summary> + public RelayCommand DuplicateBrushStopCommand { get; set; } + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="MainViewVM"/> class. + /// </summary> + public MainViewVM(IMainView view) : base(view, true) + { + + } + + /// <summary> + /// Initializes a new instance of the <see cref="MainViewVM"/> class. + /// </summary> + /// <param name="applicationManager">The application manager.</param> + /// <param name="notificationProvider">The notification provider.</param> + [PreferredConstructor] + public MainViewVM(IMainView view, IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this(view) + { + SelectedJobs = new ObservableCollection<Job>(); + + LogManager.Log("Initializing machine Db context..."); + _machineDbContext = ObservablesContext.CreateDefault(); + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) + { + LogManager.Log("Setting last selected machine from settings..."); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); + } + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) + { + LogManager.Log("Setting last selected job from settings..."); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); + } + + + _authentication = authentication; + + _notification = notificationProvider; + _navigation = navigation; + ApplicationManager = applicationManager; + VideoCaptureProvider = videoCaptureProvider; + + LogManager.Log("Initializing relay commands..."); + + //Initialize Commands... + EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); + EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null); + ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened); + SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0); + SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors, () => SelectedRML != null); + AddSegmentCommand = new RelayCommand(AddSegment, () => ActiveJob != null); + RemoveSegmentCommand = new RelayCommand(RemoveSelectedSegments, () => SelectedSegment != null); + AddJobCommand = new RelayCommand(AddJob, () => SelectedMachine != null); + RemoveJobCommand = new RelayCommand(RemoveSelectedJobs, () => SelectedMachineJob != null); + AddBrushStopCommand = new RelayCommand(AddBrushStop, () => SelectedSegment != null); + RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null); + SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null); + DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null); + StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning); + StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); + CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); + LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null); + DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null); + DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null); + DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null); + + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + #endregion + + #region Event Handlers + + /// <summary> + /// Handles the application manager connected machine changes event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="machine">The machine.</param> + private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) + { + MachineOperator = machine; + } + + /// <summary> + /// Handles the Saved event of the SelectedMachine. + /// </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 SelectedMachine_Saved(object sender, EventArgs e) + { + InvalidateLiquidFactorsAndProcessTables(); + SelectedMachine.Reload(_machineDbContext); + } + + /// <summary> + /// Handles the LengthChanged event of the SelectedJob. + /// </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 ActiveJob_LengthChanged(object sender, EventArgs e) + { + UpdateEstimatedDuration(); + } + + /// <summary> + /// Handles the DyeingSpeedMinInkUptakeChanged event of the SelectedProcessParametersTable. + /// </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 SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged(object sender, EventArgs e) + { + if (SelectedSegment != null) + { + foreach (var liquidVolume in SelectedSegment.BrushStops.SelectMany(x => x.LiquidVolumes)) + { + liquidVolume.Invalidate(); + } + } + + UpdateEstimatedDuration(); + } + + #endregion + + #region Properties Changes + + /// <summary> + /// Called when the selected parameters table has changed. + /// </summary> + protected virtual void OnSelectedParametersTableChanged() + { + if (SelectedProcessParametersTable != null) + { + LogManager.Log("Selected process parameters table changed."); + SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged -= SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; + SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged += SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; + + SetSegmentBrushStopsLiquidVolumes(SelectedSegment); + UpdateEstimatedDuration(); + } + } + + /// <summary> + /// Called when the process parameters table group has been changed + /// </summary> + protected virtual void OnProcessParametersTableGroupChanged() + { + if (RmlProcessParametersTableGroup != null && RmlProcessParametersTableGroup.ProcessParametersTables.Count > 0) + { + LogManager.Log("Process parameters group changed..."); + SelectedProcessParametersTable = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault(); + + UpdateEstimatedDuration(); + } + } + + /// <summary> + /// Called when the selected segment has been changed + /// </summary> + protected virtual void OnSelectedSegmentChanged() + { + if (SelectedSegment != null) + { + LogManager.Log("Selected segment changed..."); + SetSegmentBrushStopsLiquidVolumes(SelectedSegment); + SelectedBrushStop = SelectedSegment.BrushStops.FirstOrDefault(); + + BrushStopsCollectionView = CollectionViewSource.GetDefaultView(SelectedSegment.BrushStops); + BrushStopsCollectionView.SortDescriptions.Add(new SortDescription(nameof(BrushStop.StopIndex), ListSortDirection.Ascending)); + } + } + + /// <summary> + /// Called when the selected group history has been changed + /// </summary> + protected virtual void OnSelectedGroupHistoryChanged() + { + if (SelectedGroupHistory != null) + { + LogManager.Log(String.Format("Parameters group {0} selected from history.", SelectedGroupHistory.Name)); + RmlProcessParametersTableGroup = SelectedGroupHistory.CloneGroup(); + } + } + + /// <summary> + /// Called when the machine has been changed + /// </summary> + protected virtual void OnSelectedMachineChanged() + { + if (SelectedMachine != null) + { + LogManager.Log(String.Format("Machine {0} changed.", SelectedMachine.SerialNumber)); + ReloadMachine(); + JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs); + JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + } + } + + /// <summary> + /// Called when the job filtering has changed. + /// </summary> + protected virtual void OnJobFilterChanged() + { + String filter = JobFilter.ToLower(); + + JobsCollectionView.Filter = (job) => + { + Job j = job as Job; + return String.IsNullOrWhiteSpace(filter) + || + j.Name.ToLower().Contains(filter) //Job name + || + j.User.Contact.FirstName.ToLower().Contains(filter) // User first name + || + j.Length.ToString().Contains(filter); //Job length + }; + } + + /// <summary> + /// Called when the active job has changed. + /// </summary> + protected virtual void OnActiveJobChanged() + { + if (ActiveJob != null) + { + LogManager.Log(String.Format("Active job {0} changed.", ActiveJob.Name)); + SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments); + SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + } + } + + #endregion + + #region Drag & Drop + + /// <summary> + /// Switch the segment position in the job. + /// </summary> + /// <param name="dragged">The dragged.</param> + /// <param name="dropped">The dropped.</param> + public void OnDropSegment(Segment dragged, Segment dropped) + { + LogManager.Log(String.Format("Segment {0} Dropped on segment {1}", dragged.SegmentIndex, dropped.SegmentIndex)); + + dragged.SegmentIndex = dropped.SegmentIndex; + dropped.SegmentIndex++; + + int index = 1; + + foreach (var segment in ActiveJob.Segments.OrderBy(x => x.SegmentIndex)) + { + segment.SegmentIndex = index++; + } + + SegmentsCollectionView.Refresh(); + } + + /// <summary> + /// Switch the brush stop position in the segment. + /// </summary> + /// <param name="dragged">The dragged stop.</param> + /// <param name="dropped">The dropped stop.</param> + public void OnDropBrushStop(BrushStop dragged, BrushStop dropped) + { + LogManager.Log(String.Format("BrushStop {0} Dropped on BrushStop {1}", dragged.StopIndex, dropped.StopIndex)); + + dragged.SetStopIndex(dropped.StopIndex); + dropped.SetStopIndex(dropped.StopIndex + 1); + ArrangeBrushStopsIndices(); + } + + #endregion + + #region Running Job Management + + /// <summary> + /// Closes the job completion status bar. + /// </summary> + private void CloseJobCompletionStatusBar() + { + LogManager.Log("Closing job completion status bar..."); + _navigation.NavigateTo(DeveloperNavigationView.JobView); + IsJobCompleted = false; + IsJobFailed = false; + IsJobCanceled = false; + ShowJobStatus = false; + RunningJob = null; + } + + /// <summary> + /// Stops the job. + /// </summary> + private void StopJob() + { + LogManager.Log("Stopping job..."); + IsJobRunning = false; + IsJobCanceled = true; + _jobHandler.Cancel(); + } + + /// <summary> + /// Fails the job. + /// </summary> + private void SetJobFailed() + { + LogManager.Log("Setting job failed state..."); + IsJobRunning = false; + IsJobFailed = true; + } + + /// <summary> + /// Completes the job. + /// </summary> + private void SetJobCompleted() + { + LogManager.Log("Setting job completed state..."); + IsJobRunning = false; + IsJobCompleted = true; + } + + /// <summary> + /// Starts the job. + /// </summary> + private void StartJob() + { + LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); + if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) + { + _notification.ShowError("No machine connected. Could not execute the specified job."); + return; + } + + if (SelectedProcessParametersTable == null) + { + _notification.ShowError("No process parameters table selected. Could not execute the specified job."); + return; + } + + RunningJobRemainingTime = TimeSpan.Zero; + RunningJobProgress = 0; + IsJobFailed = false; + IsJobCanceled = false; + IsJobCompleted = false; + IsJobRunning = true; + ShowJobStatus = true; + RunningJob = ActiveJob; + _runningJobEstimatedDuration = EstimatedDuration; + + RunningJobSegments = CreateRunningJobEffectiveSegments(RunningJob); + + _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); + + LogManager.Log("Sending job to machine operator..."); + _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + + _jobHandler.StatusReceived += (x, status) => + { + RunningJobRemainingTime = _runningJobEstimatedDuration - TimeSpan.FromSeconds(RunningJobProgress / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + RunningJobProgress = status.Progress; + + foreach (var segment in RunningJobSegments) + { + var previousSegmentsWithThis = RunningJobSegments.Where(s => RunningJobSegments.IndexOf(s) <= RunningJobSegments.IndexOf(segment)).ToList(); + var segmentsDuration = TimeSpan.FromSeconds(previousSegmentsWithThis.Sum(s => s.Length) / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + var segmentDuration = TimeSpan.FromSeconds(segment.Length / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + TimeSpan remaining = segmentsDuration - TimeSpan.FromSeconds(RunningJobProgress / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + if (remaining >= TimeSpan.Zero) + { + segment.RemainingTime = remaining; + } + if (remaining < segmentDuration) + { + segment.Started = true; + } + if (remaining <= TimeSpan.Zero) + { + segment.Completed = true; + segment.Started = false; + } + } + }; + + _jobHandler.Failed += (x, ex) => + { + LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); + SetJobFailed(); + + InvokeUI(() => + { + _notification.ShowError("Job failed. " + ex.Message); + }); + }; + + _jobHandler.Completed += (x, e) => + { + LogManager.Log(String.Format("Job {0} has completed.", RunningJob.Name)); + SetJobCompleted(); + }; + + _jobHandler.Canceled += (x, y) => + { + LogManager.Log(String.Format("Job {0} has been canceled.", RunningJob.Name)); + //Finally Canceled.. + }; + } + + /// <summary> + /// Creates the running job effective segments. + /// </summary> + /// <param name="job">The job.</param> + /// <returns></returns> + private List<Segment> CreateRunningJobEffectiveSegments(Job job) + { + LogManager.Log("Creating job effective segments..."); + + List<Segment> segments = new List<Segment>(); + foreach (var s in job.Segments) + { + s.Completed = false; + s.Started = false; + segments.Add(s); + + if (job.EnableInterSegment && job.Segments.IndexOf(s) != job.Segments.Count - 1) + { + segments.Add(new Segment() + { + Length = job.InterSegmentLength, + BrushStops = new System.Collections.ObjectModel.ObservableCollection<BrushStop>() + { + new BrushStop() + { + Color = Colors.White, + } + }, + Started = false, + Completed = false + }); + } + } + + return segments; + } + + #endregion + + #region RML + + /// <summary> + /// Saves the liquid factors. + /// </summary> + private async void SaveLiquidFactors() + { + if (SelectedRML != null) + { + using (_notification.PushTaskItem("Saving Liquid Factors...")) + { + LogManager.Log(String.Format("Saving liquid factors for RML {0}...", SelectedRML.Name)); + await SelectedRML.SaveAsync(_activeJobDbContext); + InvalidateLiquidFactorsAndProcessTables(); + } + } + } + + /// <summary> + /// Navigates to the DB Module in order to edit the selected RML. + /// </summary> + private void EditRML() + { + LogManager.Log(String.Format("Requesting DB module for RML {0} editing...", SelectedRML.Name)); + ApplicationManager.RequestModule("Data Base", SelectedRML); + } + + /// <summary> + /// Saves the process parameters group. + /// </summary> + private async void SaveProcessParameters() + { + var response = _notification.ShowTextInput("Enter Group Name", "Group Name"); + + if (response == null) return; + + using (_notification.PushTaskItem("Saving Parameters Group...")) + { + LogManager.Log(String.Format("Saving process parameters group under the name {0}...", response)); + ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); + + List<ProcessParametersTable> tables = new List<ProcessParametersTable>(); + foreach (var table in RmlProcessParametersTableGroup.ProcessParametersTables) + { + var newTable = table.CloneEntity(); + newTable.ProcessParametersTablesGroup = group; + tables.Add(newTable); + } + + group.Active = true; + group.ProcessParametersTables = tables.ToObservableCollection(); + group.Rml = SelectedRML; + group.Name = response; + group.SaveDate = DateTime.UtcNow; + + foreach (var g in SelectedRML.ProcessParametersTablesGroups) + { + g.Active = false; + } + + SelectedRML.ProcessParametersTablesGroups.Add(group); + await SelectedRML.SaveAsync(_activeJobDbContext); + + InvalidateLiquidFactorsAndProcessTables(); + } + } + + /// <summary> + /// Invalidates the liquid factors and process parameters tables. + /// </summary> + private void InvalidateLiquidFactorsAndProcessTables() + { + if (SelectedRML != null && SelectedMachine != null) + { + LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); + LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); + RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); + + var selectedHistory = RmlProcessParametersTableGroup; + + if (RmlProcessParametersTableGroup != null) + { + RmlProcessParametersTableGroup = RmlProcessParametersTableGroup.CloneGroup(); + RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection(); + } + + GroupsHistory = SelectedRML.ProcessParametersTablesGroups.OrderByDescending(x => x.SaveDate).OrderBy(x => !x.Active).ToObservableCollection(); + + _selectedGroupHistory = selectedHistory; + + RaisePropertyChangedAuto(nameof(SelectedGroupHistory)); + } + } + + #endregion + + #region Active Job Management + + /// <summary> + /// Loads the selected job. + /// </summary> + private void LoadSelectedJob() + { + if (SelectedMachineJob != null) + { + using (_notification.PushTaskItem("Loading job details...")) + { + LogManager.Log(String.Format("Loading job {0}...", SelectedMachineJob.Name)); + SelectedSegments = new ObservableCollection<Segment>(); + SelectedBrushStops = new ObservableCollection<BrushStop>(); + SelectedRML = null; + SelectedSegment = null; + SelectedGroupHistory = null; + SelectedBrushStop = null; + SelectedProcessParametersTable = null; + RmlProcessParametersTableGroup = null; + + + _blockInvalidateCommands = false; + + LogManager.Log("Creating active job DB context..."); + _activeJobDbContext = ObservablesContext.CreateDefault(); + _activeJobDbContext.Configuration.LazyLoadingEnabled = true; + + LogManager.Log("Initializing available color spaces, RMLs & Winding methods..."); + ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection(); + Rmls = _activeJobDbContext.Rmls.ToObservableCollection(); + WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection(); + + LogManager.Log("Setting active job..."); + _activeJob = _activeJobDbContext.Jobs.SingleOrDefault(x => x.Guid == SelectedMachineJob.Guid); + + _selectedRML = ActiveJob.Rml; + + LogManager.Log("Setting selected segment..."); + _selectedSegment = ActiveJob.Segments.FirstOrDefault(); + + ActiveJob.LengthChanged -= ActiveJob_LengthChanged; + ActiveJob.LengthChanged += ActiveJob_LengthChanged; + + ActiveJob = _activeJob; + + SelectedRML = _selectedRML; + SelectedSegment = _selectedSegment; + + UpdateEstimatedDuration(); + + _blockInvalidateCommands = false; + InvalidateRelayCommands(); + + _navigation.NavigateTo(DeveloperNavigationView.JobView); + } + } + } + + /// <summary> + /// Saves the active job. + /// </summary> + private async void SaveActiveJob() + { + if (ActiveJob != null) + { + using (_notification.PushTaskItem("Saving job details...")) + { + LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name)); + ActiveJob.LastUpdated = DateTime.UtcNow; + ActiveJob.Rml = SelectedRML; + + await ActiveJob.SaveAsync(_activeJobDbContext); + ReloadMachine(); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == ActiveJob.Guid); + } + } + } + + private void BackToJobs() + { + LogManager.Log("User request for 'back to jobs'..."); + LogManager.Log("Comparing active job with selected job..."); + + bool jobModified = !ActiveJob.CompareUsingJson(SelectedMachineJob); + + if (jobModified) + { + LogManager.Log("Selected job has been modified. Invoking confirmation dialog..."); + if (_notification.ShowQuestion("This will discard the current job changes. Are you sure?")) + { + LogManager.Log("Disposing active job db context..."); + _activeJobDbContext.Dispose(); + _navigation.NavigateTo(DeveloperNavigationView.MachineJobSelectionView); + } + } + else + { + LogManager.Log("Disposing active job db context..."); + _activeJobDbContext.Dispose(); + _navigation.NavigateTo(DeveloperNavigationView.MachineJobSelectionView); + } + } + + #endregion + + #region Private Methods + + private void ReloadMachine() + { + LogManager.Log("Reloading selected machine..."); + _machineDbContext.Dispose(); + _machineDbContext = ObservablesContext.CreateDefault(); + _machineDbContext.Configuration.LazyLoadingEnabled = true; + String machineGuid = _selectedMachine.Guid; + Machines = _machineDbContext.Machines.ToObservableCollection(); + _selectedMachine = Machines.SingleOrDefault(x => x.Guid == machineGuid); + RaisePropertyChanged(nameof(SelectedMachine)); + + JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs); + JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + } + + private void UpdateEstimatedDuration() + { + if (ActiveJob != null && SelectedProcessParametersTable != null && SelectedProcessParametersTable.DyeingSpeed > 0) + { + EstimatedDuration = TimeSpan.FromSeconds(ActiveJob.Length / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + } + } + + private void SetSegmentBrushStopsLiquidVolumes(Segment segment) + { + if (!DesignMode && segment != null) + { + LogManager.Log("Setting segment brush stops liquid volumes..."); + foreach (var stop in segment.BrushStops) + { + stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); + } + } + } + + /// <summary> + /// Navigates to the Machine Designer Module in order to edit the selected machine. + /// </summary> + private void EditMachine() + { + LogManager.Log(String.Format("Requesting machine designer module for machine {0} editing...", SelectedMachine.SerialNumber)); + ApplicationManager.RequestModule("Machine Designer", SelectedMachine); + } + + #endregion + + #region Add / Remove / Duplicate Jobs, Segments & Brush Stops + + /// <summary> + /// Arranges the segments indices. + /// </summary> + private void ArrangeSegmentsIndices() + { + int index = 1; + + foreach (var segment in ActiveJob.Segments.OrderBy(x => x.SegmentIndex)) + { + segment.SegmentIndex = index++; + } + + SegmentsCollectionView.Refresh(); + } + + /// <summary> + /// Arranges the brush stops indices. + /// </summary> + private void ArrangeBrushStopsIndices() + { + int index = 0; + + foreach (var stop in SelectedSegment.BrushStops.OrderBy(x => x.StopIndex)) + { + stop.SetStopIndex(index++); + } + + if (SelectedSegment.BrushStops.Count > 1) + { + SelectedSegment.BrushStops.OrderBy(x => x.StopIndex).First().OffsetPercent = 0; + SelectedSegment.BrushStops.OrderBy(x => x.StopIndex).Last().OffsetPercent = 100; + } + + foreach (var stop in SelectedSegment.BrushStops.OrderBy(x => x.StopIndex)) + { + stop.RaiseStopIndex(); + stop.RaiseOffsetChanged(); + } + + BrushStopsCollectionView.Refresh(); + } + + /// <summary> + /// Removes the selected segments. + /// </summary> + private void RemoveSelectedSegments() + { + if (ActiveJob != null && SelectedSegment != null) + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected segments?")) + { + LogManager.Log(String.Format("Removing {0} segments...", SelectedSegments.Count)); + + SelectedSegments.ToList().ForEach(x => + { + ActiveJob.Segments.Remove(x); + x.DefferedDelete(_activeJobDbContext); + }); + + ArrangeSegmentsIndices(); + } + } + } + + /// <summary> + /// Adds a new segment. + /// </summary> + private void AddSegment() + { + if (ActiveJob != null) + { + LogManager.LogFormat("Adding new segment to job {0}...", ActiveJob.Name); + Segment seg = new Segment(); + seg.Name = "Untitled Segment"; + seg.Length = 10; + + if (ActiveJob.Segments.Count > 0) + { + seg.SegmentIndex = ActiveJob.Segments.Max(x => x.SegmentIndex) + 1; + } + else + { + seg.SegmentIndex = 1; + } + ActiveJob.Segments.Add(seg); + SelectedSegment = seg; + AddBrushStop(); + ArrangeSegmentsIndices(); + } + } + + /// <summary> + /// Removes the selected jobs. + /// </summary> + private async void RemoveSelectedJobs() + { + if (SelectedMachine != null && SelectedMachineJob != null) + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected jobs?")) + { + LogManager.Log(String.Format("Removing {0} jobs...", SelectedJobs.Count)); + SelectedJobs.ToList().ForEach(x => + { + SelectedMachine.Jobs.Remove(x); + x.DefferedDelete(_machineDbContext); + }); + + using (_notification.PushTaskItem("Removing selected jobs...")) + { + LogManager.Log("Saving selected machine to database..."); + await SelectedMachine.SaveAsync(_machineDbContext); + } + } + } + } + + /// <summary> + /// Adds a new job to the selected machine. + /// </summary> + private async void AddJob() + { + if (SelectedMachine != null) + { + String jobName = _notification.ShowTextInput("Please provide a job name", "Name"); + + if (!String.IsNullOrWhiteSpace(jobName)) + { + LogManager.Log(String.Format("Adding new job {0}...", jobName)); + + Job newJob = new Job(); + newJob.Name = jobName; + newJob.CreationDate = DateTime.UtcNow; + newJob.User = _authentication.CurrentUser; + newJob.Rml = _machineDbContext.Rmls.FirstOrDefault(); + newJob.WindingMethod = _machineDbContext.WindingMethods.FirstOrDefault(); + newJob.Machine = SelectedMachine; + + SelectedMachine.Jobs.Add(newJob); + LogManager.Log("Saving selected machine to database..."); + await SelectedMachine.SaveAsync(_machineDbContext); + SelectedMachineJob = newJob; + LoadSelectedJob(); + AddSegment(); + } + } + } + + /// <summary> + /// Removes the selected brush stop. + /// </summary> + private void RemoveSelectedBrushStops() + { + if (SelectedBrushStop != null && SelectedSegment != null) + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected colors?")) + { + LogManager.Log(String.Format("Removing {0} brush stops...", SelectedBrushStops.Count)); + + SelectedBrushStops.ToList().ForEach(x => + { + SelectedSegment.BrushStops.Remove(x); + x.DefferedDelete(_activeJobDbContext); + }); + + ArrangeBrushStopsIndices(); + } + } + } + + /// <summary> + /// Adds a new brush stop to the selected segment. + /// </summary> + private void AddBrushStop() + { + if (SelectedSegment != null) + { + LogManager.LogFormat("Adding new brush stop to segment...", SelectedSegment.SegmentIndex.ToString()); + + var stop = new BrushStop(); + + if (SelectedSegment.BrushStops.Count > 0) + { + stop.StopIndex = SelectedSegment.BrushStops.Max(x => x.StopIndex) + 1; + } + else + { + stop.StopIndex = 0; + } + + stop.OffsetPercent = 100; + stop.Segment = SelectedSegment; + stop.ColorSpace = _activeJobDbContext.ColorSpaces.FirstOrDefault(); + stop.Color = Colors.Black; + stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); + SelectedSegment.BrushStops.Add(stop); + SelectedSegment.BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); + ArrangeBrushStopsIndices(); + } + } + + /// <summary> + /// Duplicates the selected brush stops. + /// </summary> + private void DuplicateSelectedBrushStops() + { + LogManager.LogFormat("Duplicating {0} brush stops...", SelectedBrushStops.Count); + + foreach (var stop in SelectedBrushStops.OrderBy(x => x.StopIndex)) + { + var cloned = stop.Clone(); + cloned.StopIndex = SelectedSegment.BrushStops.Max(x => x.StopIndex) + 1; + SelectedSegment.BrushStops.Add(cloned); + } + + ArrangeBrushStopsIndices(); + } + + /// <summary> + /// Duplicates the selected segments. + /// </summary> + private void DuplicateSelectedSegments() + { + LogManager.LogFormat("Duplicating {0} segments...", SelectedSegments.Count); + + foreach (var segment in SelectedSegments.OrderBy(x => x.SegmentIndex)) + { + var cloned = segment.Clone(); + cloned.SegmentIndex = ActiveJob.Segments.Max(x => x.SegmentIndex) + 1; + ActiveJob.Segments.Add(cloned); + } + + ArrangeSegmentsIndices(); + } + + /// <summary> + /// Duplicates the selected jobs. + /// </summary> + private async void DuplicateSelectedJobs() + { + if (SelectedMachineJob != null) + { + using (_notification.PushTaskItem("Cloning selected jobs...")) + { + LogManager.LogFormat("Duplicating {0} jobs...", SelectedJobs.Count); + + int index = SelectedMachine.Jobs.Max(x => x.JobIndex); + + foreach (var job in SelectedJobs) + { + var cloned = job.Clone(); + cloned.JobIndex = ++index; + SelectedMachine.Jobs.Add(cloned); + } + + LogManager.Log("Saving selected machine to database..."); + await SelectedMachine.SaveAsync(_machineDbContext); + } + } + } + + #endregion + + #region Override Methods + + protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null) + { + base.RaisePropertyChangedAuto(caller); + + if (!_blockInvalidateCommands) + { + InvalidateRelayCommands(); + } + } + + #endregion + + #region IShutdownRequestBlocker + + public Task<bool> OnShutdownRequest() + { + if (IsJobRunning) + { + InvokeUI(() => + { + _notification.ShowWarning("Please stop the currently running job before closing the developer module."); + }); + + return Task.FromResult(false); + } + + return Task.FromResult(true); + } + + #endregion + + #region IShutdownListener + + public void OnShuttingDown() + { + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; + } + + #endregion + + #region IMainView + + protected override void OnViewAttached() + { + base.OnViewAttached(); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs new file mode 100644 index 000000000..17a59a761 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.Views +{ + public interface IMainView : IView + { + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml new file mode 100644 index 000000000..4467b1f28 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -0,0 +1,1380 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:global="clr-namespace:Tango.MachineStudio.Developer" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:printing="clr-namespace:Tango.Integration.Printing;assembly=Tango.Integration" + xmlns:dispensing="clr-namespace:Tango.Integration.Dispensing;assembly=Tango.Integration" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" + xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:observables="clr-namespace:Tango.Integration.Observables;assembly=Tango.Integration" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:video="clr-namespace:Tango.Video.DirectCapture;assembly=Tango.Video" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter"></converters:NullObjectToBooleanConverter> + <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"></converters:GreaterThanToBooleanConverter> + <converters:SmallerThanToBooleanConverter x:Key="SmallerThanToBooleanConverter"></converters:SmallerThanToBooleanConverter> + <localConverters:BrushStopToColorConverter x:Key="BrushStopToColorConverter" /> + <localConverters:BrushStopCMYKToColorConverter x:Key="BrushStopCMYKToColorConverter" /> + <localConverters:BrushStopLabToColorConverter x:Key="BrushStopLabToColorConverter" /> + <localConverters:SegmentToGradientStopsConverter x:Key="SegmentToGradientStopsConverter" /> + <localConverters:BrushStopToOffsetLimitConverter x:Key="BrushStopToOffsetLimitConverter" /> + <localConverters:JobToColumnDefinitionsConverter x:Key="JobToColumnDefinitionsConverter" /> + <localConverters:SegmentLengthToWidthConverter x:Key="SegmentLengthToWidthConverter" /> + <localConverters:SegmentToGradientStopsConverterMulti x:Key="SegmentToGradientStopsConverterMulti" /> + <localConverters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" /> + <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> + <localConverters:ObjectsNotEqualToBooleanConveter x:Key="ObjectsNotEqualToBooleanConveter" /> + <localConverters:JobProgressToPositionConverter x:Key="JobProgressToPositionConverter" /> + <localConverters:BrushStopToOffsetValueConverter x:Key="BrushStopToOffsetValueConverter" /> + <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> + <converters:NumberToFileSizeConverter x:Key="NumberToFileSizeConverter"/> + <localConverters:OneToPercentConverter x:Key="OneToPercentConverter"/> + <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + + + <ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="dispensing:DispenserStepDivisions"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + + + <SolidColorBrush x:Key="SideBarBackground" Color="White"> + + </SolidColorBrush> + + <Color x:Key="dummyColor">Transparent</Color> + + <Style x:Key="brushStopBorder" TargetType="Border"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Droppable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Draggable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.DraggingSurface" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"></Setter> + <Style.Triggers> + <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> + <Setter Property="Opacity" Value="0.5"></Setter> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + </Style.Triggers> + </Style> + + <Style TargetType="Border" x:Key="JobFieldBorder"> + <Setter Property="BorderBrush" Value="#A5A4A4"></Setter> + <Setter Property="BorderThickness" Value="0 0 1 1"></Setter> + <Setter Property="CornerRadius" Value="100 10 100 0"></Setter> + <Setter Property="Padding" Value="10 5 10 5"></Setter> + <Setter Property="Margin" Value="0 0 10 0"></Setter> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> + <GradientStop Color="#00E6E6E6"/> + <GradientStop Color="#DEDEDE" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="ContentControl" x:Key="colorPicker"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate> + <Grid> + <ToggleButton Cursor="Hand" x:Name="PopupButton" BorderThickness="0" Height="30" Background="Transparent" Foreground="{StaticResource AccentColorBrush}" VerticalAlignment="Center" Margin="30 0 0 0" IsChecked="{Binding ElementName=Popup, Path=IsOpen}"> + <ToggleButton.Style> + <Style TargetType="ToggleButton" BasedOn="{StaticResource emptyToggleButton}"> + <Style.Triggers> + <DataTrigger Binding="{Binding IsOpen, ElementName=Popup}" Value="True"> + <Setter Property="IsEnabled" Value="False" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ToggleButton.Style> + + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil" Width="32" Height="32"> + <materialDesign:PackIcon.Foreground> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </materialDesign:PackIcon.Foreground> + </materialDesign:PackIcon> + <TextBlock Margin="5 0 0 0" FontSize="14" VerticalAlignment="Center">SELECT COLOR</TextBlock> + </StackPanel> + </ToggleButton> + <Popup x:Name="Popup" MouseDown="Popup_MouseDown" PopupAnimation="Fade" StaysOpen="False" PlacementTarget="{Binding ElementName=PopupButton}" Placement="Bottom" AllowsTransparency="True"> + <Border Background="#E6FFFFFF" Height="250" Width="500" CornerRadius="5" Margin="10"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="10" /> + </Border.Effect> + <Grid> + <Grid Margin="10"> + <commonControls:HiveColorPickerControl SelectedColorChanged="HiveColorPickerControl_SelectedColorChanged" SelectedColor="{Binding Color,Mode=TwoWay}" DemoMode="True" /> + </Grid> + </Grid> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </UserControl.Resources> + + <Grid> + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Margin="0 10 10 0" Grid.Column="2"> + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="1*" /> + </Grid.ColumnDefinitions> + + <Grid Background="#96FFFFFF"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Width" Value="304"></Setter> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleY="1" ScaleX="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSideBarOpened}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleX" To="0" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleX" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <DockPanel> + <Border DockPanel.Dock="Bottom" Margin="10"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Command="{Binding DuplicateSegmentCommand}" Margin="0 0 4 0" Background="#FF9A6A" BorderBrush="#FF9A6A" Height="42" Padding="10" ToolTip="Duplicate Segment"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentCopy" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">Duplicate</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding RemoveSegmentCommand}" Margin="0 0 4 0" Background="#FF6A6A" BorderBrush="#FF6A6A" Height="42" Padding="10" ToolTip="Remove Segment"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Delete" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">Remove</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding AddSegmentCommand}" Background="#68B367" BorderBrush="#68B367" Height="42" Padding="10" ToolTip="Add Segment"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">New</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Border> + + <controls:MultiSelectListBox Style="{StaticResource {x:Type ListBox}}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SegmentsCollectionView}" SelectedItem="{Binding SelectedSegment}" SelectedItemsList="{Binding SelectedSegments,Mode=TwoWay}" HorizontalContentAlignment="Stretch"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}"> + + </Style> + </ListBox.ItemContainerStyle> + <ListBox.ItemTemplate> + <DataTemplate> + <Grid Margin="5 10" Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnSegmentDrop"> + <Polygon Points="40,0 290,0 290,100 0,100 0,30" StrokeThickness="0.2" IsHitTestVisible="False"> + <Polygon.Effect> + <DropShadowEffect Opacity="0.5" /> + </Polygon.Effect> + <Polygon.Style> + <Style TargetType="Polygon"> + <Setter Property="Stroke" Value="Black"></Setter> + <Setter Property="Fill"> + <Setter.Value> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="#00EEEEEE" Offset="0" /> + <GradientStop Color="#FFB5B5B5" Offset="1" /> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,FallbackValue=False}" Value="True"> + <Setter Property="Stroke" Value="Black"></Setter> + <Setter Property="Fill"> + <Setter.Value> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="White" Offset="0" /> + <GradientStop Color="{StaticResource AccentColor}" Offset="2" /> + </LinearGradientBrush> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Polygon.Style> + </Polygon> + <Border Height="100" Padding="5" IsHitTestVisible="False"> + <Grid> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontStyle="Italic"> + <Run>#</Run> + <Run>SEGMENT</Run> + <Run Text="{Binding SegmentIndex}"></Run> + </TextBlock> + <Rectangle VerticalAlignment="Bottom" Height="8"> + <Rectangle.Fill> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding> + </MultiBinding> + </Rectangle.Fill> + </Rectangle> + </Grid> + </Border> + + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </controls:MultiSelectListBox> + </DockPanel> + + <Rectangle HorizontalAlignment="Right" StrokeThickness="1" Width="3" Margin="0 0 0 0"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="#ECECEC" /> + <GradientStop Offset="0.5" Color="Black" /> + <GradientStop Offset="1.1" Color="Black" /> + </LinearGradientBrush> + </Rectangle.Fill> + <Rectangle.Stroke> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="White" /> + <GradientStop Offset="0.5" Color="White" /> + <GradientStop Offset="1" Color="White" /> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + </Grid> + + <Grid Grid.Column="1"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition/> + </Grid.RowDefinitions> + + <Grid> + <StackPanel> + <Grid> + <StackPanel Orientation="Horizontal" Margin="10"> + <Image Source="../Images/rgb.png" Width="24"></Image> + <TextBlock Margin="5 0 0 0" Text="{Binding ActiveJob.Name,FallbackValue='UNSET'}" FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" Margin="0 5 0 0" HorizontalAlignment="Right"> + <TextBlock Margin="0 0 5 0" Text="{Binding ActiveJob.CreationDate,FallbackValue='UNSET'}" FontSize="12" Foreground="Gray" FontStyle="Italic" VerticalAlignment="Center"></TextBlock> + <Image Source="../Images/calendar.png" Width="16"></Image> + </StackPanel> + </Grid> + + <StackPanel Orientation="Horizontal" Margin="10 20 0 0" MaxWidth="1000" HorizontalAlignment="Left"> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/name.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Name</TextBlock> + </StackPanel> + <TextBox Margin="0 3 0 0" Width="100" HorizontalAlignment="Left" Text="{Binding ActiveJob.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> + </Border> + + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="10 5 5 5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/wind.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Winding Method</TextBlock> + </StackPanel> + <ComboBox Width="90" HorizontalAlignment="Left" ItemsSource="{Binding WindingMethods}" SelectedItem="{Binding ActiveJob.WindingMethod}" DisplayMemberPath="Name" ></ComboBox> + </StackPanel> + </Border> + + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="20 5 5 5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/inter-segment.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Inter Segment</TextBlock> + </StackPanel> + <DockPanel LastChildFill="True"> + <ToggleButton Margin="10 0 25 0" DockPanel.Dock="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" IsChecked="{Binding ActiveJob.EnableInterSegment}"></ToggleButton> + <mahapps:NumericUpDown Width="70" HorizontalAlignment="Left" StringFormat="{}{0:N1} m" FontFamily="{StaticResource digital-7}" IsEnabled="{Binding ActiveJob.EnableInterSegment}" Margin="0 2 0 0" HideUpDownButtons="True" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveJob.InterSegmentLength,Mode=TwoWay}"></mahapps:NumericUpDown> + </DockPanel> + </StackPanel> + </Border> + + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="20 5 5 5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/lubrication.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Lubrication</TextBlock> + </StackPanel> + <DockPanel LastChildFill="True" Margin="0 10 30 0"> + <ToggleButton DockPanel.Dock="Right" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding ActiveJob.EnableLubrication}"></ToggleButton> + </DockPanel> + </StackPanel> + </Border> + + <Border Style="{StaticResource JobFieldBorder}" Height="90" Width="200"> + <StackPanel Width="200"> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <Image Source="../Images/description.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Description</TextBlock> + </StackPanel> + + <Border BorderThickness="0" BorderBrush="Silver" CornerRadius="5" Margin="0 0 5 5"> + <TextBox Padding="5 0 0 0" FontStyle="Italic" Background="Transparent" Style="{x:Null}" BorderThickness="0" Margin="5" Height="40" Text="{Binding ActiveJob.Description}" VerticalAlignment="Stretch" materialDesign:HintAssist.Hint="Enter description" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"></TextBox> + </Border> + </StackPanel> + </Border> + </StackPanel> + + + </StackPanel> + + <Grid HorizontalAlignment="Right" Margin="0 0 10 0"> + <StackPanel Orientation="Horizontal"> + <Button Height="70" Width="135" Margin="0 0 10 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}"> + <StackPanel> + <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="KeyboardBackspace" /> + <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">TO JOBS</TextBlock> + </StackPanel> + </Button> + <Button Height="70" Width="135" Margin="0 0 0 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}"> + <StackPanel> + <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="ContentSave" /> + <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">SAVE JOB</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + </Grid> + <Grid Grid.Row="1" Margin="0 20 0 0"> + <Grid.RowDefinitions> + <RowDefinition Height="1*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid> + + <Grid Grid.Column="1" Margin="10 5 0 0"> + <DockPanel> + <Grid Margin="0 10 0 0"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <Grid> + <StackPanel Orientation="Horizontal"> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/ruler.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Length</TextBlock> + </StackPanel> + <mahapps:NumericUpDown HideUpDownButtons="True" Width="90" HorizontalAlignment="Left" FontFamily="{StaticResource digital-7}" StringFormat="{}{0:N1} m" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown> + </StackPanel> + </Border> + + <Grid Margin="0 0 0 0"> + <StackPanel> + <TextBlock>MEDIA</TextBlock> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <ComboBox Width="200" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding Name}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Manufacturer}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + + <Button Margin="20 30 0 0" Command="{Binding EditRMLCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">EDIT MEDIA</TextBlock> + </StackPanel> + </Button> + + + + + </StackPanel> + </StackPanel> + + + </Grid> + + + </StackPanel> + + <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0 40 40 0"> + <materialDesign:PackIcon Kind="ChevronLeft" Width="24" Height="24" /> + <TextBlock Margin="10 -2 10 0" VerticalAlignment="Center"><Run>RML LIQUID FACTORS</Run> <Run FontSize="10" Foreground="DimGray">( Max Nanolitter/CM )</Run></TextBlock> + <materialDesign:PackIcon Kind="ChevronRight" Width="24" Height="24" /> + </StackPanel> + + <Grid HorizontalAlignment="Right" Margin="0 0 0 0"> + <Grid> + <DockPanel> + <Grid> + <StackPanel HorizontalAlignment="Right" Margin="0 0 0 0"> + <StackPanel Margin="0 10 0 0" Orientation="Horizontal" VerticalAlignment="Center"> + <ItemsControl ItemsSource="{Binding LiquidTypesRmls}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> + <StackPanel Margin="0 0 10 0"> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> + <Grid Width="58" Height="48" Margin="0 5 0 0"> + <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> + <shapes:Hexagon.Fill> + <LinearGradientBrush Opacity="0.7" > + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </shapes:Hexagon.Fill> + </shapes:Hexagon> + + <TextBox Style="{x:Null}" Background="Transparent" Foreground="Black" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" FontStyle="Italic"></TextBox> + </Grid> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Button Command="{Binding SaveLiquidFactorsCommand}" HorizontalAlignment="Right" Margin="0 20 0 0" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Harddisk"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">SAVE FACTORS</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </StackPanel> + + + </Grid> + </DockPanel> + </Grid> + </Grid> + </Grid> + </Grid> + + <Border DockPanel.Dock="Bottom" Margin="10"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Command="{Binding DuplicateBrushStopCommand}" Margin="0 0 4 0" Background="#FF9A6A" BorderBrush="#FF9A6A" Height="42" Padding="10"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentCopy" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">Duplicate</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding RemoveBrushStopCommand}" Margin="0 0 4 0" Background="#FF6A6A" BorderBrush="#FF6A6A" Height="42" Padding="10"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Delete" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">Remove</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding AddBrushStopCommand}" Background="#68B367" BorderBrush="#68B367" Height="42" Padding="10"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center">New</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Border> + + <Grid Margin="0 40 0 0"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/color-palette.png" Width="42"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">SEGMENT BRUSH</TextBlock> + </StackPanel> + + <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="15" Margin="200 0 10 0" StrokeThickness="1" Stroke="Gainsboro"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,0" EndPoint="1,0" x:Name="gradientBrush"></LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + </Grid> + <Grid Margin="0 10 10 0"> + <controls:MultiSelectListBox SelectionMode="Extended" Style="{x:Null}" Background="Transparent" ScrollViewer.CanContentScroll="False" BorderThickness="0" ItemsSource="{Binding BrushStopsCollectionView}" SelectedItem="{Binding SelectedBrushStop}" SelectedItemsList="{Binding SelectedBrushStops,Mode=TwoWay}" HorizontalContentAlignment="Stretch"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}"> + + </Style> + </ListBox.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:BrushStop}"> + + <StackPanel Margin="0 0 0 5"> + <Border BorderThickness="1" CornerRadius="5" Padding="10" dragAndDrop:DragAndDropService.Drop="OnBrushStopBorderDrop"> + <Border.Style> + <Style TargetType="Border" BasedOn="{StaticResource brushStopBorder}"> + <Setter Property="BorderBrush" Value="#B5B5B5"></Setter> + <Setter Property="Background" Value="#70FFFFFF"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,FallbackValue=False}" Value="True"> + <Setter Property="BorderBrush" Value="Gainsboro"></Setter> + <Setter Property="Background" Value="{StaticResource SideBarBackground}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <DockPanel> + <ContentControl DockPanel.Dock="Left"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <Rectangle/> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Volume"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel VerticalAlignment="Center"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <ContentControl Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ColorSpace.Name}" Value="RGB"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Orientation="Horizontal"> + <ContentControl Style="{StaticResource numberBorder}" Foreground="#FF6F6F" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Red, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="255" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="#92FF92" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Green, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="255" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="#3C7EF4" BorderThickness="1" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Blue, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="255" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource colorPicker}"></ContentControl> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ColorSpace.Name}" Value="CMYK"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Orientation="Horizontal"> + <ContentControl Style="{StaticResource numberBorder}" Foreground="Cyan" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="Magenta" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="Yellow" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="Black" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <Rectangle Margin="30 0 0 0" Width="50" Height="50" StrokeThickness="1" Stroke="Gray"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}"> + </SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ColorSpace.Name}" Value="LAB"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Orientation="Horizontal"> + <ContentControl Style="{StaticResource numberBorder}" Foreground="Gray" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding L, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="#FF8A8A" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding A, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-128" Maximum="128" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <ContentControl Style="{StaticResource numberBorder}" Foreground="#92FF92" Width="60" Height="60" Margin="10 0 0 0"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding B, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-128" Maximum="128" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"/> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + + <Rectangle Margin="30 0 0 0" Width="50" Height="50" StrokeThickness="1" Stroke="Gray"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}"> + </SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + + <Grid DockPanel.Dock="Right"> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/colorspace.png" Width="24"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Color Space</TextBlock> + </StackPanel> + <ComboBox ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ColorSpaces}" SelectedItem="{Binding ColorSpace}" DisplayMemberPath="Name" Width="100" HorizontalAlignment="Left"> + <ComboBox.ItemContainerStyle> + <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> + <Setter Property="Background" Value="#ECECEC"></Setter> + </Style> + </ComboBox.ItemContainerStyle> + </ComboBox> + </StackPanel> + </Border> + </Grid> + <Grid> + <StackPanel VerticalAlignment="Center"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedSegment.BrushStops.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=1}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <TextBlock Width="180" TextAlignment="Center" HorizontalAlignment="Center" FontSize="16"> + <Run FontWeight="Bold" FontStyle="Italic" Text="OFFSET:" Foreground="#5E5E5E"></Run> + <Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run> + <Run Foreground="Gray" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run> + </TextBlock> + <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="500" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}"> + <Slider.Foreground> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Slider.Foreground> + <Slider.Minimum> + <MultiBinding Converter="{StaticResource BrushStopToOffsetLimitConverter}" ConverterParameter="min"> + <Binding Path="."></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl,Mode=FindAncestor}" Path="DataContext.SelectedSegment"></Binding> + <Binding Path="StopIndex"></Binding> + </MultiBinding> + </Slider.Minimum> + <Slider.Maximum> + <MultiBinding Converter="{StaticResource BrushStopToOffsetLimitConverter}" ConverterParameter="max"> + <Binding Path="." Delay="500"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl,Mode=FindAncestor}" Path="DataContext.SelectedSegment"></Binding> + <Binding Path="StopIndex"></Binding> + </MultiBinding> + </Slider.Maximum> + </Slider> + </StackPanel> + </Grid> + </DockPanel> + </Grid> + </Border> + + <StackPanel> + <Grid VerticalAlignment="Top" Visibility="{Binding ElementName=toggleExpand,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggleExpand, Path=IsChecked}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggleExpand,Path=IsChecked}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <DataGrid ItemsSource="{Binding LiquidVolumes}" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" Background="Transparent" SelectionUnit="FullRow"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="IDS PACK"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Grid x:Name="t0"> + <Polygon x:Name="t1" Points="0,0 15,0 0,15 0,0" Margin="-15 -11 0 0"> + <Polygon.Fill> + <SolidColorBrush x:Name="t2" Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter},FallbackValue={StaticResource dummyColor}}" /> + </Polygon.Fill> + </Polygon> + <TextBlock FontWeight="SemiBold" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding IdsPack.LiquidType.Name}"></TextBlock> + </Grid> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="D/F"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding IdsPack.DispenserType.NlPerPulse,StringFormat='0.0'}"></Run> + <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="STEP"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <ComboBox ItemsSource="{Binding Source={StaticResource dispenserDivisions}}" SelectedItem="{Binding DispenserStepDivision,UpdateSourceTrigger=PropertyChanged}"> + <ComboBox.ItemContainerStyle> + <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> + <Setter Property="Background" Value="#ECECEC"></Setter> + </Style> + </ComboBox.ItemContainerStyle> + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="MAX NL / CM"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding LiquidMaxNanoliterPerCentimeter,Mode=OneWay,StringFormat='0.0'}"></Run> + <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="VOLUME"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding Volume,StringFormat='0.0'}"></Run> + <Run Text="%" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="FORMULA"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding IdsPack.IdsPackFormula.Name}"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="NL / CM"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding NanoliterPerCentimeter,Mode=OneWay,StringFormat='0.0'}"></Run> + <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="NL / SEC"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center"> + <Run Text="{Binding NanoliterPerSecond,Mode=OneWay,StringFormat='0.0'}"></Run> + <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="PULSE / SEC"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Label VerticalAlignment="Center"> + <Label.Style> + <Style TargetType="Label"> + <Setter Property="Content"> + <Setter.Value> + <TextBlock> + <Run Text="{Binding PulsePerSecond,Mode=OneWay,StringFormat='0.0'}"></Run> + <Run Text="(pulse)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding DispenserStepDivision}" Value="{x:Static dispensing:DispenserStepDivisions.Auto}"> + <Setter Property="Content" Value="Auto"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Label.Style> + </Label> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + <ToggleButton Margin="5" x:Name="toggleExpand" Style="{StaticResource MaterialDesignFlatToggleButton}" ToolTip="View more" HorizontalAlignment="Right" Padding="0" Width="24" Height="24" VerticalContentAlignment="Center"> + <materialDesign:PackIcon VerticalAlignment="Center"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="ArrowDown"></Setter> + <Setter Property="Margin" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked}" Value="True"> + <Setter Property="Kind" Value="ArrowUp"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </ToggleButton> + </StackPanel> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </controls:MultiSelectListBox> + </Grid> + </DockPanel> + </Grid> + </DockPanel> + </Grid> + </DockPanel> + </Grid> + </Grid> + + <Grid Height="80" Grid.Row="1"> + <DockPanel> + <Grid DockPanel.Dock="Left" VerticalAlignment="Center" Margin="20 15 0 0"> + <TextBlock FontSize="16" Margin="0 0 0 0"> + <Run FontWeight="Bold">ESTIMATED DURATION:</Run> + <Run Foreground="Black" FontSize="22" FontStyle="Italic" FontFamily="{StaticResource digital-7}" Text="{Binding EstimatedDuration,StringFormat=hh\\:mm\\:ss,TargetNullValue='00:00:00'}"></Run> + </TextBlock> + </Grid> + + <Grid DockPanel.Dock="Right" Margin="0 0 10 0"> + <StackPanel Orientation="Horizontal"> + <Button Height="60" Width="280" Command="{Binding StartJobCommand}" Click="OnJobStartClick"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="32" Height="32" Kind="ClockFast" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="18">START JOB</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <Grid Margin="0 -18 0 0"> + <Border VerticalAlignment="Center" Height="55" Margin="30 0 40 0" ClipToBounds="False"> + <Grid ClipToBounds="False"> + <ItemsControl x:Name="jobBrushList" ClipToBounds="False"> + <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="DataContext.ActiveJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="Length"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle VerticalAlignment="Bottom" Height="20"> + <Rectangle.Fill> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding> + </MultiBinding> + </Rectangle.Fill> + </Rectangle> + + <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center"> + <TextBlock FontSize="12" HorizontalAlignment="Right" Foreground="Black"> + <Run Text="{Binding Length,Mode=OneWay}"></Run> + <Run Foreground="Gray" FontSize="10" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="8" Height="8" Foreground="DimGray"> + <materialDesign:PackIcon.RenderTransform> + <RotateTransform Angle="180" /> + </materialDesign:PackIcon.RenderTransform> + </materialDesign:PackIcon> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <StackPanel Margin="-20 -5 0 0" HorizontalAlignment="Left"> + <TextBlock FontSize="12" Foreground="Black"> + <Run Text="0"></Run> + <Run Foreground="Gray" FontSize="10" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="SubdirectoryArrowRight" Width="16" Height="16" Foreground="DimGray"> + + </materialDesign:PackIcon> + </StackPanel> + + <StackPanel Margin="0 -5 -20 0" HorizontalAlignment="Right"> + <TextBlock FontSize="12" Foreground="Black"> + <Run Text="{Binding ActiveJob.Length,Mode=OneWay}"></Run> + <Run Foreground="Gray" FontSize="10" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="16" Height="16" Foreground="DimGray"> + + </materialDesign:PackIcon> + </StackPanel> + + <Border BorderBrush="Gainsboro" BorderThickness="1" VerticalAlignment="Bottom" Height="20"> + + </Border> + </Grid> + </Border> + </Grid> + </DockPanel> + </Grid> + </Grid> + </Grid> + </Grid> + </Grid> + + <Grid> + <Grid Background="#B9FFFFFF"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Width" Value="520"></Setter> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleY="1" ScaleX="0"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSideBarOpened}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleX" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleX" To="0" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Background="Transparent"> + <StackPanel> + <Expander Header="PROCESS PARAMETERS" IsExpanded="True" Background="Transparent"> + <Grid> + <Grid> + <StackPanel Orientation="Vertical" Margin="5"> + + <Border MaxHeight="200" Margin="5"> + <DockPanel> + <ComboBox Margin="0 10 0 0" ItemsSource="{Binding GroupsHistory}" SelectedItem="{Binding SelectedGroupHistory}"> + <ComboBox.ItemContainerStyle> + <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> + <Setter Property="Background" Value="#E6FFFFFF"></Setter> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </ComboBox.ItemContainerStyle> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 10"> + <TextBlock Text="{Binding Name}" FontWeight="Bold" VerticalAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding Active}" Value="True"> + <Setter Property="Foreground" Value="#FF5F5F"></Setter> + <Setter Property="FontStyle" Value="Italic"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <TextBlock Text="{Binding SaveDate}" Margin="10 0 0 0" FontStyle="Italic" Foreground="Gray" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + + </DockPanel> + </Border> + <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent" BorderThickness="0" Style="{x:Null}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding RmlProcessParametersTableGroup.ProcessParametersTables}" SelectedItem="{Binding SelectedProcessParametersTable}" IsEnabled="{Binding RmlProcessParametersTableGroup.Active}"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}"> + + </Style> + </ListBox.ItemContainerStyle> + <!--<ListBox.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ListBox.ItemsPanel>--> + <ListBox.ItemTemplate> + <DataTemplate DataType="{x:Type observables:ProcessParametersTable}"> + <Border Padding="5" CornerRadius="5" BorderThickness="1" Height="245" Margin="5"> + <Border.Style> + <Style TargetType="Border" BasedOn="{StaticResource brushStopBorder}"> + <Setter Property="BorderBrush" Value="Silver"></Setter> + <Setter Property="Opacity" Value="0.5"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,FallbackValue=False}" Value="True"> + <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter> + <Setter Property="Background" Value="#D4FFFFFF"></Setter> + <Setter Property="Opacity" Value="1"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <DockPanel> + <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> + <WrapPanel Orientation="Vertical" Margin="0 5 0 0"> + <WrapPanel.Resources> + <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"> + <Setter Property="FontSize" Value="10"></Setter> + <Setter Property="Foreground" Value="#7A7A7A"></Setter> + <Setter Property="Margin" Value="0 5 0 5"></Setter> + <Setter Property="MinWidth" Value="80"></Setter> + </Style> + + <Style TargetType="mahapps:NumericUpDown"> + <Setter Property="FontFamily" Value="{StaticResource digital-7}"></Setter> + </Style> + + <Style TargetType="ContentControl"> + <!--<Setter Property="FontFamily" Value="digital-7"></Setter>--> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ContentControl"> + <Grid> + <Border> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="BorderBrush" Value="Gainsboro"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="Padding" Value="2"></Setter> + <Setter Property="Margin" Value="5"></Setter> + <Setter Property="CornerRadius" Value="3"></Setter> + </Style> + </Border.Style> + <ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter> + </Border> + + <materialDesign:PackIcon HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 0 0 0" Width="12" Height="12" Kind="Settings"></materialDesign:PackIcon> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + + </WrapPanel.Resources> + <editors:ParameterizedEditor ParameterizedObject="{Binding}"> + <editors:ParameterizedEditor.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True" Orientation="Vertical" /> + </ItemsPanelTemplate> + </editors:ParameterizedEditor.ItemsPanel> + <editors:ParameterizedEditor.DoubleTemplate> + <DataTemplate> + <ContentControl> + <StackPanel> + <TextBlock Text="{Binding Name}" FontSize="10"></TextBlock> + <mahapps:NumericUpDown FontSize="16" Minimum="0" Margin="0 5 0 0" HideUpDownButtons="True" HorizontalContentAlignment="Center" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown> + </StackPanel> + </ContentControl> + </DataTemplate> + </editors:ParameterizedEditor.DoubleTemplate> + </editors:ParameterizedEditor> + </WrapPanel> + </DockPanel> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock Text="Active" FontWeight="Bold" FontStyle="Italic" FontSize="13" VerticalAlignment="Center"></TextBlock> + <materialDesign:PackIcon Foreground="#90E990" Kind="CheckboxBlankCircle" VerticalAlignment="Center" Margin="5 0 0 0"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Opacity" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,FallbackValue=False}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </StackPanel> + </Grid> + </Border> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + <StackPanel Margin="10 20" VerticalAlignment="Bottom" Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Height="40" Command="{Binding SaveProcessParametersCommand}" HorizontalAlignment="Left"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="ContentSave"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">SAVE PARAMETERS</TextBlock> + </StackPanel> + </Button> + <Button Height="40" Margin="10 0 0 0" Command="{Binding PushProcessParametersCommand}" HorizontalAlignment="Left"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowRightBold"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">PUSH PARAMETERS</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </StackPanel> + </Grid> + + <Grid Background="White"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding SelectedMachine,Converter={StaticResource NullObjectToBooleanConverter}}" Value="True"></Condition> + <Condition Binding="{Binding SelectedRML,Converter={StaticResource NullObjectToBooleanConverter}}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <TextBlock Foreground="#FA9292" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24">SELECT MACHINE & MEDIA</TextBlock> + </Grid> + </Grid> + </Expander> + <Expander Header="CONTROL PARAMETERS" IsExpanded="False" Background="#8EFFFFFF"> + + </Expander> + </StackPanel> + </ScrollViewer> + + <Rectangle HorizontalAlignment="Right" Stroke="#383838" VerticalAlignment="Top" Height="427"></Rectangle> + <Rectangle HorizontalAlignment="Right" Stroke="#383838" VerticalAlignment="Bottom" Height="428"></Rectangle> + </Grid> + + <Button Background="Transparent" Command="{Binding ToggleSideBarCommand}" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Center" Height="200" Width="50" Margin="0 0 -50 0"> + <Border Background="#F1F1F1" CornerRadius="0 10 10 0" BorderThickness="0 1 1 1" BorderBrush="#383838"> + <Grid> + <TextBlock Foreground="#FF7272" Text="CONFIGURATION" FontSize="16" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" HorizontalAlignment="Center"> + <TextBlock.LayoutTransform> + <RotateTransform Angle="270"></RotateTransform> + </TextBlock.LayoutTransform> + </TextBlock> + </Grid> + </Border> + </Button> + </Grid> + + <dragAndDrop:DraggingSurface x:Name="draggingSurface" /> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs new file mode 100644 index 000000000..27ea3cae8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -0,0 +1,137 @@ +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 System.Windows.Threading; +using Tango.DragAndDrop; +using Tango.Integration.Observables; +using Tango.MachineStudio.Developer.Converters; +using Tango.MachineStudio.Developer.ViewModels; + +namespace Tango.MachineStudio.Developer.Views +{ + /// <summary> + /// Interaction logic for JobView.xaml + /// </summary> + public partial class JobView : UserControl + { + private MainViewVM _vm; + private DispatcherTimer _jobBrushTimer; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(JobView), new PropertyMetadata(null)); + + public JobView() + { + InitializeComponent(); + + DraggingSurface = draggingSurface; + + this.Loaded += (x, y) => + { + _vm = DataContext as MainViewVM; + }; + + _jobBrushTimer = new DispatcherTimer(); + _jobBrushTimer.Interval = TimeSpan.FromSeconds(1); + _jobBrushTimer.Tick += _jobBrushTimer_Tick; + _jobBrushTimer.Start(); + } + + private void _jobBrushTimer_Tick(object sender, EventArgs e) + { + if (_vm != null && _vm.ActiveJob != null) + { + List<Segment> segments = new List<Segment>(); + foreach (var s in _vm.ActiveJob.Segments) + { + segments.Add(s); + + if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.Segments.IndexOf(s) != _vm.ActiveJob.Segments.Count - 1) + { + segments.Add(new Segment() + { + Length = _vm.ActiveJob.InterSegmentLength, + BrushStops = new System.Collections.ObjectModel.ObservableCollection<BrushStop>() + { + new BrushStop() + { + Color = Colors.White, + } + }, + }); + } + } + + jobBrushList.ItemsSource = segments; + } + } + + private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + UpdateGradientBrushDisplay(); + } + + private void UpdateGradientBrushDisplay() + { + if (_vm.SelectedSegment != null) + { + SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); + GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; + gradientBrush.GradientStops = stops; + } + else + { + gradientBrush.GradientStops = new GradientStopCollection(); + } + } + + private void OnBrushStopBorderDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is BrushStop) + { + _vm.OnDropBrushStop(e.Draggable.DataContext as BrushStop, e.Droppable.DataContext as BrushStop); + } + } + + private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } + + private void OnJobStartClick(object sender, RoutedEventArgs e) + { + + } + + private void HiveColorPickerControl_SelectedColorChanged(object sender, Color e) + { + UpdateGradientBrushDisplay(); + } + + private void Popup_MouseDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } + + private void OnSegmentDrop(object sender, DropEventArgs e) + { + _vm.OnDropSegment(e.Draggable.DataContext as Segment, e.Droppable.DataContext as Segment); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml new file mode 100644 index 000000000..fcb730de7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -0,0 +1,214 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Views.MachineJobSelectionView" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:global="clr-namespace:Tango.MachineStudio.Developer" + xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:observables="clr-namespace:Tango.Integration.Observables;assembly=Tango.Integration" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> + <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/> + </UserControl.Resources> + + <Grid> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="600"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Background="#B1FFFFFF"> + <StackPanel> + <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number" Margin="40 0 40 0"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + <designer:MachineView Width="600" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">EDIT</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <Grid Grid.Column="1"> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="1100" Height="700"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="50"></Image> + <TextBlock VerticalAlignment="Center" FontWeight="SemiBold" Margin="30 0 0 0" FontSize="30" FontStyle="Italic">MACHINE JOBS</TextBlock> + </StackPanel> + <Rectangle HorizontalAlignment="Stretch" Margin="0 10 0 0" VerticalAlignment="Bottom" StrokeThickness="1" Height="3"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="0.5" Color="{StaticResource AccentColor}" /> + <GradientStop Offset="1.1" Color="Transparent" /> + </LinearGradientBrush> + </Rectangle.Fill> + <Rectangle.Stroke> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="0.5" Color="White" /> + <GradientStop Offset="1" Color="Transparent" /> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + </StackPanel> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0"> + <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/> + <TextBox Width="300" materialDesign:HintAssist.Hint="Search" Text="{Binding JobFilter,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom" Margin="0 20 0 0"> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="20 0 0 0"> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF7575" BorderBrush="#FF7575" Command="{Binding RemoveJobCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Delete" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF995A" BorderBrush="#FF995A" Command="{Binding DuplicateJobCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentCopy" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">DUPLICATE</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#65C682" BorderBrush="#65C682" Command="{Binding AddJobCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Plus" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">NEW JOB</TextBlock> + </StackPanel> + </Button> + </StackPanel> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Margin="50 0 10 0" MinWidth="200" Height="60" Command="{Binding LoadJobCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock FontSize="18" VerticalAlignment="Center">LOAD JOB</TextBlock> + <materialDesign:PackIcon Margin="5 0 0 0" Kind="ChevronRight" Width="30" Height="30" /> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <Grid Margin="0 20 0 0"> + <controls:MultiSelectDataGrid Style="{StaticResource {x:Type DataGrid}}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" AutoGenerateColumns="False" Background="Transparent" ItemsSource="{Binding JobsCollectionView}" SelectedItem="{Binding SelectedMachineJob}" SelectedItemsList="{Binding SelectedJobs,Mode=TwoWay}"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="NAME" CanUserSort="True" SortMemberPath="Name"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontSize="14"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="CREATION DATE" Width="170" CanUserSort="True" SortMemberPath="CreationDate"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding CreationDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LAST MODIFIED" Width="170" CanUserSort="True" SortMemberPath="LastUpdated"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LAST RUN" Width="170" CanUserSort="True" SortMemberPath="LastRun"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding LastRun,Converter={StaticResource DateTimeUTCToShortDateTimeConverter},FallbackValue='Never',TargetNullValue='Never'}" VerticalAlignment="Center" FontSize="14"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="USER" Width="100" CanUserSort="True" SortMemberPath="User"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding User.Contact.FirstName}" VerticalAlignment="Center" FontSize="14"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LENGTH" Width="100" CanUserSort="True" SortMemberPath="Length"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock VerticalAlignment="Center" FontSize="14"> + <Run Text="{Binding Length,Mode=OneWay}"></Run> + <Run Text="m" Foreground="Gray"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + + </StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3"> + <Border.Background> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + </MultiBinding> + </Border.Background> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </controls:MultiSelectDataGrid> + </Grid> + </DockPanel> + </Grid> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml.cs new file mode 100644 index 000000000..52786a59f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.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.MachineStudio.Developer.Views +{ + /// <summary> + /// Interaction logic for MachineJobSelectionView.xaml + /// </summary> + public partial class MachineJobSelectionView : UserControl + { + public MachineJobSelectionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index cd91b007f..7a50a499e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -3,10 +3,412 @@ 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:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.Developer" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Background="#CBCBCB"> + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter"></converters:NullObjectToBooleanConverter> + <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"></converters:GreaterThanToBooleanConverter> + <converters:SmallerThanToBooleanConverter x:Key="SmallerThanToBooleanConverter"></converters:SmallerThanToBooleanConverter> + <localConverters:BrushStopToColorConverter x:Key="BrushStopToColorConverter" /> + <localConverters:BrushStopCMYKToColorConverter x:Key="BrushStopCMYKToColorConverter" /> + <localConverters:BrushStopLabToColorConverter x:Key="BrushStopLabToColorConverter" /> + <localConverters:SegmentToGradientStopsConverter x:Key="SegmentToGradientStopsConverter" /> + <localConverters:BrushStopToOffsetLimitConverter x:Key="BrushStopToOffsetLimitConverter" /> + <localConverters:JobToColumnDefinitionsConverter x:Key="JobToColumnDefinitionsConverter" /> + <localConverters:SegmentLengthToWidthConverter x:Key="SegmentLengthToWidthConverter" /> + <localConverters:SegmentToGradientStopsConverterMulti x:Key="SegmentToGradientStopsConverterMulti" /> + <localConverters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" /> + <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> + <localConverters:ObjectsNotEqualToBooleanConveter x:Key="ObjectsNotEqualToBooleanConveter" /> + <localConverters:JobProgressToPositionConverter x:Key="JobProgressToPositionConverter" /> + <localConverters:BrushStopToOffsetValueConverter x:Key="BrushStopToOffsetValueConverter" /> + <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> + + + <SolidColorBrush x:Key="SideBarBackground" Color="White"> + + </SolidColorBrush> + + <Color x:Key="dummyColor">Transparent</Color> + </UserControl.Resources> + + <Grid> - <TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">DEVLOPER MODULE</TextBlock> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <StackPanel> + <Grid Background="#202020" TextElement.Foreground="Silver"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ShowJobStatus}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Border BorderBrush="#404040" BorderThickness="0 0 0 1" Padding="20"> + <DockPanel> + <Grid DockPanel.Dock="Left" MinWidth="190" VerticalAlignment="Center" Margin="0 0 0 0"> + <StackPanel Orientation="Vertical" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ProgressBar Foreground="#FF6464" Width="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" /> + <TextBlock Margin="0 10 0 0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" FontStyle="Italic" FontWeight="DemiBold" Foreground="#FF6464" TextWrapping="Wrap"> + <Run Text="Running '"></Run> + <Run Text="{Binding RunningJob.Name}"></Run> + <Run Text="'..."></Run> + </TextBlock> + </StackPanel> + </Grid> + <StackPanel DockPanel.Dock="Right" VerticalAlignment="Center" Margin="0 20 0 0"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" FontSize="30" FontFamily="{StaticResource digital-7}" Margin="0 0 40 0" Foreground="#FF6464" Width="100" Text="{Binding RunningJobRemainingTime,StringFormat=hh\\:mm\\:ss}"></TextBlock> + + <Button Height="40" Width="170" Command="{Binding StopJobCommand}" Background="#FF6464" BorderBrush="#FF6464"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="Stop" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">STOP</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </StackPanel> + <Grid> + <Grid> + <Border Margin="0 10 0 0" VerticalAlignment="Bottom" Width="1200" BorderBrush="#404040" BorderThickness="0" ClipToBounds="False"> + <Grid ClipToBounds="False" > + + <ItemsControl ClipToBounds="False" x:Name="runningJobBrushList" ItemsSource="{Binding RunningJobSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid ClipToBounds="False"> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="Length"></Binding> + </MultiBinding> + </Grid.Width> + + <StackPanel Margin="0 0 0 0" ClipToBounds="False"> + + <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock Margin="0 0 0 0" FontSize="14" HorizontalAlignment="Right"> + <Run Text="{Binding Length,Mode=OneWay}"></Run> + <Run FontSize="12" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="12" Height="12"> + <materialDesign:PackIcon.RenderTransform> + <RotateTransform Angle="180" /> + </materialDesign:PackIcon.RenderTransform> + </materialDesign:PackIcon> + </StackPanel> + + <Rectangle Height="30" Margin="0 10 0 0" VerticalAlignment="Center"> + <Rectangle.Fill> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob.Length"></Binding> + </MultiBinding> + </Rectangle.Fill> + </Rectangle> + + <Canvas Height="30" HorizontalAlignment="Center" Width="80"> + <Label Padding="0" Margin="0"> + <Label.Style> + <Style TargetType="Label"> + <Setter Property="Content" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Started}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <TextBlock Text="{Binding RemainingTime,StringFormat=hh\\:mm\\:ss}" Foreground="#FF6464" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Margin="10" FontSize="20"></TextBlock> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Completed}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <materialDesign:PackIcon Margin="30 10 0 0" HorizontalAlignment="Center" Width="24" Height="24" Kind="Check" Foreground="#47FF00" /> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Label.Style> + </Label> + </Canvas> + </StackPanel> + + <Rectangle HorizontalAlignment="Right" Stroke="White" Margin="0 35 0 25"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <StackPanel Margin="-40 -5 0 0" HorizontalAlignment="Left"> + <TextBlock FontSize="14"> + <Run Text="0"></Run> + <Run FontSize="13" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="SubdirectoryArrowRight" Width="20" Height="20"> + + </materialDesign:PackIcon> + </StackPanel> + + <StackPanel Margin="0 -5 -40 0" HorizontalAlignment="Right"> + <TextBlock FontSize="14"> + <Run Text="{Binding RunningJob.Length,Mode=OneWay}"></Run> + <Run FontSize="13" Text="m"></Run> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="20" Height="20"> + + </materialDesign:PackIcon> + </StackPanel> + + <Border BorderBrush="#404040" BorderThickness="1" VerticalAlignment="Center" Height="30" Margin="0 11 0 0"> + + </Border> + + <Canvas x:Name="jobProgressCanvas"> + <Grid Canvas.Top="0"> + <Canvas.Left> + <MultiBinding Converter="{StaticResource JobProgressToPositionConverter}"> + <Binding Path="RunningJob" /> + <Binding Path="RunningJobProgress" /> + <Binding ElementName="jobProgressCanvas" Path="ActualWidth" /> + </MultiBinding> + </Canvas.Left> + <materialDesign:PackIcon Kind="MapMarker" Foreground="#FF6464" Width="35" Height="35" Margin="-17 0 0 0" /> + <TextBlock Margin="-11 -23 0 0" FontSize="16" Foreground="#FF6464" VerticalAlignment="Top" Height="18" Text="{Binding RunningJobProgress,StringFormat=0.0}"></TextBlock> + </Grid> + </Canvas> + </Grid> + </Border> + </Grid> + </Grid> + </DockPanel> + </Border> + + <ProgressBar IsIndeterminate="True" VerticalAlignment="Bottom" Height="3" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar> + </Grid> + + <Grid Background="#C1FFC7"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobCompleted}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Check" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Completed Successfully</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <Button Height="20" Padding="0" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + + <Grid Background="#FF8888"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobFailed}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Failed To Complete</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <!--<Button Height="40" Width="170" Command="{Binding ViewResultsCommand}" Background="#303030" BorderBrush="#202020"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="ChartLine" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">RESULTS</TextBlock> + </StackPanel> + </Button>--> + + <Button Padding="0" Height="20" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + + <Grid Background="#FFE388"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobCanceled}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Aborted By User</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <Button Padding="0" Height="20" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + </StackPanel> + + + <Grid Grid.Row="1"> + <controls:MultiTransitionControl x:Name="TransitionControl" TransitionType="Slide"> + <controls:MultiTransitionControl.Controls> + <ContentControl Tag="MachineJobSelectionView"> + <local:MachineJobSelectionView/> + </ContentControl> + <ContentControl Tag="JobView"> + <local:JobView/> + </ContentControl> + <ContentControl Tag="RunningJobView"> + <local:RunningJobView/> + </ContentControl> + </controls:MultiTransitionControl.Controls> + </controls:MultiTransitionControl> + </Grid> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs index 6ebfd9832..ab181e8dc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs @@ -12,17 +12,33 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.SharedUI; namespace Tango.MachineStudio.Developer.Views { /// <summary> - /// Interaction logic for MainView.xaml + /// Interaction logic for DeveloperView.xaml /// </summary> - public partial class MainView : UserControl + public partial class MainView : UserControl, IMainView { + private bool _loaded; + public static MainView Instance { get; set; } + public MainView() { InitializeComponent(); + Instance = this; + + Loaded += (x, y) => + { + if (!_loaded) + { + _loaded = true; + ViewAttached?.Invoke(this, this); + } + }; } + + public event EventHandler<IView> ViewAttached; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml new file mode 100644 index 000000000..30941f3dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -0,0 +1,45 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Views.RunningJobView" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.Developer" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <Grid Margin="40"> + <DockPanel> + <StackPanel Margin="0 20 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> + <materialDesign:PackIcon Kind="Settings" Width="60" Height="60" /> + <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Job Status</TextBlock> + </StackPanel> + + <Grid DockPanel.Dock="Bottom" Height="40"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 0 0"> + <Button Command="{Binding ExportToExcelCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="FileExcel"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">EXPORT TO EXCEL</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <Grid> + <DataGrid Background="Transparent" Margin="0 20 0 0" BorderThickness="1" BorderBrush="Gainsboro"> + <DataGrid.Columns> + <DataGridTextColumn Width="Auto" Header="#"/> + <DataGridTextColumn Width="200" Header="TIME STAMP"/> + <DataGridTextColumn Width="100" Header="CODE"/> + <DataGridTextColumn Width="200" Header="NAME"/> + <DataGridTextColumn Width="1*" Header="DESCRIPTION"/> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/UserControl1.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs index e5519cb7e..74ace554e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/UserControl1.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs @@ -13,14 +13,14 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace Tango.MachineStudio.Developer +namespace Tango.MachineStudio.Developer.Views { /// <summary> - /// Interaction logic for UserControl1.xaml + /// Interaction logic for RunningJobView.xaml /// </summary> - public partial class UserControl1 : UserControl + public partial class RunningJobView : UserControl { - public UserControl1() + public RunningJobView() { InitializeComponent(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config index cacd4cd77..4a6cb0526 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> @@ -8,4 +12,10 @@ </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/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config new file mode 100644 index 000000000..c3235a090 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="DeepEqual" version="1.6.0.0" targetFramework="net46" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net46" /> +</packages>
\ No newline at end of file |
