diff --git a/Common/CommonCore/Exceptions/DB/NoKeyException.cs b/Common/CommonCore/Exceptions/DB/NoKeyException.cs index aa120a11..43b40c39 100644 --- a/Common/CommonCore/Exceptions/DB/NoKeyException.cs +++ b/Common/CommonCore/Exceptions/DB/NoKeyException.cs @@ -1,39 +1,38 @@ using System; -using System.Collections.Generic; using System.Text; namespace Xylem.Common.CommonCore.Exceptions.Db { public class NoKeyStoredException : Exception, ICommonException { - Guid? LCode = null; - public NoKeyStoredException(Guid? Location = null) + Guid? _lCode; + public NoKeyStoredException(Guid? location = null) { - LCode = Location; + _lCode = location; } - public NoKeyStoredException(string message, Guid? Location = null) + public NoKeyStoredException(String message, Guid? location = null) : base(message) { - LCode = Location; + _lCode = location; } - public NoKeyStoredException(string message, Exception inner, Guid? Location = null) + public NoKeyStoredException(String message, Exception inner, Guid? location = null) : base(message, inner) { - LCode = Location; + _lCode = location; } - public string GetHelpText() + public String GetHelpText() { var sb = new StringBuilder(); - sb.AppendLine($"Report this to a developer or database admin."); - sb.AppendLine($"Something went wrong while store the keyset on BSI."); + sb.AppendLine("Report this to a developer or database admin."); + sb.AppendLine("Something went wrong while store the keyset on BSI."); - if (LCode.HasValue) + if (_lCode.HasValue) { - sb.AppendLine($"LCode:{LCode.Value}"); + sb.AppendLine($"LCode:{_lCode.Value}"); } return sb.ToString(); } diff --git a/Common/CommonCore/Exceptions/DB/PcbIdNotException.cs b/Common/CommonCore/Exceptions/DB/PcbIdNotException.cs index 7ca1e3e8..d32d1a33 100644 --- a/Common/CommonCore/Exceptions/DB/PcbIdNotException.cs +++ b/Common/CommonCore/Exceptions/DB/PcbIdNotException.cs @@ -1,39 +1,38 @@ using System; -using System.Collections.Generic; using System.Text; namespace Xylem.Common.CommonCore.Exceptions.Db { public class PcbIdNotException : Exception, ICommonException { - Guid? LCode = null; - public PcbIdNotException(Guid? Location = null) + Guid? _lCode; + public PcbIdNotException(Guid? location = null) { - LCode = Location; + _lCode = location; } - public PcbIdNotException(string message, Guid? Location = null) + public PcbIdNotException(String message, Guid? location = null) : base(message) { - LCode = Location; + _lCode = location; } - public PcbIdNotException(string message, Exception inner, Guid? Location = null) + public PcbIdNotException(String message, Exception inner, Guid? location = null) : base(message, inner) { - LCode = Location; + _lCode = location; } - public string GetHelpText() + public String GetHelpText() { var sb = new StringBuilder(); - sb.AppendLine($"1. Retry your request."); - sb.AppendLine($"2. Check if you Pcb was produced by LAA Operations."); - sb.AppendLine($"3. Ask the source of you pcb for the password and the pcbid and let it regiuster at LAA Operations."); + sb.AppendLine("1. Retry your request."); + sb.AppendLine("2. Check if your pcb was produced by LAA Operations."); + sb.AppendLine("3. Ask the source of your pcb for the password and the pcbid and let it register at LAA Operations."); - if (LCode.HasValue) + if (_lCode.HasValue) { - sb.AppendLine($"LCode:{LCode.Value}"); + sb.AppendLine($"LCode:{_lCode.Value}"); } return sb.ToString(); } diff --git a/Common/CommonCore/Exceptions/ICommonException.cs b/Common/CommonCore/Exceptions/ICommonException.cs index 90b7a7c5..6b33333f 100644 --- a/Common/CommonCore/Exceptions/ICommonException.cs +++ b/Common/CommonCore/Exceptions/ICommonException.cs @@ -1,12 +1,10 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Xylem.Common.CommonCore.Exceptions { interface ICommonException { - string GetHelpText(); + String GetHelpText(); } } diff --git a/Common/CommonCore/Exceptions/WaterMeter/LvlNotSupportedException.cs b/Common/CommonCore/Exceptions/WaterMeter/LvlNotSupportedException.cs index fa94a9b7..ad205678 100644 --- a/Common/CommonCore/Exceptions/WaterMeter/LvlNotSupportedException.cs +++ b/Common/CommonCore/Exceptions/WaterMeter/LvlNotSupportedException.cs @@ -1,37 +1,36 @@ using System; -using System.Collections.Generic; using System.Text; namespace Xylem.Common.CommonCore.Exceptions.WaterMeter { public class LvlNotSupportedException : Exception, ICommonException { - Guid? LCode = null; - public LvlNotSupportedException(Guid? Location = null) + Guid? _lCode; + public LvlNotSupportedException(Guid? location = null) { - LCode = Location; + _lCode = location; } - public LvlNotSupportedException(string message, Guid? Location = null) + public LvlNotSupportedException(String message, Guid? location = null) : base(message) { - LCode = Location; + _lCode = location; } - public LvlNotSupportedException(string message, Exception inner, Guid? Location = null) + public LvlNotSupportedException(String message, Exception inner, Guid? location = null) : base(message, inner) { - LCode = Location; + _lCode = location; } - public string GetHelpText() + public String GetHelpText() { var sb = new StringBuilder(); - sb.AppendLine($"You can not login at this lvl if the meter is locked."); - sb.AppendLine($"Try to use an other level or unlock the meter."); - if (LCode.HasValue) + sb.AppendLine("You can not login at this lvl if the meter is locked."); + sb.AppendLine("Try to use an other level or unlock the meter."); + if (_lCode.HasValue) { - sb.AppendLine($"LCode:{LCode.Value}"); + sb.AppendLine($"LCode:{_lCode.Value}"); } return sb.ToString(); } diff --git a/Common/CommonCore/Exceptions/Web/TokenRequiredException.cs b/Common/CommonCore/Exceptions/Web/TokenRequiredException.cs index b79a1c34..2b647312 100644 --- a/Common/CommonCore/Exceptions/Web/TokenRequiredException.cs +++ b/Common/CommonCore/Exceptions/Web/TokenRequiredException.cs @@ -1,38 +1,37 @@ using System; -using System.Collections.Generic; using System.Text; -namespace Xylem.Common.CommonCore.Exceptions +namespace Xylem.Common.CommonCore.Exceptions.Web { public class TokenRequiredException : Exception, ICommonException { - Guid? LCode = null; - public TokenRequiredException(Guid? Location = null) + Guid? _lCode; + public TokenRequiredException(Guid? location = null) { - LCode = Location; + _lCode = location; } - public TokenRequiredException(string message, Guid? Location = null) + public TokenRequiredException(String message, Guid? location = null) : base(message) { - LCode = Location; + _lCode = location; } - public TokenRequiredException(string message, Exception inner, Guid? Location = null) + public TokenRequiredException(String message, Exception inner, Guid? location = null) : base(message, inner) { - LCode = Location; + _lCode = location; } - public string GetHelpText() + public String GetHelpText() { var sb = new StringBuilder(); - sb.AppendLine($"Token is required for locked meter."); - sb.AppendLine($"Add token too your local key store."); + sb.AppendLine("Token is required for locked meter."); + sb.AppendLine("Add token too your local key store."); - if (LCode.HasValue) + if (_lCode.HasValue) { - sb.AppendLine($"LCode:{LCode.Value}"); + sb.AppendLine($"LCode:{_lCode.Value}"); } return sb.ToString(); } diff --git a/Common/CommonCore/ThreadWatcher/ThreadWatcher.cs b/Common/CommonCore/ThreadWatcher/ThreadWatcher.cs index b586522d..ac72ebde 100644 --- a/Common/CommonCore/ThreadWatcher/ThreadWatcher.cs +++ b/Common/CommonCore/ThreadWatcher/ThreadWatcher.cs @@ -10,22 +10,23 @@ namespace Xylem.Common.CommonCore.ThreadWatcher { #region Singleton private static readonly Lazy - lazy = + Lazy = new Lazy (() => new TaskWatcher()); - public static TaskWatcher Instance { get { return lazy.Value; } } + public static TaskWatcher Instance => Lazy.Value; + #endregion private TaskWatcher() { - tasks = new ConcurrentDictionary(); + _tasks = new ConcurrentDictionary(); } - private ConcurrentDictionary tasks; + private readonly ConcurrentDictionary _tasks; public void Add(Task t) { - tasks.TryAdd(Guid.NewGuid(), t); + _tasks.TryAdd(Guid.NewGuid(), t); } } @@ -34,28 +35,27 @@ namespace Xylem.Common.CommonCore.ThreadWatcher { #region Singleton private static readonly Lazy - lazy = + Lazy = new Lazy (() => new ThreadWatcher()); - public static ThreadWatcher Instance { get { return lazy.Value; } } + public static ThreadWatcher Instance => Lazy.Value; + #endregion private ThreadWatcher() { - threads = new ConcurrentDictionary(); - tasks = new ConcurrentDictionary(); + _threads = new ConcurrentDictionary(); } - private ConcurrentDictionary threads; + private readonly ConcurrentDictionary _threads; - private ConcurrentDictionary tasks; public void Start(Thread t) { t.Start(); - threads.TryAdd(Guid.NewGuid(), t); + _threads.TryAdd(Guid.NewGuid(), t); } } diff --git a/Common/Hardware/WaterMeter/Genesis/DataPackages/MeasurementRecords/CalibrationRecord.cs b/Common/Hardware/WaterMeter/Genesis/DataPackages/MeasurementRecords/CalibrationRecord.cs index 8b61aebd..5211dff8 100644 --- a/Common/Hardware/WaterMeter/Genesis/DataPackages/MeasurementRecords/CalibrationRecord.cs +++ b/Common/Hardware/WaterMeter/Genesis/DataPackages/MeasurementRecords/CalibrationRecord.cs @@ -1,6 +1,5 @@ using System; using System.Text; -using Xylem.Common.CommonCore.Consts; using Xylem.Common.Metrology.Measurements; namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords @@ -31,12 +30,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecor /// /// total time of flight in cordonel units /// - public Int32 RAWTotalTimeOfFlight; + public Int32 RawTotalTimeOfFlight; /// /// delta time of flight in cordonel units /// - public Int32 RAWDeltaTimeOfFlight; + public Int32 RawDeltaTimeOfFlight; /// /// volume scale (default: 1024) means diff --git a/Common/Hardware/WaterMeter/Genesis/DataPackages/RadioConfigurationParams.cs b/Common/Hardware/WaterMeter/Genesis/DataPackages/RadioConfigurationParams.cs index dc54c9d2..1d96b541 100644 --- a/Common/Hardware/WaterMeter/Genesis/DataPackages/RadioConfigurationParams.cs +++ b/Common/Hardware/WaterMeter/Genesis/DataPackages/RadioConfigurationParams.cs @@ -1,21 +1,49 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages { - //obs + + /// + /// All parameters needed for radio setup + /// public class RadioConfigurationParams { - public string PcbId; + /// + /// Pcb identification + /// + public String PcbId; + /// + /// Serial number + /// public UInt32 SerialNumber; + /// + /// Radio address + /// public UInt32 RadioAddress; + /// + /// Power level + /// public UInt32 PowerLevel; + /// + /// Power level option + /// public UInt32 PowerLevelOption; + /// + /// New code for impedance + /// public UInt32 ImpedanceCodeNew; + /// + /// Impedance code option + /// public UInt32 ImpedanceCodeOption; + /// + /// Encryption key + /// public Byte[] EncryptionKey; - public short? FrqOffset { get; set; } + /// + /// Frequency offset + /// + public Int16? FrqOffset { get; set; } } } diff --git a/Common/Hardware/WaterMeter/Genesis/DataPackages/RegisterToDb.cs b/Common/Hardware/WaterMeter/Genesis/DataPackages/RegisterToDb.cs index 043a05c4..cdd4d56b 100644 --- a/Common/Hardware/WaterMeter/Genesis/DataPackages/RegisterToDb.cs +++ b/Common/Hardware/WaterMeter/Genesis/DataPackages/RegisterToDb.cs @@ -1,17 +1,29 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages { + /// + /// + /// public class RegisterToDb { - public RegisterToDb(byte[] adresse, byte[] value) + /// + /// Register address and value to DB + /// + /// + /// + public RegisterToDb(Byte[] adresse, Byte[] value) { Adresse = adresse; Value = value; } - public byte[] Adresse; - public byte[] Value; + /// + /// Address + /// + public Byte[] Adresse; + /// + /// Value + /// + public Byte[] Value; } } diff --git a/Common/Hardware/WaterMeter/Genesis/DataPackages/TempTofCalc.cs b/Common/Hardware/WaterMeter/Genesis/DataPackages/TempTofCalc.cs index db65608e..ef9ffabe 100644 --- a/Common/Hardware/WaterMeter/Genesis/DataPackages/TempTofCalc.cs +++ b/Common/Hardware/WaterMeter/Genesis/DataPackages/TempTofCalc.cs @@ -1,18 +1,27 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages { + /// + /// Temperature Time Of Flight calculation + /// public struct TempTofCalc { - private DateTime refDate; - private double refTemp; - private double tof; + private DateTime _refDate; + private Double _refTemp; + private Double _tof; - public DateTime RefDate { get => refDate; set => refDate = value; } - public double RefTemp { get => refTemp; set => refTemp = value; } - public double Tof { get => tof; set => tof = value; } + /// + /// Reference data + /// + public DateTime RefDate { get => _refDate; set => _refDate = value; } + /// + /// Reference temperature + /// + public Double RefTemp { get => _refTemp; set => _refTemp = value; } + /// + /// Time Of Flight + /// + public Double Tof { get => _tof; set => _tof = value; } } } diff --git a/Common/Hardware/WaterMeter/Genesis/Protocols/StreamingProtocol/StreamingDecoder.cs b/Common/Hardware/WaterMeter/Genesis/Protocols/StreamingProtocol/StreamingDecoder.cs index 233e191e..c8542806 100644 --- a/Common/Hardware/WaterMeter/Genesis/Protocols/StreamingProtocol/StreamingDecoder.cs +++ b/Common/Hardware/WaterMeter/Genesis/Protocols/StreamingProtocol/StreamingDecoder.cs @@ -371,9 +371,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol - dataProtHRec.RAWTotalTimeOfFlight = + dataProtHRec.RawTotalTimeOfFlight = int.Parse(field[(Int32)ProtHsubString.Ttof], NumberStyles.AllowHexSpecifier); - dataProtHRec.RAWDeltaTimeOfFlight = int.Parse(field[(Int32)ProtHsubString.Dtof], NumberStyles.AllowHexSpecifier); + dataProtHRec.RawDeltaTimeOfFlight = int.Parse(field[(Int32)ProtHsubString.Dtof], NumberStyles.AllowHexSpecifier); //Delta raw volume between two samples dataProtHRec.DeltaVolumeRaw = uint.Parse(field[(Int32)ProtHsubString.RawDVolume], diff --git a/Common/ProductionUiCordonel/FinalTest.xaml b/Common/ProductionUiCordonel/FinalTest.xaml index b3ca4e68..9c644d0e 100644 --- a/Common/ProductionUiCordonel/FinalTest.xaml +++ b/Common/ProductionUiCordonel/FinalTest.xaml @@ -6,8 +6,8 @@ xmlns:local="clr-namespace:ProductionUiCordonel" xmlns:uc="clr-namespace:ProductionUiCordonel" mc:Ignorable="d" - Title="FinalTest" MinHeight="500" MinWidth="400" Height="603" Width="646" Initialized="Window_Initialized" Closing="Window_Closing"> - + Title="FinalTest" MinHeight="500" MinWidth="600" Height="638" Width="800" Initialized="Window_Initialized" Closing="Window_Closing" PreviewKeyDown="Window_PreviewKeyDown"> + @@ -75,18 +75,19 @@ - - - + + + - + + - public partial class UcBarcodeInput : UserControl { - - public event EventHandler BarcodeInput; - + + public event EventHandler BarcodeInput; + public UcBarcodeInput() { InitializeComponent(); @@ -85,18 +74,28 @@ namespace ProductionUiCordonel.UserControls.FinalTest )); } + public void inputKey(string input) + { + this.Dispatcher.Invoke(DispatcherPriority.Send, + new Action(() => + { + BarcodeInput?.Invoke(this,input); + } + )); + } + private void txtHiddenInput_KeyDown(object sender, KeyEventArgs e) { - if (e.Key == Key.Enter) - { - - BarcodeInput?.Invoke(sender, e); - } - else - { - lblInput.Content = txtHiddenInput.Text; - } - + //if (e.Key == Key.Enter) + //{ + + // BarcodeInput?.Invoke(sender, e); + //} + //else + //{ + // lblInput.Content = txtHiddenInput.Text; + //} + } @@ -105,7 +104,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest this.Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { - txtHiddenInput.Focus(); + //txtHiddenInput.Focus(); } )); } @@ -115,7 +114,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest this.Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { - txtHiddenInput.Focus(); + //txtHiddenInput.Focus(); } )); } diff --git a/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml b/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml index 7324a689..42c90743 100644 --- a/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml +++ b/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml @@ -43,7 +43,7 @@