2129 lines
81 KiB
C#
2129 lines
81 KiB
C#
|
|
using CordonelPreadjustmentUi.Processes;
|
|||
|
|
using CordonelPreadjustmentUi.Processes.Actions;
|
|||
|
|
using CordonelPreadjustmentUi.Processes.Itinerary;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
|||
|
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
|||
|
|
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
|||
|
|
using Xylem.Common.Ui.CordonelPreadjustmentUi;
|
|||
|
|
using Xylem.Common.Ui.CordonelPreadjustmentUi.Parameters;
|
|||
|
|
using CordonelPreadjustmentUi;
|
|||
|
|
|
|||
|
|
namespace GenesisCordonelInterface.UI
|
|||
|
|
{
|
|||
|
|
public partial class PreAdjustmentControl : UserControl
|
|||
|
|
{
|
|||
|
|
private ProcessProgress pp = new ProcessProgress();
|
|||
|
|
private PreAdjustmentSettingsContainer settings = new PreAdjustmentSettingsContainer();
|
|||
|
|
|
|||
|
|
|
|||
|
|
private List<MeterStateControl> MeterStateCtls = new List<MeterStateControl>();
|
|||
|
|
private List<MeterStateControl> TempMeterStateCtls = new List<MeterStateControl>();
|
|||
|
|
|
|||
|
|
private List<MeterStateControl> AllMeterStateCtrls()
|
|||
|
|
{
|
|||
|
|
var r = new List<MeterStateControl>();
|
|||
|
|
r.AddRange(MeterStateCtls);
|
|||
|
|
r.AddRange(TempMeterStateCtls);
|
|||
|
|
return r;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private MeterBatch GlobalMeterBatch = new MeterBatch();
|
|||
|
|
private MeterBatch ThermoMeterBatch = new MeterBatch();
|
|||
|
|
private Boolean abortIndicator = false;
|
|||
|
|
public Boolean AbortIndicator { get { return abortIndicator; } set { abortIndicator = value; } }
|
|||
|
|
public int TestRunNumber;
|
|||
|
|
public PreAdjustmentControl(PreAdjustmentSettingsContainer Settings = null)
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
SetSettings(Settings);
|
|||
|
|
rTB_ZeroFlowCal.AutoSize = true;
|
|||
|
|
}
|
|||
|
|
public void SetSettings(PreAdjustmentSettingsContainer Settings = null)
|
|||
|
|
{
|
|||
|
|
settings = Settings;
|
|||
|
|
if (settings != null)
|
|||
|
|
{
|
|||
|
|
PreAdjustmentControl_Load(this, EventArgs.Empty);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void PreAdjustmentControl_Load(object sender, System.EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
MeterStateCtls = new List<MeterStateControl>();
|
|||
|
|
TempMeterStateCtls = new List<MeterStateControl>();
|
|||
|
|
if (settings != null)
|
|||
|
|
{
|
|||
|
|
gB_Meters.Controls.Clear();
|
|||
|
|
gB_TempMeters.Controls.Clear();
|
|||
|
|
gB_TempMeters.Controls.Add(this.btn_StoreTempe);
|
|||
|
|
var tmpI = 1;
|
|||
|
|
foreach (var Meter in settings.Meters)
|
|||
|
|
{
|
|||
|
|
var ctl = new MeterStateControl(Meter);
|
|||
|
|
ctl.Location = new Point(5 + ((tmpI - 1) * ctl.Width), 15);
|
|||
|
|
MeterStateCtls.Add(ctl);
|
|||
|
|
gB_Meters.Controls.Add(ctl);
|
|||
|
|
ctl.OnRequestDetails += Ctl_MouseEnter;
|
|||
|
|
tmpI = tmpI + 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tmpI = 1;
|
|||
|
|
if (settings.TempMeters.Any() && settings.GetTempUseTempFlansh())
|
|||
|
|
{
|
|||
|
|
foreach (var tempMeter in settings.TempMeters)
|
|||
|
|
{
|
|||
|
|
var ctl = new TempMeterStateControl(tempMeter);
|
|||
|
|
ctl.Location = new Point(5 + ((tmpI - 1) * ctl.Width), 15);
|
|||
|
|
TempMeterStateCtls.Add(ctl);
|
|||
|
|
gB_TempMeters.Controls.Add(ctl);
|
|||
|
|
ctl.OnRequestDetails += Ctl_MouseEnter;
|
|||
|
|
ctl.DoubleClick += Clt_ReConnect;
|
|||
|
|
tmpI = tmpI + 1;
|
|||
|
|
ctl.Enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
var ctl = new TempMeterStateControl("Input");
|
|||
|
|
ctl.Location = new Point(5 + ((tmpI - 1) * ctl.Width), 15);
|
|||
|
|
ctl.SetChecked(true);
|
|||
|
|
TempMeterStateCtls.Add(ctl);
|
|||
|
|
gB_TempMeters.Controls.Add(ctl);
|
|||
|
|
//ctl.DoubleClick += Ctl_MouseEnter;
|
|||
|
|
tmpI = tmpI + 1;
|
|||
|
|
ctl.Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
cb_Metersize.Items.Clear();
|
|||
|
|
foreach (MeterSize size in (MeterSize[])Enum.GetValues(typeof(MeterSize)))
|
|||
|
|
{
|
|||
|
|
cb_Metersize.Items.Add(size);
|
|||
|
|
}
|
|||
|
|
var setM = MeterSize.DN50;
|
|||
|
|
if (settings?.MeterSize != null)
|
|||
|
|
{
|
|||
|
|
setM = settings.MeterSize;
|
|||
|
|
}
|
|||
|
|
cb_Metersize.SelectedItem = setM;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void Ctl_MouseLeave(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void Ctl_MouseEnter(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (sender is MeterStateControl meterStateCtl)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<object, EventArgs>)Ctl_MouseEnter, sender, e);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
rTB_ZeroFlowCalMeter.Text = meterStateCtl.GetLog();
|
|||
|
|
gB_MeterLog.Text = $"Log for Meter {meterStateCtl.Slot}:";
|
|||
|
|
rTB_ZeroFlowCal.Visible = false;
|
|||
|
|
gB_MeterLog.Visible = true;
|
|||
|
|
rTB_ZeroFlowCalMeter.ScrollToCaret();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void Clt_ReConnect(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (sender is TempMeterStateControl meterStateCtl)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<object, EventArgs>)Clt_ReConnect, sender, e);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
meterStateCtl.StartTempWatch(meterStateCtl.MeterTempMode);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetTestBenchTemp(double temp)
|
|||
|
|
{
|
|||
|
|
if (pp != null)
|
|||
|
|
{
|
|||
|
|
pp.PushedTestBenchTemp = temp;
|
|||
|
|
pp.TempretureSelected = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void SetFlushIsDone()
|
|||
|
|
{
|
|||
|
|
if (pp != null)
|
|||
|
|
{
|
|||
|
|
pp.FlushDone = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//todo move out
|
|||
|
|
#region move out
|
|||
|
|
|
|||
|
|
private static class Formats
|
|||
|
|
{
|
|||
|
|
#region Format strings for display
|
|||
|
|
#region Format strings for "Decoded Data"-display
|
|||
|
|
public const String TofDispString = "000000.00000000";
|
|||
|
|
public const String HccCorrectionValue = "0.00000";
|
|||
|
|
public const String PwDispString = "0.00";
|
|||
|
|
public const String AmpDispUpString = "000.0";
|
|||
|
|
public const String AmpDispDownString = "-000.0";
|
|||
|
|
public const String TempDispString = "0.00";
|
|||
|
|
public const String Flow = "0.00";
|
|||
|
|
#endregion
|
|||
|
|
#region Format strings for "Mean"-Display
|
|||
|
|
public const String MeanDispString = "0.00";
|
|||
|
|
#endregion
|
|||
|
|
#region Format strings for "Std-Deviation"-Display
|
|||
|
|
public const String StdDevDispString = "0.00";
|
|||
|
|
#endregion
|
|||
|
|
#endregion
|
|||
|
|
#region Format strings for CSV-Logging
|
|||
|
|
public const String TofLogString = "000000.00000000";
|
|||
|
|
public const String PwLogString = "0.00";
|
|||
|
|
public const String AmpLogString = "000.0";
|
|||
|
|
public const String TempLogString = "0.00";
|
|||
|
|
public const String CsvDateTimeLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
|||
|
|
public const String ErrorLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
|||
|
|
public const String RawDataDateTimeLogString = "yyyy-MM-dd HH:mm:ss:ff ";
|
|||
|
|
public const String CsvIndexLogString = "{0:D8}";
|
|||
|
|
public const String CsvFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|||
|
|
public const String TxtFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|||
|
|
public const String LogFileDateTimeString = "yyyyMMdd_HHmmss";
|
|||
|
|
public const String HeaderFileDateTimeString = "yyyy-MM-dd HH:mm:ss";
|
|||
|
|
public const String StatusDateTimeString = "HH:mm:ss";
|
|||
|
|
#endregion
|
|||
|
|
#region Date/ Time for raw file naming
|
|||
|
|
public const String RawFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|||
|
|
#endregion
|
|||
|
|
#region Date/ Time for image files naming
|
|||
|
|
public const String ImageFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|||
|
|
#endregion
|
|||
|
|
#region Date/ Time for reports
|
|||
|
|
public const String ReportDateTimeTitleString = "yyyy-MM-dd";
|
|||
|
|
public const String PdfDateTimeString = "yyyyMMdd_HHmmss_";
|
|||
|
|
#endregion
|
|||
|
|
#region Format for GP30 first hit level adjustments
|
|||
|
|
public const String FirstHitLevelVoltage = "000.00";
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool GetMeterIsDone(int slot)
|
|||
|
|
{
|
|||
|
|
var meter = AllMeterStateCtrls().First(m => m.Slot == slot);
|
|||
|
|
if (meter != null)
|
|||
|
|
{
|
|||
|
|
return !meter.Failed;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void CloseConnections()
|
|||
|
|
{
|
|||
|
|
GlobalMeterBatch?.RemoveAllMeters();
|
|||
|
|
ThermoMeterBatch?.RemoveAllMeters();
|
|||
|
|
GlobalMeterBatch?.Dispose();
|
|||
|
|
ThermoMeterBatch?.Dispose();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void EnableMeter(int slot, bool enabled, string srn)
|
|||
|
|
{
|
|||
|
|
var meter = AllMeterStateCtrls().First(m => m.Slot == slot);
|
|||
|
|
if (meter != null)
|
|||
|
|
{
|
|||
|
|
meter.SetChecked(enabled);
|
|||
|
|
meter.Srn = srn;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public StringBuilder proccessLog = new StringBuilder();
|
|||
|
|
|
|||
|
|
public void DebugMessage(Exception exception, int? slot = null, String source = "APP", String PcbId = "")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DebugMessage($"Exception at full process: { exception.Message}\t{Environment.NewLine}", slot, source, PcbId);
|
|||
|
|
|
|||
|
|
|
|||
|
|
var stringBuilder = new StringBuilder();
|
|||
|
|
|
|||
|
|
while (exception != null)
|
|||
|
|
{
|
|||
|
|
stringBuilder.Append(exception.ToString());
|
|||
|
|
stringBuilder.AppendLine();
|
|||
|
|
exception = exception.InnerException;
|
|||
|
|
}
|
|||
|
|
DebugMessage(stringBuilder.ToString(), slot, source, PcbId);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public void DebugMessage(String text = "", int? slot = null, String source = "APP", String PcbId = "")
|
|||
|
|
{
|
|||
|
|
// Add line and scroll to caret
|
|||
|
|
if (!String.IsNullOrEmpty(text))
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<String, int?, String, String>)DebugMessage, text, slot, source, PcbId);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string mainMsg = "";
|
|||
|
|
string Timestamp = DateTime.Now.ToString(Formats.StatusDateTimeString, settings.Culture);
|
|||
|
|
mainMsg = $"\t {source} \t{text}";
|
|||
|
|
if (slot.HasValue)
|
|||
|
|
{
|
|||
|
|
mainMsg = $"{mainMsg} at Meter {slot.Value}";
|
|||
|
|
if (!string.IsNullOrEmpty(PcbId))
|
|||
|
|
{
|
|||
|
|
mainMsg = $"{mainMsg} ({PcbId})";
|
|||
|
|
}
|
|||
|
|
AllMeterStateCtrls()?.Where(e => e.Enabled && e.Slot == slot.Value).ToList().ForEach(l => l.Log($"{ Timestamp} { mainMsg}"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AllMeterStateCtrls()?.Where(e => e.Enabled).ToList().ForEach(l => l.Log($"{ Timestamp} { mainMsg}"));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
proccessLog?.AppendLine($"{Timestamp} {mainMsg}");
|
|||
|
|
|
|||
|
|
rTB_ZeroFlowCal?.AppendText($"{Timestamp} {mainMsg} {Environment.NewLine}");
|
|||
|
|
rTB_ZeroFlowCal?.ScrollToCaret();
|
|||
|
|
|
|||
|
|
|
|||
|
|
//log
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//public void DebugMessage(String text)
|
|||
|
|
//{
|
|||
|
|
// // Add line and scroll to caret
|
|||
|
|
// if (!String.IsNullOrEmpty(text))
|
|||
|
|
// {
|
|||
|
|
// if (this.InvokeRequired)
|
|||
|
|
// {
|
|||
|
|
// this.Invoke((Action<String>)DebugMessage, text);
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// String Timestamp = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, settings.Culture);
|
|||
|
|
// rTB_ZeroFlowCal.AppendText($"{Timestamp}\t{text}");
|
|||
|
|
// rTB_ZeroFlowCal.ScrollToCaret();
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
public void SetBusy(bool isBusy)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
Invoke((Action<bool>)SetBusy, isBusy);
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pB_Bubbles1.Visible = isBusy;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void AbortButtonEnabled(bool v)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
Invoke((Action<bool>)AbortButtonEnabled, v);
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
btn_ZeroFlowCal_Abort.Enabled = v;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void ZeroFlowCalDetectSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_Detect.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalAmplitudeSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_Amplitude.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalPrepareSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_Prepare.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalOffsetSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_Offset.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalCompletionSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_Completion.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalTempCalSetBackColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.p_ZeroFlowCal_TempCal.BackColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalDetectSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_Detect.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalAmplitudeSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_Amplitude.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalPrepareSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_Prepare.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalOffsetSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_Offset.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalCompletionSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_Completion.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
public void ZeroFlowCalTempCalSetLabelColor(Color color)
|
|||
|
|
{
|
|||
|
|
this.l_ZeroFlowCal_TempCal.ForeColor = color;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public enum StatusPanelItems
|
|||
|
|
{
|
|||
|
|
None = 0,
|
|||
|
|
Detect = 1,
|
|||
|
|
Prepare = 2,
|
|||
|
|
Amplitude = 3,
|
|||
|
|
Offset = 4,
|
|||
|
|
Completion = 5,
|
|||
|
|
TempCal = 6,
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetProgressPanel(StatusPanelItems item)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<StatusPanelItems>)SetProgressPanel, item);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
switch (item)
|
|||
|
|
{
|
|||
|
|
case StatusPanelItems.None:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.Detect:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Black);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.Prepare:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Black);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.Amplitude:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Black);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.Offset:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Black);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.Completion:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Black);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case StatusPanelItems.TempCal:
|
|||
|
|
this.ZeroFlowCalDetectSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalPrepareSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalTempCalSetBackColor(Color.LightGreen);
|
|||
|
|
this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalTempCalSetLabelColor(Color.Black);
|
|||
|
|
this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
default:
|
|||
|
|
//this.ZeroFlowCalDetectSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalPrepareSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalAmplitudeSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalOffsetSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalCompletionSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalTempCalSetBackColor(Color.Gainsboro);
|
|||
|
|
//this.ZeroFlowCalDetectSetLabelColor(Color.Gray);
|
|||
|
|
//this.ZeroFlowCalPrepareSetLabelColor(Color.Gray);
|
|||
|
|
//this.ZeroFlowCalAmplitudeSetLabelColor(Color.Gray);
|
|||
|
|
//this.ZeroFlowCalOffsetSetLabelColor(Color.Gray);
|
|||
|
|
//this.ZeroFlowCalCompletionSetLabelColor(Color.Gray);
|
|||
|
|
//this.ZeroFlowCalTempCalSetLabelColor(Color.Gray);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
WaitNSeconds(2);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetControlElements(Boolean enabled)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<Boolean>)SetControlElements, enabled);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.pB_Bubbles1.Visible = !enabled;
|
|||
|
|
this.btn_ZeroFlowCal_Detect.Enabled = enabled;
|
|||
|
|
foreach (var MeterStateCtl in MeterStateCtls)
|
|||
|
|
{
|
|||
|
|
//MeterStateCtl.Enabled = enabled;
|
|||
|
|
}
|
|||
|
|
foreach (var TempMeterStateCtl in TempMeterStateCtls)
|
|||
|
|
{
|
|||
|
|
//TempMeterStateCtl.Enabled = enabled;
|
|||
|
|
}
|
|||
|
|
this.btn_ZeroFlowCal_Pdf.Enabled = enabled;
|
|||
|
|
this.btn_ZeroFlowCal_Save.Enabled = enabled;
|
|||
|
|
this.btn_ZeroFlowCal_Clear.Enabled = enabled;
|
|||
|
|
btn_ZeroFlowCal_Abort.Enabled = !enabled;
|
|||
|
|
this.cB_AmplitudeTestEnable.Enabled = enabled;
|
|||
|
|
this.cB_TempCalEnable.Enabled = enabled;
|
|||
|
|
this.cB_ZeroFlowOffsetTestEnable.Enabled = enabled;
|
|||
|
|
}
|
|||
|
|
public void StatusLabel(String debugMessage)
|
|||
|
|
{
|
|||
|
|
// Add line and scroll to caret
|
|||
|
|
if (!String.IsNullOrEmpty(debugMessage))
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<String>)StatusLabel, debugMessage);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.l_ZeroFlowCal_Status.Text = debugMessage;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void SetControlText(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<CultureInfo>)SetControlText, culture);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//todo langureage setup
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
//this.l_ZeroFlowCal_Meter1.Text = "ZÄHLER1";
|
|||
|
|
//this.l_ZeroFlowCal_Meter2.Text = "ZÄHLER2";
|
|||
|
|
//this.l_ZeroFlowCal_Meter3.Text = "ZÄHLER3";
|
|||
|
|
//this.l_ZeroFlowCal_Meter4.Text = "ZÄHLER4";
|
|||
|
|
//this.l_ZeroFlowCal_Meter5.Text = "ZÄHLER5";
|
|||
|
|
//this.l_ZeroFlowCal_Meter6.Text = "ZÄHLER6";
|
|||
|
|
//this.l_ZeroFlowCal_Meter7.Text = "ZÄHLER7";
|
|||
|
|
//this.l_ZeroFlowCal_Meter8.Text = "ZÄHLER8";
|
|||
|
|
//this.l_ZeroFlowCal_Meter9.Text = "ZÄHLER9";
|
|||
|
|
//this.l_ZeroFlowCal_Meter10.Text = "ZÄHLER10";
|
|||
|
|
|
|||
|
|
//this.l_ZeroFlowCal_Detect.Text = "DETEKT";
|
|||
|
|
//this.l_ZeroFlowCal_Prepare.Text = "RÜSTEN";
|
|||
|
|
//this.l_ZeroFlowCal_Amplitude.Text = "AMPLITUDEN\nTEST";
|
|||
|
|
//this.l_ZeroFlowCal_TempCal.Text = "TEMPERATUR\nKALIBRIERUNG";
|
|||
|
|
//this.l_ZeroFlowCal_Completion.Text = "ABSCHLUSS";
|
|||
|
|
//this.l_ZeroFlowCal_Resttime.Text = "Geschätzte Restzeit ";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter1.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter2.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter3.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter4.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter5.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter6.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter7.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter8.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter9.Text = "aktiv";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter10.Text = "aktiv";
|
|||
|
|
//this.btn_ZeroFlowCal_Save.Text = "speichern";
|
|||
|
|
//this.btn_ZeroFlowCal_Clear.Text = "löschen";
|
|||
|
|
//this.btn_ZeroFlowCal_Detect.Text = "DETEKT";
|
|||
|
|
//this.l_ZeroFlowCal_Status.Text = "'DETEKT'-Taste drücken";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//this.l_ZeroFlowCal_Meter1.Text = "METER1";
|
|||
|
|
//this.l_ZeroFlowCal_Meter2.Text = "METER2";
|
|||
|
|
//this.l_ZeroFlowCal_Meter3.Text = "METER3";
|
|||
|
|
//this.l_ZeroFlowCal_Meter4.Text = "METER4";
|
|||
|
|
//this.l_ZeroFlowCal_Meter5.Text = "METER5";
|
|||
|
|
//this.l_ZeroFlowCal_Meter6.Text = "METER6";
|
|||
|
|
//this.l_ZeroFlowCal_Meter7.Text = "METER7";
|
|||
|
|
//this.l_ZeroFlowCal_Meter8.Text = "METER8";
|
|||
|
|
//this.l_ZeroFlowCal_Meter9.Text = "METER9";
|
|||
|
|
//this.l_ZeroFlowCal_Meter10.Text = "METER10";
|
|||
|
|
//this.l_ZeroFlowCal_Detect.Text = "DETECT";
|
|||
|
|
//this.l_ZeroFlowCal_Prepare.Text = "PREPARE";
|
|||
|
|
//this.l_ZeroFlowCal_Amplitude.Text = "AMPLITUDE\nTEST";
|
|||
|
|
//this.l_ZeroFlowCal_TempCal.Text = "TEMPERATURE\nCALIBRATION";
|
|||
|
|
//this.l_ZeroFlowCal_Completion.Text = "COMPLETION";
|
|||
|
|
//this.l_ZeroFlowCal_Resttime.Text = "Estimated time to finish: ";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter1.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter2.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter3.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter4.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter5.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter6.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter7.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter8.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter9.Text = "enable";
|
|||
|
|
//this.cB_ZeroFlowCal_EnableMeter10.Text = "enable";
|
|||
|
|
//this.btn_ZeroFlowCal_Save.Text = "Save";
|
|||
|
|
//this.btn_ZeroFlowCal_Clear.Text = "Clear";
|
|||
|
|
//this.btn_ZeroFlowCal_Detect.Text = "DETECT";
|
|||
|
|
//this.l_ZeroFlowCal_Status.Text = "Press 'DETECT'";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static void WaitNSeconds(Int32 seconds, bool fromGui = false)
|
|||
|
|
{
|
|||
|
|
fromGui = true;
|
|||
|
|
if (fromGui)
|
|||
|
|
{
|
|||
|
|
if (seconds < 1)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
TimeSpan ts = new TimeSpan();
|
|||
|
|
DateTime _desired = DateTime.Now.AddSeconds(seconds);
|
|||
|
|
while (DateTime.Now < _desired)
|
|||
|
|
{
|
|||
|
|
Application.DoEvents();
|
|||
|
|
Thread.Sleep(100);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Thread.Sleep(seconds * 1000);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool isAutomaticMode = false;
|
|||
|
|
public void AutoStart()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
isAutomaticMode = true;
|
|||
|
|
|
|||
|
|
btn_ZeroFlowCal_Detect_Click(null, EventArgs.Empty);
|
|||
|
|
if (detectState == false)
|
|||
|
|
{
|
|||
|
|
throw new ApplicationException("Detect failed");
|
|||
|
|
}
|
|||
|
|
if (settings.MeterSize != MeterSize.NA)
|
|||
|
|
{
|
|||
|
|
btn_ZeroFlowCal_Start_Click(null, EventArgs.Empty);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//OnIsDone?.Invoke(null, EventArgs.Empty);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
var r = ShowMsg($"{ex.Message} {Environment.NewLine} Retry?", "Retry?", MessageBoxButtons.RetryCancel);
|
|||
|
|
|
|||
|
|
if (r == DialogResult.Retry)
|
|||
|
|
{
|
|||
|
|
AutoStart();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OnAbort?.Invoke(null, new EventArgsMeterSuccsessfull(new List<int>()));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public DialogResult ShowMsg(string text, string caption = "no caption", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information, bool OverrideAutomatic = false, bool WaitForResponse = true)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (!isAutomaticMode || OverrideAutomatic)
|
|||
|
|
{
|
|||
|
|
if (WaitForResponse)
|
|||
|
|
{
|
|||
|
|
return MessageBox.Show(text, caption, buttons, icon);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//new Task(() => { new MsgBox(caption, text).Show(); }).Start();
|
|||
|
|
return DialogResult.OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return DialogResult.OK;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static class PredefinedMessages
|
|||
|
|
{
|
|||
|
|
#region Miscellaneous
|
|||
|
|
public static String StorageFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Speichern fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Storage failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String MeterSequenceFailed(String sequenceName, String MeterIndex, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = $"{sequenceName} fehlgeschlagen bei ZÄHLER{MeterIndex}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = $"{sequenceName} failed at METER{MeterIndex}";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String AreYouSure(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Sind Sie sicher?";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Are you sure?";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String PressDetect(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'DETEKT'-Taste drücken";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Press 'DETECT'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitDetect(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'DETEKT' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'DETECTION' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitSeconds(Int32 seconds, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
String Time = seconds.ToString(culture);
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = $"Wartezeit {Time} Sekunden";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = $"Wait {Time} seconds";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String DetectFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'DETEKT' fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'DETECT' failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String PressStartOrDetect(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'START'-Taste drücken oder 'DETEKT' wiederholen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Press 'START' or repeat 'DETECT'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String NoMeterSelected(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Keinen ZÄHLER ausgewählt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "No METER selected";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String NoMeterPresent(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Kein ZÄHLER bereit";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "No METER present";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String NoThermometerPresent(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Kein THERMOMETER bereit";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "No THERMOMETER present";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilTemperatureAcquisitionFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Temperaturakquirierung beendet ist";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until temperature acquisition finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilTemperatureCalibrationFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Temperaturkalibrierung beendet ist";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until temperature calibration finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilFlushFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Spülvorgang beendet ist";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until flushing pipe is finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String NoThermometerSelected(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Kein Thermometer ausgewählt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "No THERMOMETER selected";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitForStabilization(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Werte stabil: ";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait for stabilization: ";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region Empty pipe mode
|
|||
|
|
public static String WaitForEmptyPipe(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'EMPTY PIPE'-Modus beendet: ";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait for leaving 'EMPTY PIPE' mode: ";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String EmptyPipeFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'EMPTY PIPE'-check fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'EMPTY PIPE'-check failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region LOGIN
|
|||
|
|
public static String WaitUntilLoginFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'LOGIN' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'LOGIN' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String LoginFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'LOGIN'-fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'LOGIN'-failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region PREPARATION
|
|||
|
|
public static String WaitUntilPreparationFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'RÜSTEN' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'PREPARE' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String PreparationFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'RÜSTEN' fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'PREPARE' failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String PreparationStopped(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'RÜSTEN' gestoppt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'PREPARE' stopped";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region AMPLITUDE TEST
|
|||
|
|
public static String WaitUntilAmplitudeTestFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis AMPLITUDENTEST beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until AMPLITUDE TEST has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilRegisterWriteFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Schreiben auf Register beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until register write has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilRegisterReadFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Lesen vom Register beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until register read has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilPercentageSweepFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Messung beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait for percentage sweep to end:";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String WaitUntilAmplitudeFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'AMPLITUDENTEST' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'AMPLITUDE TEST' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String AmplitudeFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'AMPLITUDENTEST' fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'AMPLITUDE TEST' failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String AmplitudeStopped(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'AMPLITUDENTEST' gestoppt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'AMPLITUDE TEST' stopped";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region ZEROFLOW OFFSET TEST
|
|||
|
|
public static String WaitUntilZeroflowOffsetTestFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'OFFSET TEST' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'OFFSET TEST' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowOffsetAqqFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis Datenaufnahme beendet:";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until data aquisition has finished:";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowOffsetTestFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW OFFSET TEST' fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW OFFSET TEST' failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowOffsetTestStopped(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW OFFSET TEST' gestoppt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW OFFSET TEST' stopped";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowOffsetWaitForSettling(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Beruhigungszeit abwarten: ";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait for settling time: ";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region TEMPERATURE CALIBRATION
|
|||
|
|
public static String TempCalFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "TEMPERATUR KALIBRIERUNG fehlgeschlagen bei ZÄHLER";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "TEMPERATURE CALIBRATION failed at METER";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region COMPLETION
|
|||
|
|
public static String WaitUntilCompletionFinished(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "Warten bis 'ABSCHLUSS' beendet";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "Wait until 'COMPLETION' has finished";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String CompletionStopped(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ABSCHLUSS' gestoppt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'COMPLETION' stopped";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String CompletionFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ABSCHLUSS' fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'COMPLETION' failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region ZEROFLOW CALIBRATION SEQUENCE
|
|||
|
|
public static String ZeroflowCalibrationSequenceStopped(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW KALIBRIERUNGS'-Sequenz gestoppt";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW CALIBRATION' sequence stopped";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowCalibrationSequenceFailed(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW KALIBRIERUNGS'-Sequenz fehlgeschlagen";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW CALIBRATION' sequence failed";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
public static String ZeroflowCalibrationSequenceSuccessful(CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
String Message = String.Empty;
|
|||
|
|
|
|||
|
|
if (culture.Name == "de-DE")
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW KALIBRIERUNGS'-Sequenz erfolgreich";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Message = "'ZEROFLOW CALIBRATION' sequence successful";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Message;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private bool detectState = true;
|
|||
|
|
private void btn_ZeroFlowCal_Detect_Click(object sender, System.EventArgs e)
|
|||
|
|
{
|
|||
|
|
detectState = true;
|
|||
|
|
CultureInfo Culture = settings.Culture;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
btn_ZeroFlowCal_Detect.Enabled = false;
|
|||
|
|
if (GlobalMeterBatch.ListOfMeters.Any())
|
|||
|
|
{
|
|||
|
|
GlobalMeterBatch.RemoveAllMeters();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (ThermoMeterBatch.ListOfMeters.Any())
|
|||
|
|
{
|
|||
|
|
ThermoMeterBatch.RemoveAllMeters();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GlobalMeterBatch = new MeterBatch();
|
|||
|
|
ThermoMeterBatch = new MeterBatch();
|
|||
|
|
if (!settings.GetTempUseTempFlansh())
|
|||
|
|
{
|
|||
|
|
TempMeterStateCtls = new List<MeterStateControl>();
|
|||
|
|
}
|
|||
|
|
#region Definitions and initializations
|
|||
|
|
|
|||
|
|
foreach (var meterStateCtl in AllMeterStateCtrls())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (meterStateCtl.IsEnabled || meterStateCtl is TempMeterStateControl)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//if (meterStateCtl is TempMeterStateControl && (((TempMeterStateControl)meterStateCtl).HasMeter && meterStateCtl.Meter != null))
|
|||
|
|
//{
|
|||
|
|
// continue;
|
|||
|
|
//}
|
|||
|
|
if (meterStateCtl.Slot != -1)
|
|||
|
|
{
|
|||
|
|
var currentMeter = new ZeroFlowGenesisMeter(meterStateCtl.Slot, 3, !(meterStateCtl is TempMeterStateControl));
|
|||
|
|
|
|||
|
|
currentMeter.LogOnEnable = true;
|
|||
|
|
currentMeter.LoginFailed = false;
|
|||
|
|
currentMeter.PreparationFailed = false;
|
|||
|
|
currentMeter.AmplitudeFailed = false;
|
|||
|
|
currentMeter.ZeroFlowOffsetFailed = false;
|
|||
|
|
currentMeter.AmplitudeFailed = false;
|
|||
|
|
currentMeter.CompletionFailed = false;
|
|||
|
|
currentMeter.Ok = false;
|
|||
|
|
currentMeter.EmptyPipeCheckEnable = false;
|
|||
|
|
currentMeter.EmptyPipeCheckFailed = false;
|
|||
|
|
if (meterStateCtl is TempMeterStateControl)
|
|||
|
|
{
|
|||
|
|
ThermoMeterBatch.AddMeter(currentMeter);
|
|||
|
|
meterStateCtl.IsEnabled = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GlobalMeterBatch.AddMeter(currentMeter);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
meterStateCtl.Meter = currentMeter;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
WaitNSeconds(2, true);
|
|||
|
|
btn_ZeroFlowCal_Detect.Enabled = true;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
ShowMsg($"{PredefinedMessages.DetectFailed(Culture)} {Environment.NewLine} {ex.Message}");
|
|||
|
|
|
|||
|
|
|
|||
|
|
btn_ZeroFlowCal_Detect.Enabled = true;
|
|||
|
|
detectState = false;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Definitions and initializations
|
|||
|
|
//Boolean[] EnableOpening = new Boolean[Constants.NumberOfMeters];
|
|||
|
|
//Boolean[] ThermoEnableOpening = new Boolean[Constants.NumberOfThermometers];
|
|||
|
|
//Boolean[] Ok = new Boolean[2 * Constants.NumberOfMeters];
|
|||
|
|
//Boolean[] ThermoOk = new Boolean[2 * Constants.NumberOfThermometers];
|
|||
|
|
//Boolean[] SetToUnknownStatus = new Boolean[Constants.NumberOfMeters];
|
|||
|
|
//Boolean[] ThermoSetToUnknownStatus = new Boolean[Constants.NumberOfThermometers];
|
|||
|
|
|
|||
|
|
foreach (var meterState in AllMeterStateCtrls())
|
|||
|
|
{
|
|||
|
|
meterState.EnableOpening = meterState.IsEnabled;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
btn_ZeroFlowCal_Start.Enabled = false;
|
|||
|
|
AbortIndicator = false;
|
|||
|
|
#endregion
|
|||
|
|
#region Bubbles
|
|||
|
|
pB_Bubbles1.Visible = true;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
if (!MeterStateCtls.Any(a => a.EnableOpening))
|
|||
|
|
{
|
|||
|
|
ShowMsg(PredefinedMessages.NoMeterSelected(Culture), "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
|
StatusLabel(PredefinedMessages.PressDetect(Culture));
|
|||
|
|
SetControlElements(true);
|
|||
|
|
detectState = false;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
foreach (var meterState in AllMeterStateCtrls())
|
|||
|
|
{
|
|||
|
|
meterState.SetToUnknownStatus = !meterState.EnableOpening;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Visual indication 'PREPARE'
|
|||
|
|
SetProgressPanel(StatusPanelItems.Detect);
|
|||
|
|
StatusLabel(PredefinedMessages.WaitDetect(Culture));
|
|||
|
|
|
|||
|
|
foreach (var meterCtl in MeterStateCtls)
|
|||
|
|
{
|
|||
|
|
if (meterCtl != null && meterCtl.IsEnabled)
|
|||
|
|
{
|
|||
|
|
meterCtl.Ok = meterCtl.Meter.CheckRequestPort() && meterCtl.Meter.CheckStreamingPort();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!settings.GetTempUseManualInput())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
foreach (var meterCtl in TempMeterStateCtls)
|
|||
|
|
{
|
|||
|
|
if (meterCtl != null && meterCtl.IsEnabled)
|
|||
|
|
{
|
|||
|
|
meterCtl.Ok = meterCtl.Meter.CheckStreamingPort();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
AllMeterStateCtrls().ForEach(f => f.SetUi());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
ShowMsg($"TempMeterError{ex.Message}");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//Display.ConnectionStatusReset(SetToUnknownStatus);
|
|||
|
|
//Display.ThermoConnectionStatusReset(ThermoSetToUnknownStatus);
|
|||
|
|
#endregion
|
|||
|
|
#region Status message
|
|||
|
|
StatusLabel(PredefinedMessages.PressStartOrDetect(Culture));
|
|||
|
|
btn_ZeroFlowCal_Start.Enabled = true;
|
|||
|
|
pB_Bubbles1.Visible = false;
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
public event EventHandler<EventArgsMeterSuccsessfull> OnAbort;
|
|||
|
|
public event EventHandler<EventArgsMeterSuccsessfull> OnIsDone;
|
|||
|
|
public event EventHandler<EventArgsFlushRequest> OnRequestFlush;
|
|||
|
|
public event EventHandler OnRequestTemperatur;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public DialogResult AskForRetry(String sequenceName, string Text)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
return (DialogResult)this.Invoke(new Func<DialogResult>(() => { return AskForRetry(sequenceName, Text); }));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DialogResult AskForActions = DialogResult.Ignore;
|
|||
|
|
AbortButtonEnabled(false);
|
|||
|
|
AskForActions = ShowMsg(Text, $"{sequenceName}", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question, true);
|
|||
|
|
AbortButtonEnabled(true);
|
|||
|
|
|
|||
|
|
DebugMessage($"AskForActions on {sequenceName} selected {AskForActions}");
|
|||
|
|
return AskForActions;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void ClearLog()
|
|||
|
|
{
|
|||
|
|
rTB_ZeroFlowCal.Clear(); // Clear log (textbox)
|
|||
|
|
proccessLog.Clear();
|
|||
|
|
}
|
|||
|
|
private void btn_ZeroFlowCal_Start_Click(object sender, System.EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
pp = new ProcessProgress();
|
|||
|
|
pp.Setting = settings;
|
|||
|
|
pp.Logo = pB_Logo1.Image;
|
|||
|
|
//if (!isAutomaticMode)
|
|||
|
|
//{
|
|||
|
|
pp.Setting.MeterSize = (MeterSize)cb_Metersize.SelectedItem; // ((MeterSize)nUD_SettingsPreparationMetersize.Value);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
AllMeterStateCtrls().ForEach(mc => mc.EnabeldBoxEnabel(false));
|
|||
|
|
foreach (var tm in TempMeterStateCtls.Where(t => t.IsEnabled))
|
|||
|
|
{
|
|||
|
|
tm.OnWatcherFailed += delegate (Object o, EventArgs b)
|
|||
|
|
{
|
|||
|
|
//pp.CancellationSource.Cancel();
|
|||
|
|
DebugMessage("Tempreature watch failed");
|
|||
|
|
ShowMsg(PredefinedMessages.ZeroflowOffsetTestFailed(pp.Setting.Culture), "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
pp.OnBubblesChanged += delegate (Object o, EventArgsBool b)
|
|||
|
|
{
|
|||
|
|
SetBusy(b.Value);
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
pp.OnDebugMessageChanged += delegate (Object o, EventArgsDebug s)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DebugMessage(s.Value, s.Slot, s.Source, s.PcbId);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
//ignor
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
if (!TempMeterStateCtls.Any(a => a.IsEnabled))
|
|||
|
|
{
|
|||
|
|
pp.OnRequestTempretureSelection += PpOnOnRequestTempretureSelection;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pp.OnStatusLabelChanged += delegate (Object o, EventArgsString s) { StatusLabel(s.Value); };
|
|||
|
|
pp.OnForceFailedMessage += delegate (Object o, EventArgs args)
|
|||
|
|
{
|
|||
|
|
ShowMsg(PredefinedMessages.ZeroflowOffsetTestFailed(pp.Setting.Culture), "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
|
};
|
|||
|
|
OnAbort += (o, args) =>
|
|||
|
|
{
|
|||
|
|
pp.StopSequence = true;
|
|||
|
|
pp.CancellationSource.Cancel();
|
|||
|
|
};
|
|||
|
|
pp.IsAutomaticMode = isAutomaticMode;
|
|||
|
|
pp.OnRequestFlush += delegate (Object o, EventArgsMeterSize size)
|
|||
|
|
{
|
|||
|
|
var flushParams = new FlushParams(size.Value);
|
|||
|
|
if (OnRequestFlush == null)
|
|||
|
|
{
|
|||
|
|
ShowMsg($"{flushParams.Message}", "Flush", MessageBoxButtons.OK, MessageBoxIcon.Information, false, false);
|
|||
|
|
pp.FlushDone = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
OnRequestFlush.Invoke(o, new EventArgsFlushRequest(flushParams));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
pp.OnRequestTemperatur += delegate (Object o, EventArgs args)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OnRequestTemperatur?.Invoke(o, new EventArgs());
|
|||
|
|
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OnAbort += (o, args) => pp.CancellationSource.Cancel();
|
|||
|
|
btn_ZeroFlowCal_Start.Enabled = false;
|
|||
|
|
|
|||
|
|
List<IProcess> listOfProgrammParts = new List<IProcess>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
listOfProgrammParts.Add(new PrepareTestProcess("PrepareTest", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Detect, string.Empty, string.Empty, 1 * 60));
|
|||
|
|
|
|||
|
|
listOfProgrammParts.Add(new LoginProcess("Login", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Detect, PredefinedMessages.WaitUntilLoginFinished(pp.Setting.Culture), PredefinedMessages.LoginFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
listOfProgrammParts.Add(new FlushProcess("First Flush", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Detect, PredefinedMessages.WaitUntilFlushFinished(pp.Setting.Culture), string.Empty, 2 * 60));
|
|||
|
|
|
|||
|
|
//listOfProgrammParts.Add(new PressureTestProcess("PreussureTest", StatusPanelItems.Prepare, PredefinedMessages.WaitUntilPreparationFinished(pp.Setting.Culture), PredefinedMessages.PreparationFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
if (pp.Setting.NumberOfPaths == 1)
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new SPPreparationProcess("Preparation Single", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Prepare, PredefinedMessages.WaitUntilPreparationFinished(pp.Setting.Culture), PredefinedMessages.PreparationFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new PreparationProcess("Preparation", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Prepare, PredefinedMessages.WaitUntilPreparationFinished(pp.Setting.Culture), PredefinedMessages.PreparationFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (!pp.Setting.TempOnly)
|
|||
|
|
{
|
|||
|
|
if (pp.Setting.NumberOfPaths == 1)
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new SPAmplitudeTestProcess("Amplitude Test Single", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Amplitude, PredefinedMessages.WaitUntilAmplitudeTestFinished(pp.Setting.Culture), PredefinedMessages.AmplitudeFailed(pp.Setting.Culture), 4 * 60));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new AmplitudeTestProcess("Amplitude Test", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Amplitude, PredefinedMessages.WaitUntilAmplitudeTestFinished(pp.Setting.Culture), PredefinedMessages.AmplitudeFailed(pp.Setting.Culture), 4 * 60));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listOfProgrammParts.Add(new FlushProcess("Second Flush", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Amplitude, PredefinedMessages.WaitUntilFlushFinished(pp.Setting.Culture), string.Empty, 2 * 60));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (pp.Setting.NumberOfPaths == 1)
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new SPTemperatureCalibrationProcess("Temperature Calibration Single", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.TempCal, PredefinedMessages.WaitUntilTemperatureCalibrationFinished(pp.Setting.Culture), PredefinedMessages.TempCalFailed(pp.Setting.Culture), 2 * 60));
|
|||
|
|
|
|||
|
|
if (!pp.Setting.TempOnly)
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new SPOffsetTestProcess("Offset Test Single", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Offset, PredefinedMessages.WaitUntilZeroflowOffsetTestFinished(pp.Setting.Culture), PredefinedMessages.ZeroflowOffsetTestFailed(pp.Setting.Culture), 18 * 60));
|
|||
|
|
}
|
|||
|
|
listOfProgrammParts.Add(new SPCompletionProcess("Completion Single", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Completion, PredefinedMessages.WaitUntilCompletionFinished(pp.Setting.Culture), PredefinedMessages.CompletionFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new TemperatureCalibrationProcess("Temperature Calibration", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.TempCal, PredefinedMessages.WaitUntilTemperatureCalibrationFinished(pp.Setting.Culture), PredefinedMessages.TempCalFailed(pp.Setting.Culture), 2 * 60));
|
|||
|
|
|
|||
|
|
if (!pp.Setting.TempOnly)
|
|||
|
|
{
|
|||
|
|
listOfProgrammParts.Add(new OffsetTestProcess("Offset Test", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Offset, PredefinedMessages.WaitUntilZeroflowOffsetTestFinished(pp.Setting.Culture), PredefinedMessages.ZeroflowOffsetTestFailed(pp.Setting.Culture), 18 * 60));
|
|||
|
|
}
|
|||
|
|
listOfProgrammParts.Add(new CompletionProcess("Completion", CordonelPreadjustmentUi.PreAdjustmentControl.StatusPanelItems.Completion, PredefinedMessages.WaitUntilCompletionFinished(pp.Setting.Culture), PredefinedMessages.CompletionFailed(pp.Setting.Culture), 1 * 60));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
var t = new Task(() =>
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int totalSecondsEstm = 0;
|
|||
|
|
foreach (BaseProcess curentProccess in listOfProgrammParts)
|
|||
|
|
{
|
|||
|
|
totalSecondsEstm = totalSecondsEstm + curentProccess.ExpectedTimeS;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
DateTimeOffset totalStart = DateTimeOffset.UtcNow;
|
|||
|
|
DateTimeOffset? totalStartOffset = null;
|
|||
|
|
|
|||
|
|
foreach (BaseProcess curentProccess in listOfProgrammParts)
|
|||
|
|
{
|
|||
|
|
if (!MeterStateCtls.Any(m => m.IsEnabled))
|
|||
|
|
{
|
|||
|
|
DebugMessage($"\tAPPLICATION:\t\t No device enabled");
|
|||
|
|
DebugMessage($"\tAPPLICATION:\t\t ZEROFLOW CALIBRATION sequence failed");
|
|||
|
|
pp.StopSequence = true;
|
|||
|
|
|
|||
|
|
listOfProgrammParts.Last().StartProcess(pp, MeterStateCtls, TempMeterStateCtls);
|
|||
|
|
|
|||
|
|
while (pp.IsBusy)
|
|||
|
|
{
|
|||
|
|
Thread.Sleep(50);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
pp.IsBusy = true;
|
|||
|
|
var done = false;
|
|||
|
|
while (!done && !pp.StopSequence)
|
|||
|
|
{
|
|||
|
|
pp.IsBusy = true;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (curentProccess is OffsetTestProcess)
|
|||
|
|
{
|
|||
|
|
totalStartOffset = DateTimeOffset.UtcNow;
|
|||
|
|
}
|
|||
|
|
curentProccess.StartProcess(pp, MeterStateCtls, TempMeterStateCtls);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
ShowMsg($"Error on Start Process", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, true);
|
|||
|
|
throw;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var secondCounter = 0;
|
|||
|
|
while (pp.IsBusy)
|
|||
|
|
{
|
|||
|
|
Thread.Sleep(50);
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (secondCounter >= 1000)
|
|||
|
|
{
|
|||
|
|
PushProgressBars(totalSecondsEstm, totalStart, curentProccess.ExpectedTimeS, curentProccess.StartTime);
|
|||
|
|
secondCounter = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
secondCounter = secondCounter + 50;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
DebugMessage(ex);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (totalStartOffset.HasValue)
|
|||
|
|
{
|
|||
|
|
var ts = DateTimeOffset.UtcNow - totalStartOffset.Value;
|
|||
|
|
DebugMessage($"offset duration= {ts.TotalSeconds}");
|
|||
|
|
|
|||
|
|
MeterStateCtls.ForEach(f => f.Meter?.calibrationResult?.AddAdditionalLog($"offset duration=", $"{ts.TotalSeconds}S"));
|
|||
|
|
|
|||
|
|
totalStartOffset = null;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
MeterStateCtls.ForEach(f => f.SetUi());
|
|||
|
|
|
|||
|
|
if (MeterStateCtls.Any(a => a.IsEnabled && a.Failed))
|
|||
|
|
{
|
|||
|
|
var sb = new StringBuilder();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (MeterStateCtls.Count(a => a.IsEnabled && a.Failed) == 1)
|
|||
|
|
{
|
|||
|
|
sb.Append($"Der Zähler hat den {curentProccess.ProcessName} nicht bestanden.");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sb.Append($"Die Zähler haben den {curentProccess.ProcessName} nicht bestanden.");
|
|||
|
|
}
|
|||
|
|
sb.AppendLine("");
|
|||
|
|
foreach (var a in MeterStateCtls.Where(a => a.IsEnabled && a.Failed).ToList())
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(a.Meter.SerialNumber))
|
|||
|
|
{
|
|||
|
|
sb.Append($"{a.Meter.PcbId} an EP. {a.Slot},");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sb.Append($"{a.Meter.SerialNumber} an EP. {a.Slot},");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sb = sb.Remove(sb.Length - 1, 1);
|
|||
|
|
|
|||
|
|
sb.AppendLine("");
|
|||
|
|
sb.AppendLine("Soll der Schritt wiederholt werden (Retry/Wiederholen) ?");
|
|||
|
|
|
|||
|
|
if (MeterStateCtls.Count(a => a.IsEnabled && a.Failed) == 1)
|
|||
|
|
{
|
|||
|
|
sb.AppendLine("Ohne diesen Zähler fortgefahren werden (Ignor/Ignorieren)?");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sb.AppendLine("Ohne diese Zähler fortgefahren (Ignor/Ignorieren)?");
|
|||
|
|
}
|
|||
|
|
sb.AppendLine("Soll der Prozess für ALLE Zähler abgebrochen werden (Cancel/Abbruch)?");
|
|||
|
|
|
|||
|
|
|
|||
|
|
switch (AskForRetry(curentProccess.ProcessName, sb.ToString()))
|
|||
|
|
{
|
|||
|
|
case DialogResult.Retry:
|
|||
|
|
MeterStateCtls.Where(a => a.IsEnabled && !a.Failed).ToList().ForEach(a => a.SetDisableForRetry());
|
|||
|
|
MeterStateCtls.Where(a => a.IsEnabled && a.Failed).ToList().ForEach(a => a.Failed = false);
|
|||
|
|
break;
|
|||
|
|
case DialogResult.Ignore:
|
|||
|
|
MeterStateCtls.Where(a => a.IsEnabled && !a.Failed).ToList().ForEach(a => a.IsEnabled = false);
|
|||
|
|
done = true;
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
|
|||
|
|
pp.StopSequence = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//var returnValue = AskForRetry..Invoke();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
done = true;
|
|||
|
|
}
|
|||
|
|
MeterStateCtls.ForEach(a => a.SetEnableAfterRetry());
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
foreach (var checkMeterForFailed in AllMeterStateCtrls())
|
|||
|
|
{
|
|||
|
|
if (checkMeterForFailed.IsEnabled && checkMeterForFailed.Failed)
|
|||
|
|
{
|
|||
|
|
pp.GenerateReturnNote(curentProccess.FailedMessage, checkMeterForFailed);
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!pp.IsAutomaticMode)
|
|||
|
|
{
|
|||
|
|
checkMeterForFailed.Meter.SetProcessState(DisplayCodes.ZeroFlowFailed);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
checkMeterForFailed.IsEnabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (pp.StopSequence || !MeterStateCtls.Any(meter => !meter.Failed))
|
|||
|
|
{
|
|||
|
|
StopMainSequence(curentProccess.FailedMessage, MessageBoxIcon.Error, pp.Setting.Culture);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
AbortIndicator = false;
|
|||
|
|
SetControlElements(false);
|
|||
|
|
SetProgressPanel((StatusPanelItems)curentProccess.PanelState);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (!GlobalMeterBatch.ListOfMeters.Any() && MeterStateCtls.Any(meter => meter.IsEnabled && !meter.Failed))
|
|||
|
|
{
|
|||
|
|
StopMainSequence(PredefinedMessages.NoMeterSelected(pp.Setting.Culture), MessageBoxIcon.Error,
|
|||
|
|
pp.Setting.Culture);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//if ((pp.AtLeastOneThermometerPresent) || (pp.AtLeastOneMeterPresent)) return pp;
|
|||
|
|
//StopMainSequence(
|
|||
|
|
// !pp.AtLeastOneThermometerPresent
|
|||
|
|
// ? PredefinedMessages.NoThermometerPresent(pp.Culture)
|
|||
|
|
// : PredefinedMessages.NoMeterPresent(pp.Culture),
|
|||
|
|
// MessageBoxIcon.Error, pp.Culture);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
ShowMsg($"Critical error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, true);
|
|||
|
|
DebugMessage(ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var GoodMeters = new List<int>();
|
|||
|
|
foreach (var addToSuccessfullList in MeterStateCtls.Where(a => a.IsEnabled && !a.Failed))
|
|||
|
|
{
|
|||
|
|
GoodMeters.Add(addToSuccessfullList.Meter.Slot);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GlobalMeterBatch?.RemoveAllMeters();
|
|||
|
|
ThermoMeterBatch?.RemoveAllMeters();
|
|||
|
|
GlobalMeterBatch.Dispose();
|
|||
|
|
ThermoMeterBatch.Dispose();
|
|||
|
|
|
|||
|
|
TestDone(PredefinedMessages.ZeroflowCalibrationSequenceSuccessful(pp.Setting.Culture), pp.Setting.Culture, GoodMeters);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
t.Start();
|
|||
|
|
}
|
|||
|
|
catch (Exception exception)
|
|||
|
|
{
|
|||
|
|
DebugMessage(exception);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void PushProgressBars(int totalSecondsEstm, DateTimeOffset totalStart, int currentProccessEstm, DateTimeOffset currentProccessStartTime)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
Invoke((Action<int, DateTimeOffset, int, DateTimeOffset>)PushProgressBars, totalSecondsEstm, totalStart, currentProccessEstm, currentProccessStartTime);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
l_ZeroFlowCal_SubResttimeDisplayValue.Text = currentProccessStartTime.ToLocalTime().AddSeconds(currentProccessEstm).ToString("HH:mm:ss");
|
|||
|
|
l_ZeroFlowCal_ResttimeDisplayValue.Text = totalStart.ToLocalTime().AddSeconds(totalSecondsEstm).ToString("HH:mm:ss");
|
|||
|
|
|
|||
|
|
int progressPer = 0;
|
|||
|
|
var pastSeconds = (int)(DateTimeOffset.UtcNow - totalStart).TotalSeconds;
|
|||
|
|
if (pastSeconds > 0)
|
|||
|
|
{
|
|||
|
|
progressPer = (int)(pastSeconds / (totalSecondsEstm / 100.0));
|
|||
|
|
progressPer = progressPer >= 100 ? 100 : progressPer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
pB_ZeroFlowCal_Progress.Value = progressPer;
|
|||
|
|
|
|||
|
|
progressPer = 0;
|
|||
|
|
pastSeconds = (int)(DateTimeOffset.UtcNow - currentProccessStartTime).TotalSeconds;
|
|||
|
|
|
|||
|
|
if (pastSeconds > 0)
|
|||
|
|
{
|
|||
|
|
progressPer = (int)(pastSeconds / (currentProccessEstm / 100.0));
|
|||
|
|
progressPer = progressPer >= 100 ? 100 : progressPer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
pB_ZeroFlowCal_SubProgress.Value = progressPer;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
DebugMessage($"Not able to update proccess {ex.Message}");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void TestDone(string msg, CultureInfo c, List<int> goodMeters)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
Invoke((Action<string, CultureInfo, List<int>>)TestDone, msg, c, goodMeters);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
AllMeterStateCtrls().ForEach(ctl => ctl.Dispose());
|
|||
|
|
PreAdjustmentControl_Load(this, EventArgs.Empty);
|
|||
|
|
GlobalMeterBatch = new MeterBatch();
|
|||
|
|
ThermoMeterBatch = new MeterBatch();
|
|||
|
|
StopMainSequence(msg, MessageBoxIcon.Information, c);
|
|||
|
|
|
|||
|
|
OnIsDone?.Invoke(this, new EventArgsMeterSuccsessfull(goodMeters));
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void PpOnOnRequestTempretureSelection(Object sender, EventArgsBool e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
Invoke((Action<Object, EventArgsBool>)PpOnOnRequestTempretureSelection, sender, e);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
btn_StoreTempe.Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void StopMainSequence(String message, MessageBoxIcon icon, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
SetProgressPanel(StatusPanelItems.None);
|
|||
|
|
|
|||
|
|
AbortButtonEnabled(false);
|
|||
|
|
SetControlElements(true);
|
|||
|
|
StatusLabel(PredefinedMessages.PressDetect(pp.Setting.Culture));
|
|||
|
|
ShowMsg(message, "Form closing", MessageBoxButtons.OK, icon); // "'ZEROFLOW CALIBRATION' sequence stopped"
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
private void btn_ZeroFlowCal_Abort_Click(object sender, System.EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DialogResult AskForActions = DialogResult.None;
|
|||
|
|
btn_ZeroFlowCal_Abort.Enabled = false;
|
|||
|
|
|
|||
|
|
AskForActions = ShowMsg(PredefinedMessages.AreYouSure(settings.Culture), "Form closing", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
|
|||
|
|
|
|||
|
|
if (DialogResult.Equals(AskForActions, DialogResult.OK))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
AbortIndicator = true;
|
|||
|
|
OnAbort?.Invoke(null, new EventArgsMeterSuccsessfull(new List<int>()));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AbortIndicator = false;
|
|||
|
|
btn_ZeroFlowCal_Abort.Enabled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btn_StoreTempe_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
btn_StoreTempe.Enabled = false;
|
|||
|
|
pp.TempretureSelected = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btn_ShowAll_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
this.Invoke((Action<object, EventArgs>)btn_ShowAll_Click, sender, e);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
rTB_ZeroFlowCal.Visible = true;
|
|||
|
|
gB_MeterLog.Visible = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|