diff --git a/Common/.shared/SharedAssemblyInfo.cs b/Common/.shared/SharedAssemblyInfo.cs index 37cbba1c..595ce5f2 100644 --- a/Common/.shared/SharedAssemblyInfo.cs +++ b/Common/.shared/SharedAssemblyInfo.cs @@ -14,5 +14,5 @@ using System.Reflection; //[assembly: AssemblyVersion("1.2.*.0")] -[assembly: AssemblyVersion("2.4.2.*")] -[assembly: AssemblyFileVersion("2.4.2.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.4.3.*")] +[assembly: AssemblyFileVersion("2.4.3.0")] \ No newline at end of file diff --git a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxCore.csproj b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxCore.csproj index d3edfe54..da814e42 100644 --- a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxCore.csproj +++ b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxCore.csproj @@ -31,6 +31,9 @@ 4 + + ..\..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\..\..\packages\NLog.4.6.7\lib\net45\NLog.dll @@ -113,6 +116,10 @@ {26afcf1e-1287-48b8-a506-32b1e8a0dd0e} WaterMeterRegisters + + {BA17D20E-0CEB-4B27-9772-2392BD750ED5} + DataPackages + {70398b99-b134-4bbd-968b-7399b70c3ce2} MagFluxConfig diff --git a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs index d671c1c9..70b47356 100644 --- a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs +++ b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs @@ -2,13 +2,21 @@ using NLog; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Threading; +using Newtonsoft.Json; using Xylem.Common.CommonCore.Consts; using Xylem.Common.Hardware.Interfaces.Ports.PortCore; +using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments; using Xylem.Common.Hardware.Interfaces.Ports.SerialPorts; +using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore; +using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore.EventArguments; using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol; using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol; +using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.EventArguments; +using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.MeasurementRecords; using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxConfig; +using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxConfig.Const; using Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; @@ -72,6 +80,17 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore #region variables and properties + /// + /// List of ongoing measurements, base- and calibration-measurements + /// + private List _listOfIMeasurement = new List(); + + /// + /// Quality watch mode can be used to decode intermediate records and check + /// for actual quality of the measurements. + /// + public Boolean QualityWatchMode; + /// /// Represent pcb serial number /// @@ -134,10 +153,62 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore get; set; } + /// + /// do not use it to set ProcessStatus + /// if you want to change ProcessStatus of this genesis use + /// is just store for some routines + /// + private ProcessState _myProcessStatus; + /// + /// if state is change + /// + /// will be invoked. + /// on some states other events will be invoke as well public ProcessState ProcessStatus { - get; + get + { + return _myProcessStatus; + } + + set + { + if (_myProcessStatus == value) + { + return; + } + + _myProcessStatus = value; + Invoker(OnProcessStatusChanged); + switch (value) + { + case ProcessState.InitIsActive: + Invoker(OnInitCompleted); + break; + case ProcessState.MeasurementIsActive: + Invoker(OnMeasurementInitCompleted); + break; + case ProcessState.MeasurementIsDone: + Invoker(OnMeasurementCompleted); + break; + case ProcessState.CalibrationIsActive: + Invoker(OnCalibInitCompleted); + break; + case ProcessState.CalibrationIsDone: + Invoker(OnCalibCompleted); + break; + case ProcessState.QRefDone: + case ProcessState.WaitForQRef: + case ProcessState.WaitForCalibration: + case ProcessState.WaitForMeasurement: + case ProcessState.IsNotInit: + //no extra event needed + break; + default: + throw new OverflowException("MagFlux measurement unknown process status"); + } + } } /// @@ -295,7 +366,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore /// If you have a password for highest access level you need, if you don't want to access the meter /// (just read led record) than you can leave it nullS /// - public void SetupMagFluxMeter(Int32 slot, PortConfig? requestPort, PortConfig? streamingPort, + private void SetupMagFluxMeter(Int32 slot, PortConfig? requestPort, PortConfig? streamingPort, Boolean ignoreCorruptedData = true, String password = "") { Slot = slot; @@ -304,12 +375,10 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore if (requestPort != null) { - String requestIdent; if (requestPort.Value.Type == "Xylem.Common.Hardware.Interfaces.Ports.SerialPorts.UartSerialPort") { - requestIdent = $"Slot:{Slot}, Port:{requestPort.Value.PortName}, Protocol:Request, Type:UART -"; + var requestIdent = $"Slot:{Slot}, Port:{requestPort.Value.PortName}, Protocol:Request, Type:UART -"; - //CRC calculation does include the CRC itself filled with 0x0000 in advance RequestProtocol = new RequestProtocol(requestIdent); TransmitProtocol = new UartTransmitProtocol(requestPort.Value.PortName); RequestProtocol.SetTransmitProtocol(TransmitProtocol); @@ -335,86 +404,162 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore #endregion - #region logging - private void SetLogger() - { - if (_logger != null) - { - LogManager.Flush(); - } - if (string.IsNullOrEmpty(CurrentActionText)) - { - _logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}", $"", "Meter", "MeterBase", "MeterBase"); - - } - else - { - var id = !string.IsNullOrEmpty(SerialNumber) ? $"SN{SerialNumber}" : $"PCB{PcbId}"; - - _logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}_{id}_{CurrentActionText}", $"Slot", "Meter", "MeterBase", "MeterBase"); - if (StreamingPort != null && StreamingPort is LedSerialPort) - { - var streamingIdent = $"LedRawData_Slot_{Slot}_{id}_{CurrentActionText}"; - - ((LedSerialPort)StreamingPort).Ident = streamingIdent; - ((LedSerialPort)StreamingPort).RefreshLogger(); - - - if (!string.IsNullOrEmpty(SerialNumber) && CurrentActionText.Contains("PG")) - { - - var pathMain = NLogHelper.GetPath(_logger); - var pathRaw = NLogHelper.GetPath(((LedSerialPort)StreamingPort).GetRawLogger()); - - var basePath = Path.GetDirectoryName(pathMain); - - // - - - var testRunString = CurrentActionText.Replace("PG", ""); - var lastChat = pathMain.LastIndexOf('\\'); - pathMain = pathMain.Substring(lastChat + 1); - pathRaw = Path.GetFileName(pathRaw); - - var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetMeterLogPathInfo?SerialNumber={SerialNumber}&TestRunId={testRunString}&BasePath={basePath}&MainLogName={pathMain}&LEDName={pathRaw}"; - _logger.Debug($"Request Url: { tmpUrl}"); - //ToDO: Update to service URl - LocalWebRequest.GetRequest(tmpUrl); - - } - } - } - - } - #endregion + /// + /// + /// Start Event listening, has to be called after + /// public void ConnectMeter() { - throw new NotImplementedException(); + if (RequestPort != null && RequestPort.GetPortName() != BaseSerialPort.PortNotAssigned) + { + LinkPortToProtocol(RequestPort, RequestProtocol); + _logger.Trace($"Slot:{Slot} - RequestPort and RequestProtocol linked"); + RequestProtocol.OnRecordIsDecoded += RequestProtocol_ApplyDecodedRecord; + } + if (StreamingPort != null && StreamingPort.GetPortName() != BaseSerialPort.PortNotAssigned) + { + LinkPortToProtocol(StreamingPort, StreamingProtocol); + _logger.Trace($"Slot:{Slot} - StreamingPort and StreamingProtocol linked"); + StreamingProtocol.OnRecordIsDecoded += StreamingProtocol_ApplyDecodedRecord; + } + + _logger.Debug($"Slot:{Slot} - Connected and communication started"); } + /// + /// Add a port to working queue + /// + /// On should one once added in runtime + /// + public void LinkPortToProtocol(IPort port, IProtocol protocol) + { + //for streaming mode only + if (port == null) + { + return; + } + + port.OnRawRecordReceived += delegate (Object o, BasePortDataEventArgs rawMsg) + { + protocol.FillDecodingBuffer(rawMsg); + }; + try + { + if (!port.IsOpen()) + { + port.Open(); + } + } + catch (Exception ex) + { + throw new ApplicationException($"Cannot Open Comport. Check TaskManager for other Genesis relevant programs and close them. Also check if the comport is valid! { Environment.NewLine }{ ex.Message}"); + } + + protocol.OnRecordReadyToSend += delegate (Object o, BasePortDataEventArgs dataToSend) + { + var data = (List)dataToSend.GetData(); + port.PortWrite(data.ToArray()); + }; + } + + /// + /// Synchronization of the record for the streaming interface + /// + /// + /// + public void SyncStreamingBuffer(SyncMarkRecord markRecord) + { + if (StreamingPort == null) + { + throw new ApplicationException("Synchronization not possible due to undefined streaming port"); + } + + StreamingPort.SynchronizeReceiveBuffer(markRecord); + } + + private void RequestProtocol_AuthorizationGrant(Object sender, EventArgs e) + { + + _logger.Debug($"Slot:{Slot} - Authorization succeeded"); + + } /// public void SetupFromConfigFile(Int32 slot, Boolean ignoreCorruptedData = true) { - throw new NotImplementedException(); + SetupFromConfigFile(slot, ignoreCorruptedData, true, true); + } + + /// + /// Setup water meter from configuration file: + /// -slot, + /// -streaming protocol, + /// -streaming port + /// -request port + /// + /// + /// + /// + /// + /// + public void SetupFromConfigFile(Int32 slot, Boolean ignoreCorruptedData, Boolean useRequest, Boolean useStreaming) + { + + Slot = slot; + SetLogger(); + + + var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(MagFlux), ProgramConfig.SerialConfigFileName); + + if (!File.Exists(configFile)) + { + configFile = Path.Combine(ProgramConfig.SerialConfigFileName); + if (!File.Exists(configFile)) + { + throw new ApplicationException($"Configuration file {configFile} not found "); + } + } + var tr = new StreamReader(configFile); + var slotConfigList = JsonConvert.DeserializeObject(tr.ReadToEnd()); + + var slotConfig = slotConfigList.FirstOrDefault(t => t.Slot == slot); + + if (slotConfig == null) + { + throw new ApplicationException($"Slot:{slot} - File " + + $"{ProgramConfig.SerialConfigFileName} does not contain valid configuration"); + } + _logger.Debug($"Slot:{slot} - Configuration loaded"); + if (!useRequest) + { + SetupMagFluxMeter(slot, null, slotConfig.Streaming, ignoreCorruptedData); + } + else if (!useStreaming) + { + SetupMagFluxMeter(slot, slotConfig.Request, null, ignoreCorruptedData); + } + else + { + SetupMagFluxMeter(slot, slotConfig.Request, slotConfig.Streaming, ignoreCorruptedData); + } } /// public Boolean Logout() { - throw new NotImplementedException(); + return true; } /// public Boolean Login() { - throw new NotImplementedException(); + return true; } /// public Boolean Login(String password, Boolean runImmediately = true, Boolean skipReadMeterFwAndAssignRegisters = false) { - throw new NotImplementedException(); + return true; } /// @@ -426,13 +571,35 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore /// public void StartMeasurement() { - throw new NotImplementedException(); + _listOfIMeasurement = new List + { + new BaseMeasurement(Slot, typeof(MagFluxRecord), IntermediateUpdateTimeS) + }; + + foreach (var measurement in _listOfIMeasurement) + { + measurement.OnActionStateHasChanged += Measurement_ActionStateHasChanged; + } + + _logger.Info($"Slot:{Slot} - Start measurement"); + + ProcessStatus = ProcessState.MeasurementIsActive; + _listOfIMeasurement.ForEach(m => m.MeasurementState = MeasurementStates.IsWaitingForStartData); + SyncStreamingBuffer(SyncMarkRecord.SyncStart); } /// public void StopMeasurement() { - throw new NotImplementedException(); + _logger.Info($"Slot:{Slot} - Stop measurement"); + ProcessStatus = ProcessState.MeasurementIsDone; + _listOfIMeasurement.ForEach(m => m.MeasurementState = MeasurementStates.IsWaitingForEndData); + SyncStreamingBuffer(SyncMarkRecord.SyncEnd); + } + + private void Measurement_ActionStateHasChanged(Object sender, EventArgs e) + { + SyncStreamingBuffer(SyncMarkRecord.DecodeIntermediate); } /// @@ -537,7 +704,186 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore /// public void DisposeMeter() { - throw new NotImplementedException(); + Dispose(); } + + private void AddData(IMeasurementRecord newRecord) + { + + foreach (var measurement in _listOfIMeasurement) + { + if (measurement.GetType() != newRecord.GetType()) + { + continue; + } + + if (measurement.GetChannel() == newRecord.GetChannel()) + { + measurement.AddData(newRecord); + } + } + + // when every measurement has state IsRunning or every measurement has state IsCompleted, the streaming buffer set to skip decoding + if (_listOfIMeasurement.All(m => m.MeasurementState == MeasurementStates.IsRunning) + || _listOfIMeasurement.All(m => m.MeasurementState == MeasurementStates.IsCompleted)) + { + SyncStreamingBuffer(QualityWatchMode + ? SyncMarkRecord.DecodeIntermediateQuality + : SyncMarkRecord.SkipDecoding); + } + + } + + #region Events + + //public event EventHandler HasInformationForCaller; + + /// + public event EventHandler OnCalibCompleted; + + /// + public event EventHandler OnErrorStatusChanged; + + /// + public event EventHandler OnProcessStatusChanged; + + /// + public event EventHandler OnCalibInitCompleted; + + /// + public event EventHandler OnInitCompleted; + + /// + public event EventHandler OnMeasurementInitCompleted; + + /// + public event EventHandler OnMeasurementCompleted; + + /// + /// Response received after request for record + /// + public event EventHandler OnRequestRecordReceived; + + /// + /// call this if session is expired and you need an re-authorization + /// + //public EventHandler AuthorizationRequired; + + /// + /// A helper to invoke events only if someone is listening, otherwise nothing will happen + /// + /// Event handler to call + /// Sender (can be null) + /// Event arguments (can be null) + private void Invoker(EventHandler handler, Object sender = null, EventArgs e = null) + { + if (handler != null) + { + if (sender == null) + { + sender = this; + } + + if (e == null) + { + e = new EventArgs(); + } + + handler.Invoke(sender, e); + } + // ReSharper disable once RedundantIfElseBlock + else + { + //nobody is listening + } + } + + /// + /// Track all incoming led record packages (Calibration and Flow) + /// + /// + /// + /// I should be or + /// otherwise this method does nothing + /// + private void StreamingProtocol_ApplyDecodedRecord(Object sender, BaseDataEventArgs e) + { + var result = e.GetEventData(); + if (result is IMeasurementRecord) + { + if (result is MagFluxRecord) + { + if (!((MagFluxRecord)result).IsValid) + { + return; + } + + } + + AddData(((IMeasurementRecord)result)); + } + } + + /// + /// tracking request record processing + /// + /// + /// + private void RequestProtocol_ApplyDecodedRecord(Object sender, BaseDataEventArgs e) + { + if (e is RequestResponseDataEventArgs) + { + OnRequestRecordReceived?.Invoke(sender, (RequestResponseDataEventArgs)e); + } + } + #endregion + + #region logging + private void SetLogger() + { + if (_logger != null) + { + LogManager.Flush(); + } + if (string.IsNullOrEmpty(CurrentActionText)) + { + _logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}", $"", "Meter", "MeterBase", "MeterBase"); + + } + else + { + var id = !string.IsNullOrEmpty(SerialNumber) ? $"SN{SerialNumber}" : $"PCB{PcbId}"; + + _logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}_{id}_{CurrentActionText}", $"Slot", "Meter", "MeterBase", "MeterBase"); + if (StreamingPort != null && StreamingPort is LedSerialPort) + { + var streamingIdent = $"LedRawData_Slot_{Slot}_{id}_{CurrentActionText}"; + + ((LedSerialPort)StreamingPort).Ident = streamingIdent; + ((LedSerialPort)StreamingPort).RefreshLogger(); + + + if (!string.IsNullOrEmpty(SerialNumber) && CurrentActionText.Contains("PG")) + { + + var pathMain = NLogHelper.GetPath(_logger); + var pathRaw = NLogHelper.GetPath(((LedSerialPort)StreamingPort).GetRawLogger()); + + var basePath = Path.GetDirectoryName(pathMain); + + var testRunString = CurrentActionText.Replace("PG", ""); + var lastChat = pathMain.LastIndexOf('\\'); + pathMain = pathMain.Substring(lastChat + 1); + pathRaw = Path.GetFileName(pathRaw); + + //var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetMeterLogPathInfo?SerialNumber={SerialNumber}&TestRunId={testRunString}&BasePath={basePath}&MainLogName={pathMain}&LEDName={pathRaw}"; + //_logger.Debug($"Request Url: { tmpUrl}"); + ////ToDO: Update to service URl + //LocalWebRequest.GetRequest(tmpUrl); + } + } + } + } + #endregion } } diff --git a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/packages.config b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/packages.config index edcaaf36..9aaa89a8 100644 --- a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/packages.config +++ b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/App.config b/Common/Ui/GenesisToolBox/App.config index 161bd3eb..2c717a73 100644 --- a/Common/Ui/GenesisToolBox/App.config +++ b/Common/Ui/GenesisToolBox/App.config @@ -1,46 +1,46 @@ - + -
+
- + - + - + - - - + + + - - + + - + - + - \ No newline at end of file + diff --git a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj index 175bc9e4..5be1537f 100644 --- a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj +++ b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj @@ -75,6 +75,7 @@ 7.0 prompt MinimumRecommendedRules.ruleset + false 14673934DFE995F28E9579F4A18DBDA05F7C1AFE @@ -115,6 +116,7 @@ 7.0 prompt MinimumRecommendedRules.ruleset + false bin\x64\Release\ @@ -125,6 +127,7 @@ 7.0 prompt MinimumRecommendedRules.ruleset + false true @@ -146,6 +149,7 @@ 7.0 prompt MinimumRecommendedRules.ruleset + false diff --git a/Common/Ui/GenesisToolBox/Properties/Resources.Designer.cs b/Common/Ui/GenesisToolBox/Properties/Resources.Designer.cs index af2fd4e7..6acf6053 100644 --- a/Common/Ui/GenesisToolBox/Properties/Resources.Designer.cs +++ b/Common/Ui/GenesisToolBox/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Xylem.Common.Ui.GenesisToolBox.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Common/Ui/GenesisToolBox/Properties/Settings.Designer.cs b/Common/Ui/GenesisToolBox/Properties/Settings.Designer.cs index 147394bd..d969ddcc 100644 --- a/Common/Ui/GenesisToolBox/Properties/Settings.Designer.cs +++ b/Common/Ui/GenesisToolBox/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Xylem.Common.Ui.GenesisToolBox.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Common/Ui/MagFluxToolBox/App.config b/Common/Ui/MagFluxToolBox/App.config index 193aecc6..4bfa0056 100644 --- a/Common/Ui/MagFluxToolBox/App.config +++ b/Common/Ui/MagFluxToolBox/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs b/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs index b844c23e..5b33dc25 100644 --- a/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs +++ b/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs @@ -30,25 +30,12 @@ { this.components = new System.ComponentModel.Container(); this.grpSetup = new System.Windows.Forms.GroupBox(); - this.btnClearDisplay = new System.Windows.Forms.Button(); - this.label10 = new System.Windows.Forms.Label(); - this.tbxRadio = new System.Windows.Forms.TextBox(); - this.tbxRegion = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); this.tbxPcbId = new System.Windows.Forms.TextBox(); - this.tbxMeterFw = new System.Windows.Forms.TextBox(); - this.tbxMeterMeterSize = new System.Windows.Forms.TextBox(); - this.tbxMeterLutCrc = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.lblFwVersion = new System.Windows.Forms.Label(); this.btnConnect = new System.Windows.Forms.Button(); this.lblConnectPcb = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.cbComSlot = new System.Windows.Forms.ComboBox(); this.lblWaitingForMeterResponse = new System.Windows.Forms.Label(); - this.btnStopFwUpdate = new System.Windows.Forms.Button(); - this.btnDownloadLutFile = new System.Windows.Forms.Button(); this.lblOverall = new System.Windows.Forms.Label(); this.barSingleProgressUpdate = new System.Windows.Forms.ProgressBar(); this.lblActualProcess = new System.Windows.Forms.Label(); @@ -56,100 +43,41 @@ this.tmrProgressUpdate = new System.Windows.Forms.Timer(this.components); this.dlgOpenLuFile = new System.Windows.Forms.OpenFileDialog(); this.lblFwUpdateInfo = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.btnLoadfromDb = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); - this.rbtProd = new System.Windows.Forms.RadioButton(); - this.cbxDbLuts = new System.Windows.Forms.ComboBox(); - this.rbtDb = new System.Windows.Forms.RadioButton(); - this.rbtFile = new System.Windows.Forms.RadioButton(); - this.lblSelectDb = new System.Windows.Forms.Label(); - this.tbxFileMeterSize = new System.Windows.Forms.TextBox(); - this.tbxFileCrc = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.lblLutFileLoadedInfo = new System.Windows.Forms.Label(); - this.tbxLutFilePathName = new System.Windows.Forms.TextBox(); - this.lvlSelechtFile = new System.Windows.Forms.Label(); - this.btnOpenLutFile = new System.Windows.Forms.Button(); this.label9 = new System.Windows.Forms.Label(); this.lblUpdateTime = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.picLogo = new System.Windows.Forms.PictureBox(); + this.grpBoxInfo = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); this.grpSetup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picLogo)).BeginInit(); + this.grpBoxInfo.SuspendLayout(); this.SuspendLayout(); // // grpSetup // - this.grpSetup.Controls.Add(this.btnClearDisplay); - this.grpSetup.Controls.Add(this.label10); - this.grpSetup.Controls.Add(this.tbxRadio); - this.grpSetup.Controls.Add(this.tbxRegion); - this.grpSetup.Controls.Add(this.label8); this.grpSetup.Controls.Add(this.tbxPcbId); - this.grpSetup.Controls.Add(this.tbxMeterFw); - this.grpSetup.Controls.Add(this.tbxMeterMeterSize); - this.grpSetup.Controls.Add(this.tbxMeterLutCrc); - this.grpSetup.Controls.Add(this.label5); - this.grpSetup.Controls.Add(this.label6); - this.grpSetup.Controls.Add(this.lblFwVersion); this.grpSetup.Controls.Add(this.btnConnect); this.grpSetup.Controls.Add(this.lblConnectPcb); this.grpSetup.Controls.Add(this.label2); this.grpSetup.Controls.Add(this.cbComSlot); - this.grpSetup.Location = new System.Drawing.Point(12, 69); + this.grpSetup.Location = new System.Drawing.Point(100, 5); this.grpSetup.Name = "grpSetup"; - this.grpSetup.Size = new System.Drawing.Size(257, 273); + this.grpSetup.Size = new System.Drawing.Size(257, 100); this.grpSetup.TabIndex = 24; this.grpSetup.TabStop = false; - this.grpSetup.Text = "Cordonel"; - // - // btnClearDisplay - // - this.btnClearDisplay.Location = new System.Drawing.Point(128, 239); - this.btnClearDisplay.Name = "btnClearDisplay"; - this.btnClearDisplay.Size = new System.Drawing.Size(116, 25); - this.btnClearDisplay.TabIndex = 33; - this.btnClearDisplay.Text = "Release Display"; - this.btnClearDisplay.UseVisualStyleBackColor = true; - this.btnClearDisplay.Click += new System.EventHandler(this.btnClearDisplay_Click); - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(10, 212); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(116, 13); - this.label10.TabIndex = 36; - this.label10.Text = "Radio frequency[MHz]:"; - // - // tbxRadio - // - this.tbxRadio.Location = new System.Drawing.Point(128, 208); - this.tbxRadio.Name = "tbxRadio"; - this.tbxRadio.ReadOnly = true; - this.tbxRadio.Size = new System.Drawing.Size(68, 20); - this.tbxRadio.TabIndex = 35; - // - // tbxRegion - // - this.tbxRegion.Location = new System.Drawing.Point(128, 178); - this.tbxRegion.Name = "tbxRegion"; - this.tbxRegion.ReadOnly = true; - this.tbxRegion.Size = new System.Drawing.Size(68, 20); - this.tbxRegion.TabIndex = 34; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(10, 182); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(44, 13); - this.label8.TabIndex = 33; - this.label8.Text = "Region:"; + this.grpSetup.Text = "Setup"; // // tbxPcbId // @@ -159,57 +87,6 @@ this.tbxPcbId.Size = new System.Drawing.Size(68, 20); this.tbxPcbId.TabIndex = 32; // - // tbxMeterFw - // - this.tbxMeterFw.Location = new System.Drawing.Point(128, 88); - this.tbxMeterFw.Name = "tbxMeterFw"; - this.tbxMeterFw.ReadOnly = true; - this.tbxMeterFw.Size = new System.Drawing.Size(68, 20); - this.tbxMeterFw.TabIndex = 31; - // - // tbxMeterMeterSize - // - this.tbxMeterMeterSize.Location = new System.Drawing.Point(128, 148); - this.tbxMeterMeterSize.Name = "tbxMeterMeterSize"; - this.tbxMeterMeterSize.ReadOnly = true; - this.tbxMeterMeterSize.Size = new System.Drawing.Size(68, 20); - this.tbxMeterMeterSize.TabIndex = 30; - // - // tbxMeterLutCrc - // - this.tbxMeterLutCrc.Location = new System.Drawing.Point(128, 118); - this.tbxMeterLutCrc.Name = "tbxMeterLutCrc"; - this.tbxMeterLutCrc.ReadOnly = true; - this.tbxMeterLutCrc.Size = new System.Drawing.Size(68, 20); - this.tbxMeterLutCrc.TabIndex = 29; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(10, 152); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(60, 13); - this.label5.TabIndex = 28; - this.label5.Text = "Meter Size:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(10, 122); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(86, 13); - this.label6.TabIndex = 27; - this.label6.Text = "Meter LUT CRC:"; - // - // lblFwVersion - // - this.lblFwVersion.AutoSize = true; - this.lblFwVersion.Location = new System.Drawing.Point(10, 92); - this.lblFwVersion.Name = "lblFwVersion"; - this.lblFwVersion.Size = new System.Drawing.Size(57, 13); - this.lblFwVersion.TabIndex = 25; - this.lblFwVersion.Text = "Meter FW:"; - // // btnConnect // this.btnConnect.Location = new System.Drawing.Point(128, 24); @@ -279,26 +156,6 @@ this.lblWaitingForMeterResponse.TabIndex = 18; this.lblWaitingForMeterResponse.Text = "WAITING FOR METER RESPONSE"; // - // btnStopFwUpdate - // - this.btnStopFwUpdate.Location = new System.Drawing.Point(310, 216); - this.btnStopFwUpdate.Name = "btnStopFwUpdate"; - this.btnStopFwUpdate.Size = new System.Drawing.Size(116, 25); - this.btnStopFwUpdate.TabIndex = 8; - this.btnStopFwUpdate.Text = "STOP"; - this.btnStopFwUpdate.UseVisualStyleBackColor = true; - this.btnStopFwUpdate.Click += new System.EventHandler(this.btnStopFwUpdate_Click); - // - // btnDownloadLutFile - // - this.btnDownloadLutFile.Location = new System.Drawing.Point(310, 183); - this.btnDownloadLutFile.Name = "btnDownloadLutFile"; - this.btnDownloadLutFile.Size = new System.Drawing.Size(116, 25); - this.btnDownloadLutFile.TabIndex = 0; - this.btnDownloadLutFile.Text = "Download"; - this.btnDownloadLutFile.UseVisualStyleBackColor = true; - this.btnDownloadLutFile.Click += new System.EventHandler(this.btnDownloadLutFile_Click); - // // lblOverall // this.lblOverall.AutoSize = true; @@ -346,198 +203,16 @@ // this.lblFwUpdateInfo.AutoSize = true; this.lblFwUpdateInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFwUpdateInfo.Location = new System.Drawing.Point(18, 32); + this.lblFwUpdateInfo.Location = new System.Drawing.Point(623, 66); this.lblFwUpdateInfo.Name = "lblFwUpdateInfo"; this.lblFwUpdateInfo.Size = new System.Drawing.Size(72, 13); this.lblFwUpdateInfo.TabIndex = 27; this.lblFwUpdateInfo.Text = "Version: 0.0.0"; // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point(609, 9); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(102, 54); - this.pictureBox1.TabIndex = 29; - this.pictureBox1.TabStop = false; - // // openFileDialog1 // this.openFileDialog1.FileName = "openFileDialog1"; // - // groupBox1 - // - this.groupBox1.Controls.Add(this.btnLoadfromDb); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.rbtProd); - this.groupBox1.Controls.Add(this.cbxDbLuts); - this.groupBox1.Controls.Add(this.rbtDb); - this.groupBox1.Controls.Add(this.rbtFile); - this.groupBox1.Controls.Add(this.lblSelectDb); - this.groupBox1.Controls.Add(this.tbxFileMeterSize); - this.groupBox1.Controls.Add(this.tbxFileCrc); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.lblLutFileLoadedInfo); - this.groupBox1.Controls.Add(this.btnDownloadLutFile); - this.groupBox1.Controls.Add(this.tbxLutFilePathName); - this.groupBox1.Controls.Add(this.lvlSelechtFile); - this.groupBox1.Controls.Add(this.btnStopFwUpdate); - this.groupBox1.Controls.Add(this.btnOpenLutFile); - this.groupBox1.Location = new System.Drawing.Point(275, 69); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(436, 273); - this.groupBox1.TabIndex = 28; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Lookup Table File"; - // - // btnLoadfromDb - // - this.btnLoadfromDb.Location = new System.Drawing.Point(310, 118); - this.btnLoadfromDb.Name = "btnLoadfromDb"; - this.btnLoadfromDb.Size = new System.Drawing.Size(116, 26); - this.btnLoadfromDb.TabIndex = 20; - this.btnLoadfromDb.Text = "Load from Db"; - this.btnLoadfromDb.UseVisualStyleBackColor = true; - this.btnLoadfromDb.Click += new System.EventHandler(this.btnLoadfromDb_Click); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 30); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(68, 13); - this.label4.TabIndex = 19; - this.label4.Text = "LUT Source:"; - // - // rbtProd - // - this.rbtProd.AutoSize = true; - this.rbtProd.Location = new System.Drawing.Point(270, 28); - this.rbtProd.Name = "rbtProd"; - this.rbtProd.Size = new System.Drawing.Size(96, 17); - this.rbtProd.TabIndex = 18; - this.rbtProd.TabStop = true; - this.rbtProd.Text = "Prod Database"; - this.rbtProd.UseVisualStyleBackColor = true; - this.rbtProd.CheckedChanged += new System.EventHandler(this.rbtProd_CheckedChanged); - this.rbtProd.Click += new System.EventHandler(this.SwitchView); - // - // cbxDbLuts - // - this.cbxDbLuts.FormattingEnabled = true; - this.cbxDbLuts.Location = new System.Drawing.Point(90, 58); - this.cbxDbLuts.Name = "cbxDbLuts"; - this.cbxDbLuts.Size = new System.Drawing.Size(333, 21); - this.cbxDbLuts.TabIndex = 17; - this.cbxDbLuts.Visible = false; - this.cbxDbLuts.SelectedIndexChanged += new System.EventHandler(this.cbxDbLuts_SelectedIndexChanged); - // - // rbtDb - // - this.rbtDb.AutoSize = true; - this.rbtDb.Location = new System.Drawing.Point(144, 28); - this.rbtDb.Name = "rbtDb"; - this.rbtDb.Size = new System.Drawing.Size(120, 17); - this.rbtDb.TabIndex = 16; - this.rbtDb.TabStop = true; - this.rbtDb.Text = "Research Database"; - this.rbtDb.UseVisualStyleBackColor = true; - this.rbtDb.Click += new System.EventHandler(this.SwitchView); - // - // rbtFile - // - this.rbtFile.AutoSize = true; - this.rbtFile.Location = new System.Drawing.Point(87, 28); - this.rbtFile.Name = "rbtFile"; - this.rbtFile.Size = new System.Drawing.Size(41, 17); - this.rbtFile.TabIndex = 15; - this.rbtFile.TabStop = true; - this.rbtFile.Text = "File"; - this.rbtFile.UseVisualStyleBackColor = true; - this.rbtFile.Click += new System.EventHandler(this.SwitchView); - // - // lblSelectDb - // - this.lblSelectDb.AutoSize = true; - this.lblSelectDb.Location = new System.Drawing.Point(12, 62); - this.lblSelectDb.Name = "lblSelectDb"; - this.lblSelectDb.Size = new System.Drawing.Size(64, 13); - this.lblSelectDb.TabIndex = 14; - this.lblSelectDb.Text = "Select LUT:"; - this.lblSelectDb.Visible = false; - // - // tbxFileMeterSize - // - this.tbxFileMeterSize.Location = new System.Drawing.Point(91, 148); - this.tbxFileMeterSize.Name = "tbxFileMeterSize"; - this.tbxFileMeterSize.ReadOnly = true; - this.tbxFileMeterSize.Size = new System.Drawing.Size(68, 20); - this.tbxFileMeterSize.TabIndex = 13; - // - // tbxFileCrc - // - this.tbxFileCrc.Location = new System.Drawing.Point(91, 118); - this.tbxFileCrc.Name = "tbxFileCrc"; - this.tbxFileCrc.ReadOnly = true; - this.tbxFileCrc.Size = new System.Drawing.Size(68, 20); - this.tbxFileCrc.TabIndex = 12; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 152); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(79, 13); - this.label3.TabIndex = 11; - this.label3.Text = "File Meter Size:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 121); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(75, 13); - this.label1.TabIndex = 10; - this.label1.Text = "File LUT CRC:"; - // - // lblLutFileLoadedInfo - // - this.lblLutFileLoadedInfo.AutoSize = true; - this.lblLutFileLoadedInfo.Location = new System.Drawing.Point(190, 121); - this.lblLutFileLoadedInfo.Name = "lblLutFileLoadedInfo"; - this.lblLutFileLoadedInfo.Size = new System.Drawing.Size(97, 13); - this.lblLutFileLoadedInfo.TabIndex = 9; - this.lblLutFileLoadedInfo.Text = "LUT file not loaded"; - // - // tbxLutFilePathName - // - this.tbxLutFilePathName.Location = new System.Drawing.Point(90, 85); - this.tbxLutFilePathName.Name = "tbxLutFilePathName"; - this.tbxLutFilePathName.ReadOnly = true; - this.tbxLutFilePathName.Size = new System.Drawing.Size(333, 20); - this.tbxLutFilePathName.TabIndex = 2; - this.tbxLutFilePathName.Visible = false; - // - // lvlSelechtFile - // - this.lvlSelechtFile.AutoSize = true; - this.lvlSelechtFile.Location = new System.Drawing.Point(12, 88); - this.lvlSelechtFile.Name = "lvlSelechtFile"; - this.lvlSelechtFile.Size = new System.Drawing.Size(63, 13); - this.lvlSelechtFile.TabIndex = 1; - this.lvlSelechtFile.Text = "Path Name:"; - this.lvlSelechtFile.Visible = false; - // - // btnOpenLutFile - // - this.btnOpenLutFile.Location = new System.Drawing.Point(310, 150); - this.btnOpenLutFile.Name = "btnOpenLutFile"; - this.btnOpenLutFile.Size = new System.Drawing.Size(116, 26); - this.btnOpenLutFile.TabIndex = 0; - this.btnOpenLutFile.Text = "Open"; - this.btnOpenLutFile.UseVisualStyleBackColor = true; - this.btnOpenLutFile.Click += new System.EventHandler(this.btnOpenLutFile_Click); - // // label9 // this.label9.AutoSize = true; @@ -556,28 +231,143 @@ this.lblUpdateTime.TabIndex = 31; this.lblUpdateTime.Text = "0:00"; // + // pictureBox1 + // + this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pictureBox1.Image = global::Xylem.Common.Ui.MagFluxToolBox.Properties.Resources.MagFluxVerySmall; + this.pictureBox1.Location = new System.Drawing.Point(9, 9); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(85, 96); + this.pictureBox1.TabIndex = 33; + this.pictureBox1.TabStop = false; + // + // picLogo + // + this.picLogo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picLogo.Image = global::Xylem.Common.Ui.MagFluxToolBox.Properties.Resources.MjK_LogoSmall; + this.picLogo.InitialImage = null; + this.picLogo.Location = new System.Drawing.Point(620, 5); + this.picLogo.Name = "picLogo"; + this.picLogo.Size = new System.Drawing.Size(91, 58); + this.picLogo.TabIndex = 34; + this.picLogo.TabStop = false; + // + // grpBoxInfo + // + this.grpBoxInfo.Controls.Add(this.label1); + this.grpBoxInfo.Controls.Add(this.textBox1); + this.grpBoxInfo.Controls.Add(this.textBox2); + this.grpBoxInfo.Controls.Add(this.label3); + this.grpBoxInfo.Controls.Add(this.textBox4); + this.grpBoxInfo.Controls.Add(this.textBox5); + this.grpBoxInfo.Controls.Add(this.textBox6); + this.grpBoxInfo.Controls.Add(this.label4); + this.grpBoxInfo.Controls.Add(this.label7); + this.grpBoxInfo.Controls.Add(this.label11); + this.grpBoxInfo.Location = new System.Drawing.Point(9, 109); + this.grpBoxInfo.Name = "grpBoxInfo"; + this.grpBoxInfo.Size = new System.Drawing.Size(348, 228); + this.grpBoxInfo.TabIndex = 37; + this.grpBoxInfo.TabStop = false; + this.grpBoxInfo.Text = "Info"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 146); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(116, 13); + this.label1.TabIndex = 36; + this.label1.Text = "Radio frequency[MHz]:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(124, 142); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(68, 20); + this.textBox1.TabIndex = 35; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(124, 112); + this.textBox2.Name = "textBox2"; + this.textBox2.ReadOnly = true; + this.textBox2.Size = new System.Drawing.Size(68, 20); + this.textBox2.TabIndex = 34; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 116); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(44, 13); + this.label3.TabIndex = 33; + this.label3.Text = "Region:"; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(124, 22); + this.textBox4.Name = "textBox4"; + this.textBox4.ReadOnly = true; + this.textBox4.Size = new System.Drawing.Size(68, 20); + this.textBox4.TabIndex = 31; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(124, 82); + this.textBox5.Name = "textBox5"; + this.textBox5.ReadOnly = true; + this.textBox5.Size = new System.Drawing.Size(68, 20); + this.textBox5.TabIndex = 30; + // + // textBox6 + // + this.textBox6.Location = new System.Drawing.Point(124, 52); + this.textBox6.Name = "textBox6"; + this.textBox6.ReadOnly = true; + this.textBox6.Size = new System.Drawing.Size(68, 20); + this.textBox6.TabIndex = 29; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 86); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(60, 13); + this.label4.TabIndex = 28; + this.label4.Text = "Meter Size:"; + // // label7 // this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(16, 9); + this.label7.Location = new System.Drawing.Point(6, 56); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(159, 16); - this.label7.TabIndex = 32; - this.label7.Text = "Cordonel LUT Update"; + this.label7.Size = new System.Drawing.Size(86, 13); + this.label7.TabIndex = 27; + this.label7.Text = "Meter LUT CRC:"; // - // FrmLutUpdate + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 26); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(57, 13); + this.label11.TabIndex = 25; + this.label11.Text = "Meter FW:"; + // + // FrmTest // this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(723, 432); - this.Controls.Add(this.label7); + this.Controls.Add(this.grpBoxInfo); + this.Controls.Add(this.picLogo); + this.Controls.Add(this.pictureBox1); this.Controls.Add(this.lblUpdateTime); this.Controls.Add(this.label9); - this.Controls.Add(this.groupBox1); this.Controls.Add(this.lblWaitingForMeterResponse); - this.Controls.Add(this.pictureBox1); this.Controls.Add(this.lblOverall); this.Controls.Add(this.lblFwUpdateInfo); this.Controls.Add(this.barSingleProgressUpdate); @@ -588,15 +378,16 @@ this.MaximumSize = new System.Drawing.Size(739, 500); this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(739, 405); - this.Name = "FrmLutUpdate"; - this.Text = "Metrology Lookup Table Update"; + this.Name = "FrmTest"; + this.Text = "MagFlux Test"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmTest_FormClosing); this.Load += new System.EventHandler(this.FrmTest_Load); this.grpSetup.ResumeLayout(false); this.grpSetup.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picLogo)).EndInit(); + this.grpBoxInfo.ResumeLayout(false); + this.grpBoxInfo.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -609,7 +400,6 @@ private System.Windows.Forms.Label lblConnectPcb; private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox cbComSlot; - private System.Windows.Forms.Button btnDownloadLutFile; private System.Windows.Forms.ProgressBar barOverallProgressUpdate; private System.Windows.Forms.Timer tmrProgressUpdate; private System.Windows.Forms.Label lblActualProcess; @@ -617,40 +407,23 @@ private System.Windows.Forms.ProgressBar barSingleProgressUpdate; private System.Windows.Forms.OpenFileDialog dlgOpenLuFile; private System.Windows.Forms.Label lblFwUpdateInfo; - private System.Windows.Forms.Button btnStopFwUpdate; - private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.Label lblWaitingForMeterResponse; - private System.Windows.Forms.Label lblFwVersion; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.TextBox tbxLutFilePathName; - private System.Windows.Forms.Label lvlSelechtFile; - private System.Windows.Forms.Button btnOpenLutFile; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label lblUpdateTime; - private System.Windows.Forms.Label lblLutFileLoadedInfo; - private System.Windows.Forms.TextBox tbxFileMeterSize; - private System.Windows.Forms.TextBox tbxFileCrc; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox tbxMeterMeterSize; - private System.Windows.Forms.TextBox tbxMeterLutCrc; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox tbxMeterFw; private System.Windows.Forms.TextBox tbxPcbId; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.TextBox tbxRegion; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label lblSelectDb; - private System.Windows.Forms.RadioButton rbtDb; - private System.Windows.Forms.RadioButton rbtFile; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox picLogo; + private System.Windows.Forms.GroupBox grpBoxInfo; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.Label label4; - private System.Windows.Forms.RadioButton rbtProd; - private System.Windows.Forms.ComboBox cbxDbLuts; - private System.Windows.Forms.Button btnLoadfromDb; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.TextBox tbxRadio; - private System.Windows.Forms.Button btnClearDisplay; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label11; } } \ No newline at end of file diff --git a/Common/Ui/MagFluxToolBox/FrmTest.cs b/Common/Ui/MagFluxToolBox/FrmTest.cs index 7baea1c2..d58b618c 100644 --- a/Common/Ui/MagFluxToolBox/FrmTest.cs +++ b/Common/Ui/MagFluxToolBox/FrmTest.cs @@ -32,11 +32,6 @@ namespace Xylem.Common.Ui.MagFluxToolBox private readonly Boolean _updateGui = true; private Boolean _tryConnectPcb; - private Boolean _lutFileSuccessfulWritten; - private const String StrUpdateErrorMessage = "METROLOGY LOOKUP TABLE UPDATE FAILED!"; - private const String StrUpdateSuccessMessage = "Metrology lookup table successfulley written!"; - private const String StrLutFileInvalid = "LUT FILE INVALID"; - private const String StrLutFileValid = "LUT file loaded"; // external update remarks form // private readonly FrmHistory _frmHistory = new FrmHistory(); @@ -79,12 +74,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox lblConnectPcb.ForeColor = Color.Red; lblWaitingForMeterResponse.Visible = false; btnConnect.Enabled = true; - btnDownloadLutFile.ForeColor = Color.DarkGreen; - btnStopFwUpdate.ForeColor = Color.Red; SetControlDownloadsLocked(); - btnStopFwUpdate.Enabled = false; - btnOpenLutFile.Enabled = true; - btnClearDisplay.Enabled = false; tbxPcbId.Visible = false; } @@ -118,38 +108,21 @@ namespace Xylem.Common.Ui.MagFluxToolBox private void SetControlDownloadsLocked() { - btnDownloadLutFile.Enabled = false; - btnStopFwUpdate.Enabled = false; btnConnect.Enabled = true; } private void SetControlsDownloadIsOngoing() { btnConnect.Enabled = false; - btnOpenLutFile.Enabled = false; - - btnDownloadLutFile.Enabled = false; - btnClearDisplay.Enabled = false; - btnStopFwUpdate.Enabled = true; } private void SetControlsDownloadIsFinished() { btnConnect.Enabled = true; - btnOpenLutFile.Enabled = true; - - btnDownloadLutFile.Enabled = true; - btnStopFwUpdate.Enabled = false; - btnClearDisplay.Enabled = true; } private void SetControlsDownloadEnabled() { btnConnect.Enabled = true; - btnOpenLutFile.Enabled = true; - - btnDownloadLutFile.Enabled = true; - btnStopFwUpdate.Enabled = false; - btnClearDisplay.Enabled = true; } #endregion @@ -166,7 +139,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox return; } - lblOverall.Text = @"Establish data base connection.."; + //lblOverall.Text = @"Establish data base connection.."; Task.Factory.StartNew(() => { @@ -258,8 +231,6 @@ namespace Xylem.Common.Ui.MagFluxToolBox { _tryConnectPcb = false; ProcessViewControl(false); - btnClearDisplay.Enabled = true; - })); } } @@ -525,69 +496,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox _resetTimeMeasurement = false; } Connect(); - } - private void btnOpenLutFile_Click(Object sender, EventArgs e) - { - //if (dlgOpenLuFile.ShowDialog() != DialogResult.OK) - //{ - // return; - //} - - //var lutFilePathName = dlgOpenLuFile.FileName; - - //lblLutFileLoadedInfo.Text = ""; - //tbxLutFilePathName.Text = lutFilePathName; - //if (_meterLutUpdate == null) - //{ - // _meterLutUpdate = new MeterLutUpdate(_magFluxMeter); - // _meterLutUpdate.OnProcessUpdate += ProcessUpdate_Event; - //} - - //if (_meterLutUpdate == null) - //{ - // return; - //} - - //if (_meterLutUpdate.LoadLutFile(lutFilePathName)) - //{ - // lblLutFileLoadedInfo.ForeColor = Color.Green; - // lblLutFileLoadedInfo.Text = StrLutFileValid; - // tbxFileCrc.Text = $@"0x{_meterLutUpdate.LutFile.FileCrc:X4}"; - // tbxFileMeterSize.Text = MeterSizeConverter.ConvertMeterSizeEnumToSizeName(_meterLutUpdate.LutFile.MeterSize); - // _lutFileValid = true; - - // LogText("File Meter Size: " + tbxFileMeterSize.Text); - // LogText("File LUT CRC: " + tbxFileCrc.Text); - // LogText(StrSeparator); - - //} - //else - //{ - // var txt = ""; - // if (!string.IsNullOrEmpty(_meterLutUpdate?.ErrorMessage)) - // { - // txt += _meterLutUpdate?.ErrorMessage; - // } - // else - // { - // txt = StrLutFileInvalid; - // } - - // LogErrorText(txt); - // lblLutFileLoadedInfo.ForeColor = Color.Red; - // lblLutFileLoadedInfo.Text = txt; - // tbxFileCrc.Text = @" --- "; - // tbxFileMeterSize.Text = @" --- "; - // _lutFileValid = false; - //} - - //CheckUpdateEnabled(); - //_resetTimeMeasurement = true; - } - - /// /// Download LUT file /// @@ -600,22 +510,11 @@ namespace Xylem.Common.Ui.MagFluxToolBox return; } - lblLutFileLoadedInfo.Text = ""; SetControlsDownloadIsOngoing(); StartStopDownload(true); _startTime = DateTimeOffset.UtcNow; _resetTimeMeasurement = false; - - - } - - private void btnStopFwUpdate_Click(Object sender, EventArgs e) - { - // if (_meterLutUpdate != null) - // { - // _meterLutUpdate.StopUpdateProcess = true; - // } } #endregion @@ -646,6 +545,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox /// public MessageBoxIcon Icon; } + /// /// Message pop up event handler /// @@ -667,152 +567,6 @@ namespace Xylem.Common.Ui.MagFluxToolBox #endregion - private void SwitchView(Object sender, EventArgs e) - { - btnLoadfromDb.Enabled = false; - var file = rbtFile.Checked; - cbxDbLuts.Visible = !file; - lblSelectDb.Visible = !file; - btnLoadfromDb.Visible = !file; - - lvlSelechtFile.Visible = file; - tbxLutFilePathName.Visible = file; - btnOpenLutFile.Visible = file; - if (!file) - { - LoadDbLuts(rbtProd.Checked); - } - - } - - private void LoadDbLuts(Boolean prod) - { - - //var sbUrl = new StringBuilder(); - //sbUrl.Append("http://10.49.40.25/MeterProcessState/api/FileUpToDate/GetLutFiles"); - ////sbUrl.Append("http://localhost:56011/api/FileUpToDate/GetLutFiles"); - ////sbUrl.Append($"?DataLength={_DataLength}"); - ////sbUrl.Append($"&version={_Version}"); - ////sbUrl.Append($"&crc={_FileCrc}"); - ////sbUrl.Append($"&Metersize={_MeterSize.GetHashCode()}"); - ////sbUrl.Append($"&Region={_StrLutRegion}"); - //try - //{ - - // var ret = LocalWebRequest.GetRequest(sbUrl.ToString(), 80000); - - - // var a = JsonConvert.DeserializeObject>(ret); - // cbxDbLuts.SelectedIndex = -1; - // cbxDbLuts.Items.Clear(); - - // foreach (var item in a) - // { - // if (!prod || item.CurrentVersionForProd) - // { - // cbxDbLuts.Items.Add(item); - // } - - // } - //} - //catch (Exception ex) - //{ - // MessageBox.Show(ex.Message); - //} - - - } - - private void cbxDbLuts_SelectedIndexChanged(Object sender, EventArgs e) - { - //if (cbxDbLuts.SelectedItem is CordonelMetrologyLut) - //{ - // btnLoadfromDb.Enabled = true; - //} - //else - //{ - // btnLoadfromDb.Enabled = false; - //} - } - - private void btnLoadfromDb_Click(Object sender, EventArgs e) - { - //if (cbxDbLuts.SelectedItem is CordonelMetrologyLut lut) - //{ - // lblLutFileLoadedInfo.Text = ""; - // tbxLutFilePathName.Text = $"fromDB{lut.FileName}"; - // if (_meterLutUpdate == null) - // { - // _meterLutUpdate = new MeterLutUpdate(_magFluxMeter); - // _meterLutUpdate.OnProcessUpdate += ProcessUpdate_Event; - // } - - // if (_meterLutUpdate == null) - // { - // return; - // } - - // if (_meterLutUpdate.LoadLutFromStream(lut.FileName, lut.FileContent.ToList())) - // { - // lblLutFileLoadedInfo.ForeColor = Color.Green; - // lblLutFileLoadedInfo.Text = StrLutFileValid; - // tbxFileCrc.Text = $@"0x{_meterLutUpdate.LutFile.FileCrc:X4}"; - // tbxFileMeterSize.Text = MeterSizeConverter.ConvertMeterSizeEnumToSizeName(_meterLutUpdate.LutFile.MeterSize); - // _lutFileValid = true; - - // LogText("File Meter Size: " + tbxFileMeterSize.Text); - // LogText("File LUT CRC: " + tbxFileCrc.Text); - // LogText(StrSeparator); - - // } - // else - // { - // var txt = ""; - // if (!string.IsNullOrEmpty(_meterLutUpdate?.ErrorMessage)) - // { - // txt += _meterLutUpdate?.ErrorMessage; - // } - // else - // { - // txt = StrLutFileInvalid; - // } - - // LogErrorText(txt); - // lblLutFileLoadedInfo.ForeColor = Color.Red; - // lblLutFileLoadedInfo.Text = txt; - // tbxFileCrc.Text = @" --- "; - // tbxFileMeterSize.Text = @" --- "; - // _lutFileValid = false; - // } - - // CheckUpdateEnabled(); - // _resetTimeMeasurement = true; - //} - } - - private void rbtProd_CheckedChanged(Object sender, EventArgs e) - { - - } - - private void btnClearDisplay_Click(Object sender, EventArgs e) - { - // if (_magFluxMeter == null) - // return; - - // lblOverall.Text = @"Set display to normal operation"; - // lblOverall.Visible = true; - // Update(); - - // if (!_magFluxMeter.IsLoggedOn) - // { - // _magFluxMeter.ReLogin(); - // } - - // _magFluxMeter.SetLcdText(true, new Byte[] { 0x00, 0x00, 0x00, 0x00 }); - // _magFluxMeter.Logout(); - // lblOverall.Visible = false; - } } } diff --git a/Common/Ui/MagFluxToolBox/MagFluxToolBox.csproj b/Common/Ui/MagFluxToolBox/MagFluxToolBox.csproj index a5032da6..73b66b00 100644 --- a/Common/Ui/MagFluxToolBox/MagFluxToolBox.csproj +++ b/Common/Ui/MagFluxToolBox/MagFluxToolBox.csproj @@ -12,6 +12,7 @@ 512 true true + AnyCPU @@ -22,6 +23,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -31,6 +33,7 @@ TRACE prompt 4 + false diff --git a/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs b/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs index 17e65b73..b7f80196 100644 --- a/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs +++ b/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/Common/Ui/MagFluxToolBox/frmMainForm.cs b/Common/Ui/MagFluxToolBox/frmMainForm.cs index 4ee1d1e5..47084895 100644 --- a/Common/Ui/MagFluxToolBox/frmMainForm.cs +++ b/Common/Ui/MagFluxToolBox/frmMainForm.cs @@ -118,10 +118,10 @@ namespace Xylem.Common.Ui.MagFluxToolBox private void btnTest_Click(Object sender, EventArgs e) { - //var form = new FrmTest(); - //form.Show(); - //form.Closed += Form_Closed; - //Hide(); + var form = new FrmTest(); + form.Show(); + form.Closed += Form_Closed; + Hide(); } } }