public void InitBatchesProperties(PaintingMachineConfiguration paintingMachineConfiguration, TimeSpan bucketMovingTime) { foreach (var batch in Batches) { batch.Recipe.SetFinalColor(paintingMachineConfiguration); batch.SetTotalTime(paintingMachineConfiguration.Flow, bucketMovingTime); totalTime += batch.TotalTime; } DoPropertyChanged(nameof(TotalTime)); }
/// <summary> /// The default Constructor. /// </summary> public PaintingMachine(string ip = "0.0.0.0", int port = 0, PaintingMachineConfiguration paintingMachineConfiguration = null) { Port = port; Ip = ip; PaintingMachineConfiguration = paintingMachineConfiguration ?? new PaintingMachineConfiguration(); sender = new IPEndPoint(IPAddress.Any, 0); BatchList = new BatchList(); checkConnectionTimer = new Timer(CheckConnection, null, 0, 200); paintInjectionStopWatch = new Stopwatch(); batchProductionStopWatch = new Stopwatch(); }
public void SetFinalColor(PaintingMachineConfiguration machineConfiguration) { finalColor = Color.FromArgb(255, 255, 255, 255); //Init to white //Add A pigment for (int i = 0; i < (int)(machineConfiguration.ComputationPerSeconds * QuantityA / machineConfiguration.Flow); i++) { finalColor = StaticLib.MixColors(finalColor, machineConfiguration.ColorA); } //Add B pigment for (int i = 0; i < (int)(machineConfiguration.ComputationPerSeconds * QuantityB / machineConfiguration.Flow); i++) { finalColor = StaticLib.MixColors(finalColor, machineConfiguration.ColorB); } //Add C pigment for (int i = 0; i < (int)(machineConfiguration.ComputationPerSeconds * QuantityC / machineConfiguration.Flow); i++) { finalColor = StaticLib.MixColors(finalColor, machineConfiguration.ColorC); } //Add D pigment for (int i = 0; i < (int)(machineConfiguration.ComputationPerSeconds * QuantityD / machineConfiguration.Flow); i++) { finalColor = StaticLib.MixColors(finalColor, machineConfiguration.ColorD); } }