fixing progressbar for Zeroflow magflux and move it into a task
This commit is contained in:
@@ -104,6 +104,7 @@
|
|||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
<PropertyGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Xylem.Common.CommonCore.Consts;
|
using Xylem.Common.CommonCore.Consts;
|
||||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
||||||
@@ -59,6 +61,8 @@ namespace CordonelPreadjustmentUi
|
|||||||
|
|
||||||
nUD_Settings_Samplerate.Value = mainSettings.Samplerate;
|
nUD_Settings_Samplerate.Value = mainSettings.Samplerate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tab_Maintab_Selected(object sender, TabControlEventArgs e)
|
private void tab_Maintab_Selected(object sender, TabControlEventArgs e)
|
||||||
@@ -142,6 +146,8 @@ namespace CordonelPreadjustmentUi
|
|||||||
mainSettings.Samplerate = (int)nUD_Settings_Samplerate.Value;
|
mainSettings.Samplerate = (int)nUD_Settings_Samplerate.Value;
|
||||||
|
|
||||||
preadjustCtl.SetSettings(mainSettings);
|
preadjustCtl.SetSettings(mainSettings);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ using System.Linq;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Xylem.Common.CommonCore.Consts;
|
using Xylem.Common.CommonCore.Consts;
|
||||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
||||||
@@ -277,28 +278,26 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
wrappedControl.StatusLabel("MagFlux Zeroflow is preparing");
|
wrappedControl.StatusLabel("MagFlux Zeroflow is preparing");
|
||||||
var meterBatch = new MeterBatch();
|
var meterBatch = new MeterBatch();
|
||||||
|
|
||||||
foreach (var item in TestsetuptContainer?.meterTestSettings)
|
var t = new Task(() => {
|
||||||
{
|
foreach (var item in TestsetuptContainer?.meterTestSettings)
|
||||||
if (item != null && item.PreAdjustment && item.meterType == MeterTypes.MagFlux)
|
|
||||||
{
|
{
|
||||||
var newMeter = new MagFluxMeter();
|
if (item != null && item.PreAdjustment && item.meterType == MeterTypes.MagFlux)
|
||||||
newMeter.SetupFromConfigFile(item.Slot);
|
{
|
||||||
newMeter.Login();
|
var newMeter = new MagFluxMeter();
|
||||||
newMeter.SerialNumber = item.SerialNr;
|
newMeter.SetupFromConfigFile(item.Slot);
|
||||||
|
newMeter.Login();
|
||||||
|
newMeter.SerialNumber = item.SerialNr;
|
||||||
|
|
||||||
meterBatch.AddMeter(newMeter);
|
meterBatch.AddMeter(newMeter);
|
||||||
newMeter.InitCalibration();
|
newMeter.InitCalibration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
meterBatch.MetersStartMeasurement();
|
meterBatch.MetersStartMeasurement();
|
||||||
|
|
||||||
var c = TestsetuptContainer.meterTestSettings.Count();
|
var c = TestsetuptContainer.meterTestSettings.Count();
|
||||||
|
|
||||||
TestsetuptContainer.meterTestResults = new MeterTestResults[c];
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
|
TestsetuptContainer.meterTestResults = new MeterTestResults[c];
|
||||||
|
|
||||||
int WaitTimeM = 5;
|
int WaitTimeM = 5;
|
||||||
wrappedControl.StatusLabel("MagFlux Zeroflow is running");
|
wrappedControl.StatusLabel("MagFlux Zeroflow is running");
|
||||||
@@ -307,55 +306,53 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
while (End > DateTimeOffset.UtcNow)
|
while (End > DateTimeOffset.UtcNow)
|
||||||
{
|
{
|
||||||
wrappedControl.PushProgressBars(WaitTimeM * 3600, Start, WaitTimeM * 3600, Start);
|
wrappedControl.PushProgressBars(WaitTimeM * 60, Start, WaitTimeM * 60, Start);
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var meter in meterBatch.ListOfMeters)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
}
|
meter.StopMeasurement();
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
MessageBox.Show(ex.Message);
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
var RetryLeft = 10;
|
||||||
|
while (meter.GetMeasurementState(0) != Xylem.Common.Metrology.Measurements.Consts.MeasurementStates.IsCompleted && RetryLeft > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
RetryLeft = RetryLeft - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var resU = meter.GetMainMeasurementResult(0, 60);
|
||||||
|
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1] = new MeterTestResults();
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
|
||||||
|
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1].meterType = MeterTypes.MagFlux;
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1].Slot = meter.Slot;
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1].SerialNr = meter.SerialNumber;
|
||||||
|
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = 60, MeasuredRefFlowQmPerH = 0, RequierdTimeS = 60, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
|
||||||
|
|
||||||
|
meter.Logout();
|
||||||
|
meter.DisposeMeter();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.ContinueWith((r) => { pollingAction = PollingAction.IsDone; });
|
||||||
|
t.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var meter in meterBatch.ListOfMeters)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
meter.StopMeasurement();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
var RetryLeft = 10;
|
|
||||||
while (meter.GetMeasurementState(0) != Xylem.Common.Metrology.Measurements.Consts.MeasurementStates.IsCompleted && RetryLeft >0)
|
|
||||||
{
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
RetryLeft = RetryLeft - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var resU = meter.GetMainMeasurementResult(0, 60);
|
|
||||||
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1] = new MeterTestResults();
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
|
|
||||||
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].meterType = MeterTypes.MagFlux;
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Slot = meter.Slot;
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].SerialNr = meter.SerialNumber;
|
|
||||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = 60, MeasuredRefFlowQmPerH = 0, RequierdTimeS = 60, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
|
|
||||||
|
|
||||||
meter.Logout();
|
|
||||||
meter.DisposeMeter();
|
|
||||||
|
|
||||||
}
|
|
||||||
pollingAction = PollingAction.IsDone;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user