diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Printing')
4 files changed, 89 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs b/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs index 6b328e1fb..ebc77e615 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs @@ -1,4 +1,5 @@ using ColorMine.ColorSpaces; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -29,6 +30,7 @@ namespace Tango.Integration.Observables /// Gets or sets the collection of this brush stop liquid volumes. /// </summary> [NotMapped] + [JsonIgnore] public ObservableCollection<LiquidVolume> LiquidVolumes { get { return _liquidVolumes; } @@ -40,6 +42,7 @@ namespace Tango.Integration.Observables /// Gets or sets the brush stop color. /// </summary> [NotMapped] + [JsonIgnore] public Color Color { get { return _color; } @@ -66,6 +69,7 @@ namespace Tango.Integration.Observables /// Gets a value indicating whether this brush stop is the first one within its segment brush stops. /// </summary> [NotMapped] + [JsonIgnore] public bool IsFirst { get { return Segment.BrushStops.IndexOf(this) == 0; } @@ -75,6 +79,7 @@ namespace Tango.Integration.Observables /// Gets a value indicating whether this brush stop is the last one within its segment brush stops. /// </summary> [NotMapped] + [JsonIgnore] public bool IsLast { get { return Segment.BrushStops.IndexOf(this) == Segment.BrushStops.Count - 1; } @@ -84,6 +89,7 @@ namespace Tango.Integration.Observables /// Gets a value indicating whether this brush stop is not the first nor last within its segment brush stops. /// </summary> [NotMapped] + [JsonIgnore] public bool IsMiddle { get { return !IsFirst && !IsLast; } @@ -93,6 +99,7 @@ namespace Tango.Integration.Observables /// Gets this brush stop offset in meters. /// </summary> [NotMapped] + [JsonIgnore] public double OffsetMeters { get @@ -167,6 +174,20 @@ namespace Tango.Integration.Observables } } + public override BrushStop Clone() + { + BrushStop cloned = base.Clone(); + return cloned; + } + + public BrushStop Clone(Segment segment) + { + BrushStop cloned = base.Clone(); + cloned.Segment = segment; + cloned.SegmentGuid = segment.Guid; + return cloned; + } + #endregion #region Private Methods diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs index 1b479b5b9..1cc4865f2 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; @@ -36,6 +37,7 @@ namespace Tango.Integration.Observables /// Gets the total job segments length. /// </summary> [NotMapped] + [JsonIgnore] public double Length { get { return Segments.Sum(x => x.Length) + (EnableInterSegment ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); } @@ -133,8 +135,24 @@ namespace Tango.Integration.Observables base.Save(); } - #endregion + public override Job Clone() + { + Job cloned = base.Clone(); + + cloned.CreationDate = DateTime.UtcNow; + cloned.LastRun = null; + cloned.Segments = Segments.Select(x => x.Clone(cloned)).ToObservableCollection(); + + return cloned; + } + public override void DefferedDelete() + { + Segments.ToList().ForEach(x => x.DefferedDelete()); + Segments.Clear(); + base.DefferedDelete(); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs b/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs index f3e4df309..5c5b2bcb5 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +13,7 @@ namespace Tango.Integration.Printing public class LiquidVolume : ExtendedObject { private BrushStop _brushStop; + [JsonIgnore] public BrushStop BrushStop { get { return _brushStop; } @@ -19,7 +21,7 @@ namespace Tango.Integration.Printing } private Configuration _configuration; - + [JsonIgnore] public Configuration Configuration { get { return _configuration; } @@ -27,6 +29,7 @@ namespace Tango.Integration.Printing } private IdsPack _idsPack; + [JsonIgnore] public IdsPack IdsPack { get { return _idsPack; } @@ -34,6 +37,7 @@ namespace Tango.Integration.Printing } private Rml _rml; + [JsonIgnore] public Rml RML { get { return _rml; } @@ -41,6 +45,7 @@ namespace Tango.Integration.Printing } private ProcessParametersTable _processParametersTable; + [JsonIgnore] public ProcessParametersTable ProcessParametersTable { get { return _processParametersTable; } @@ -60,7 +65,7 @@ namespace Tango.Integration.Printing } private DispenserStepDivisions _dispenserStepDivision; - + [JsonIgnore] public DispenserStepDivisions DispenserStepDivision { get { return _dispenserStepDivision; } @@ -89,6 +94,11 @@ namespace Tango.Integration.Printing RaisePropertyChanged(nameof(Volume)); } + public LiquidVolume() //For XML Serialization.. + { + + } + public LiquidVolume(Configuration configuration, IdsPack idsPack, Rml rml, ProcessParametersTable processParametersTable, BrushStop brushStop) { ProcessParametersTable = processParametersTable; @@ -105,6 +115,7 @@ namespace Tango.Integration.Printing Invalidate(); } + [JsonIgnore] public double LiquidMaxNanoliterPerCentimeter { get @@ -129,6 +140,7 @@ namespace Tango.Integration.Printing } } + [JsonIgnore] public double NanoliterPerSecond { get @@ -137,6 +149,7 @@ namespace Tango.Integration.Printing } } + [JsonIgnore] public double NanoliterPerCentimeter { get @@ -145,6 +158,7 @@ namespace Tango.Integration.Printing } } + [JsonIgnore] public double PulsePerSecond { get diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs index 9d0edc092..6213240ed 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; @@ -21,6 +22,7 @@ namespace Tango.Integration.Observables private TimeSpan _remainingTime; [NotMapped] + [JsonIgnore] public TimeSpan RemainingTime { get { return _remainingTime; } @@ -29,6 +31,7 @@ namespace Tango.Integration.Observables private bool _started; [NotMapped] + [JsonIgnore] public bool Started { get { return _started; } @@ -37,12 +40,39 @@ namespace Tango.Integration.Observables private bool _completed; [NotMapped] + [JsonIgnore] public bool Completed { get { return _completed; } set { _completed = value; RaisePropertyChangedAuto(); } } + public override Segment Clone() + { + Segment cloned = base.Clone(); + + cloned.BrushStops = BrushStops.Select(x => x.Clone()).ToObservableCollection(); + + return cloned; + } + + public Segment Clone(Job job) + { + Segment cloned = base.Clone(); + cloned.BrushStops = BrushStops.Select(x => x.Clone(cloned)).ToObservableCollection(); + + cloned.Job = job; + cloned.JobGuid = job.Guid; + + return cloned; + } + + public override void DefferedDelete() + { + BrushStops.ToList().ForEach(x => x.DefferedDelete()); + BrushStops.Clear(); + base.DefferedDelete(); + } } } |
