Bridge.OnFlowDetected(...), Config.Entities.Component.Parameters mapped to VARCHAR(12000), ver. 3.9.2125

This commit is contained in:
Milan Hanajik
2023-11-09 11:59:11 +01:00
parent 33f050ef71
commit 990b695db6
7 changed files with 92 additions and 20 deletions
+40 -10
View File
@@ -37,6 +37,9 @@ namespace TBF.UI.Process
Count
}
int qfromIx;
int qtoIx;
int testtimeIx;
int startMassIx;
int massIx;
int volumeIx;
@@ -69,6 +72,16 @@ namespace TBF.UI.Process
catch (Exception e) { log.ErrorFormat("ProcessTabPageCtrl.OnTestSelected() failed: {0}", e.Message); }
};
Bridge.FlowDetectedHandler += delegate (object sender, FlowDetectedEventArgs args)
{
try
{
if (InvokeRequired) Invoke(new EventHandler<FlowDetectedEventArgs>(OnFlowDetected), sender, args);
else OnFlowDetected(sender, args);
}
catch (Exception e) { log.ErrorFormat("ProcessTabPageCtrl.OnFlowDetected() failed: {0}", e.Message); }
};
Bridge.StateMachineTickHandler += delegate(object sndr, UiBridge.StateMachineTickEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<UiBridge.StateMachineTickEventArgs>(OnStateMachineTick), sndr, args); }
@@ -203,52 +216,57 @@ namespace TBF.UI.Process
lv.Items.Add(new ListViewItem(new string[] {
Strings.Repetition,
args != null ? string.Format("{0} / {1}", args.RepetitionNr, args.Test.Repeats) : "---",
string.Empty
string.Empty,
}));
double qfrom = (args != null) ? args.Test.QfromM3ph() : 0;
qfromIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Q_from,
args != null ? Units.ConvertTo(ProcessData.FlowUnit, args.Test.QfromM3ph()).ToString() : "---",
ProcessData.FlowUnit.ToDescription()
(qfrom > 0) ? Units.ConvertTo(ProcessData.FlowUnit, qfrom).ToString() : "---",
(ProcessData.FlowUnit == Unit.None ? Unit.m3ph : ProcessData.FlowUnit).ToDescription(),
}));
double qto = (args != null) ? args.Test.QtoM3ph() : 0;
qtoIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Q_to,
args != null ? Units.ConvertTo(ProcessData.FlowUnit, args.Test.QtoM3ph()).ToString() : "---",
ProcessData.FlowUnit.ToDescription()
(qto > 0) ? Units.ConvertTo(ProcessData.FlowUnit, qto).ToString() : "---",
(ProcessData.FlowUnit == Unit.None ? Unit.m3ph : ProcessData.FlowUnit).ToDescription(),
}));
lv.Items.Add(new ListViewItem(new string[] {
Strings.Target_volume,
args != null ? Units.ConvertTo(ProcessData.VolumeUnit, args.Test.Volume).ToString() : "---",
ProcessData.VolumeUnit.ToDescription()
(ProcessData.VolumeUnit == Unit.None ? Unit.l : ProcessData.VolumeUnit).ToDescription(),
}));
testtimeIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Test_time,
args != null ? args.Test.TestTime.ToString() : "---",
Unit.s.ToDescription()
Unit.s.ToDescription(),
}));
startMassIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Start_mass,
"---",
ProcessData.MassUnit.ToDescription()
(ProcessData.MassUnit == Unit.None ? Unit.kg : ProcessData.MassUnit).ToDescription(),
}));
massIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Mass,
"---",
ProcessData.MassUnit.ToDescription()
(ProcessData.MassUnit == Unit.None ? Unit.kg : ProcessData.MassUnit).ToDescription(),
}));
volumeIx = lv.Items.Count;
lv.Items.Add(new ListViewItem(new string[] {
Strings.Volume,
"---",
ProcessData.VolumeUnit.ToDescription()
(ProcessData.VolumeUnit == Unit.None ? Unit.l : ProcessData.VolumeUnit).ToDescription(),
}));
refErrorIx = lv.Items.Count;
@@ -1078,6 +1096,18 @@ namespace TBF.UI.Process
compoundDetectionTextBox.AppendText(args.Message + Environment.NewLine);
}
void OnFlowDetected(object sender, FlowDetectedEventArgs args)
{
if (args != null && testDataListView.Items.Count > testtimeIx)
{
double qfrom = Units.ConvertTo(ProcessData.FlowUnit, args.Qfrom);
testDataListView.Items[qfromIx].SubItems[1].Text = qfrom.ToString(Common.Utils.SignificantDigitsToFmt(qfrom, 3));
double qto = Units.ConvertTo(ProcessData.FlowUnit, args.Qto);
testDataListView.Items[qtoIx].SubItems[1].Text = qto.ToString(Common.Utils.SignificantDigitsToFmt(qto, 3));
testDataListView.Items[testtimeIx].SubItems[1].Text = args.TestTime.ToString("F1");
}
}
void OnTestCompleted(object sender, TestCompletedEventArgs args)
{
if (args.TestRslt == null || ProcessData.RegisterReaders == null || ProcessData.BatchRslts == null