MagFluxToolbox: - Streaming catcher implemented, first version displaying values
This commit is contained in:
@@ -5,6 +5,8 @@ using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
|
||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.EventArguments;
|
||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Utils.ProcessExec.EventArguments;
|
||||
@@ -75,7 +77,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
lblWaitingForMeterResponse.Visible = false;
|
||||
btnConnect.Enabled = true;
|
||||
SetControlDownloadsLocked();
|
||||
tbxPcbId.Visible = false;
|
||||
tbxSensorNo.Visible = false;
|
||||
}
|
||||
|
||||
private void FrmTest_Load(Object sender, EventArgs e)
|
||||
@@ -91,7 +93,9 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
|
||||
private void FrmTest_FormClosing(Object sender, FormClosingEventArgs e)
|
||||
{
|
||||
_magFluxMeter.OnStreamingRecordDecoded -= StreamingCatcher_OnStreamingRecordDecoded;
|
||||
_magFluxMeter?.Logout();
|
||||
_magFluxMeter?.StopStreamingCatcher();
|
||||
_meterBatch?.RemoveAllMeters();
|
||||
_meterBatch?.Dispose();
|
||||
|
||||
@@ -127,6 +131,24 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
#endregion
|
||||
|
||||
#region BoardControls
|
||||
|
||||
/// <summary>
|
||||
/// Cyclic execution of catcher on incoming events.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void StreamingCatcher_OnStreamingRecordDecoded(Object sender, MagFluxFlowDataEventArgs e)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
tbxSensorNo.Text = e.NewData.SensorId;
|
||||
tbxVolume.Text = $@"{e.NewData.VolumeCm:F3}";
|
||||
tbxFlowRate.Text = $@"{e.NewData.FlowRateCmPh:F3}";
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Connect()
|
||||
{
|
||||
try
|
||||
@@ -159,6 +181,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
|
||||
_magFluxMeter.Configuration.UseRegisterWatchService = false;
|
||||
_magFluxMeter.Configuration.UseMinMaxCheck = false;
|
||||
_magFluxMeter.OnStreamingRecordDecoded += StreamingCatcher_OnStreamingRecordDecoded;
|
||||
|
||||
_meterBatch.MetersLogin();
|
||||
|
||||
//if (!_magFluxMeter.IsLoggedOn)
|
||||
@@ -194,6 +218,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
|
||||
lblConnectPcb.ForeColor = Color.Green;
|
||||
CheckUpdateEnabled();
|
||||
_magFluxMeter.StartStreamingCatcher();
|
||||
_magFluxMeter.Logout();
|
||||
LogInstalledMeterFw();
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user