using System; using System.Drawing; using System.Globalization; using System.Threading; using Logic.ProductionToProductMapper.Cordonel; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts; using Xylem.Common.Ui.CordonelPreadjustmentUi; using System.Collections.Generic; using Xylem.Common.Logic.ProductionOrderCore.OrderData; using Xylem.Common.Ui.CordonelPreadjustmentUi.Parameters; namespace CordonelPreadjustmentUi.Processes.Itinerary { public class EventArgsMeterSuccsessfull : EventArgs { public EventArgsMeterSuccsessfull(List v) { Value = v; } public readonly List Value; } public class EventArgsFlushRequest : EventArgs { public EventArgsFlushRequest(FlushParams v) { Value = v; } public readonly FlushParams Value; } public class EventArgsDecimal : EventArgs { public EventArgsDecimal(decimal v) { Value = v; } public readonly decimal Value; } public class EventArgsBool : EventArgs { public EventArgsBool(bool v) { Value = v; } public readonly bool Value; } public class EventArgsMeterSize : EventArgs { public EventArgsMeterSize(MeterSize v) { Value = v; } public readonly MeterSize Value; } public class EventArgsString : EventArgs { public EventArgsString(string v) { Value = v; } public readonly string Value; } public class EventArgsDebug : EventArgs { public EventArgsDebug(string v, string source = "", int? slot = null, string pcbID = "") { Value = v; Slot = slot; Source = source; PcbId = pcbID; } public readonly string Value; public readonly string Source; public readonly string PcbId; public readonly int? Slot; } public class ProcessProgress { public String[] Passwords; public String[] ThermoPasswords; public Boolean[] MeterEnable; public Boolean[] ThermoEnable; public Boolean StopSequence; public Boolean Aborted; public Boolean[] AllOk; public Boolean[] MeterOk; public Boolean[] ThermoOk; public CancellationTokenSource CancellationSource = new CancellationTokenSource(); public event EventHandler OnBubblesChanged; public event EventHandler OnRequestTempretureSelection; public void RequestTempretureSelection() { if (OnRequestTempretureSelection == null) { TempretureSelected = true; return; } OnRequestTempretureSelection.Invoke(this, new EventArgsBool(true)); } public event EventHandler OnStatusLabelChanged; public event EventHandler OnDebugMessageChanged; public event EventHandler OnForceFailedMessage; public event EventHandler OnRequestFlush; public event EventHandler OnRequestTemperatur; public Image Logo { get; internal set; } private bool bubbles; public bool Bubbles { get { return bubbles;} internal set { bubbles = value; OnBubblesChanged?.Invoke(this,new EventArgsBool(value)); } } internal bool CheckForCancellation(MeterStateControl meterctl = null) { if (CancellationSource.IsCancellationRequested) { return CancellationSource.IsCancellationRequested; } if (meterctl == null) { return false; } if (!meterctl.IsEnabled) { return true; } //no CancellationRequested and meter state was request but it is enbaled return false; } private string statusLabel; public string StatusLabel { get { return statusLabel; } internal set { statusLabel = value; OnStatusLabelChanged?.Invoke(this, new EventArgsString(value)); } } internal PreAdjustmentSettingsContainer Setting { get; set; } public bool IsBusy { get; internal set; } public bool TempretureSelected { get; internal set; } public bool FlushDone { get; internal set; } public bool IsAutomaticMode { get; internal set; } public double? PushedTestBenchTemp { get; internal set; } = null; #region UI Actions public void ForceFailedMessage() { OnForceFailedMessage?.Invoke(this,EventArgs.Empty); } public void RequestFlush(MeterSize size) { FlushDone = false; OnRequestFlush?.Invoke(this, new EventArgsMeterSize(size)); } public void RequestTemperatur() { OnRequestTemperatur?.Invoke(this, EventArgs.Empty); } internal void GenerateReturnNote(string v, MeterStateControl meterctl) { GenerateReport.GenerateReturnNote(meterctl.Slot, meterctl.Meter.PcbId, v, meterctl.GetLog(), Setting.Culture, Logo); } public void DebugMessage(string msg, int? slot = null, string source = "APP", string PcbID = "") { OnDebugMessageChanged?.Invoke(this, new EventArgsDebug(msg,source,slot, PcbID)); } #endregion } }