diff --git a/Common/ProductionUiCordonel/App.xaml.cs b/Common/ProductionUiCordonel/App.xaml.cs index cc3dff1f..38724c1a 100644 --- a/Common/ProductionUiCordonel/App.xaml.cs +++ b/Common/ProductionUiCordonel/App.xaml.cs @@ -8,11 +8,6 @@ namespace ProductionUiCordonel /// public partial class App : Application { - public App() - { - //this.StartupUri = new Uri("MainWindow.xaml"); - //this.StartupUri = new Uri("MultiMode.xaml"); - } private void Application_Startup(Object sender, StartupEventArgs e) { diff --git a/Common/ProductionUiCordonel/ApplicationSettings.cs b/Common/ProductionUiCordonel/ApplicationSettings.cs index 28c2e56a..6c285692 100644 --- a/Common/ProductionUiCordonel/ApplicationSettings.cs +++ b/Common/ProductionUiCordonel/ApplicationSettings.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; using System.IO; +using Newtonsoft.Json; namespace ProductionUiCordonel { diff --git a/Common/ProductionUiCordonel/Data/PickingResultData.cs b/Common/ProductionUiCordonel/Data/PickingResultData.cs index 1a5553cf..a8ca3be1 100644 --- a/Common/ProductionUiCordonel/Data/PickingResultData.cs +++ b/Common/ProductionUiCordonel/Data/PickingResultData.cs @@ -1,4 +1,5 @@ using System; +using System.Windows.Media; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; @@ -24,23 +25,23 @@ public abstract class PickingResultBaseData : IPickingResultData public Boolean HasError { get; set; } - public System.Windows.Media.Brush ResultColor { get { return getColorFromResult(); } } - public abstract Func Action { get; } + public Brush ResultColor => getColorFromResult(); + public abstract Func Action { get; } - private System.Windows.Media.Brush getColorFromResult() + private Brush getColorFromResult() { - var converter = new System.Windows.Media.BrushConverter(); - var brush = (System.Windows.Media.Brush)converter.ConvertFromString("#000000"); + var converter = new BrushConverter(); + var brush = (Brush)converter.ConvertFromString("#000000"); if (Result.HasValue) // && a.Result.Value )) { if (!Result.Value) { - brush = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000"); + brush = (Brush)converter.ConvertFromString("#FF8000"); } else { - brush = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14"); + brush = (Brush)converter.ConvertFromString("#419C14"); } } @@ -61,7 +62,7 @@ public abstract class PickingResultBaseData : IPickingResultData Boolean HasError { get; set; } - System.Windows.Media.Brush ResultColor { get; } + Brush ResultColor { get; } Func Action { get; } } @@ -73,11 +74,11 @@ public abstract class PickingResultBaseData : IPickingResultData public Object CompareObject { get; set; } - public override Func Action { get { return staticReadAndCompareAction(); } } + public override Func Action => staticReadAndCompareAction(); public Func staticReadAndCompareAction() { - return delegate () + return delegate { var retComp = new PickingItemCheckReturn(); retComp.Result = null; @@ -113,8 +114,7 @@ public abstract class PickingResultBaseData : IPickingResultData } public readonly Func _action; - public override Func Action { get { return _action; } } - + public override Func Action => _action; } } diff --git a/Common/ProductionUiCordonel/Data/PressureResultDataNotifyable.cs b/Common/ProductionUiCordonel/Data/PressureResultDataNotifyable.cs index 83b84b5b..d2f7fe2a 100644 --- a/Common/ProductionUiCordonel/Data/PressureResultDataNotifyable.cs +++ b/Common/ProductionUiCordonel/Data/PressureResultDataNotifyable.cs @@ -46,7 +46,7 @@ namespace ProductionUiCordonel.Data public Int32 Rev { - get { return rev; } + get => rev; set { rev = value; @@ -56,7 +56,7 @@ namespace ProductionUiCordonel.Data private Boolean? passed = false; public Boolean? Passed { - get { return passed; } + get => passed; set { passed = value; @@ -69,7 +69,7 @@ namespace ProductionUiCordonel.Data private String testerName = "C. Röhl"; public String TesterName { - get { return testerName; } + get => testerName; set { testerName = value; @@ -80,7 +80,7 @@ namespace ProductionUiCordonel.Data private String testPressure = "6"; public String TestPressure { - get { return testPressure; } + get => testPressure; set { testPressure = value; @@ -92,7 +92,7 @@ namespace ProductionUiCordonel.Data private String leakRate = " 0,00001"; public String LeakRate { - get { return leakRate; } + get => leakRate; set { leakRate = value; @@ -103,7 +103,7 @@ namespace ProductionUiCordonel.Data private String remark = ""; public String Remark { - get { return remark; } + get => remark; set { remark = value; @@ -112,21 +112,22 @@ namespace ProductionUiCordonel.Data } - private ObservableCollection testpoints = new ObservableCollection() { - new PressureTestPoints() { Ident = 1, Input = "2E-07" }, - new PressureTestPoints() { Ident = 2, Input = "2E-07" }, - new PressureTestPoints() { Ident = 3, Input = "2E-07" }, - new PressureTestPoints() { Ident = 4, Input = "2E-07" }, - new PressureTestPoints() { Ident = 5, Input = "2E-07" }, - new PressureTestPoints() { Ident = 6, Input = "2E-07" }, - new PressureTestPoints() { Ident = 7, Input = "2E-07" }, - new PressureTestPoints() { Ident = 8, Input = "2E-07" }, - new PressureTestPoints() { Ident = 9, Input = "2E-07" }, - new PressureTestPoints() { Ident = 10, Input = "2E-07" } + private ObservableCollection testpoints = new ObservableCollection + { + new PressureTestPoints { Ident = 1, Input = "2E-07" }, + new PressureTestPoints { Ident = 2, Input = "2E-07" }, + new PressureTestPoints { Ident = 3, Input = "2E-07" }, + new PressureTestPoints { Ident = 4, Input = "2E-07" }, + new PressureTestPoints { Ident = 5, Input = "2E-07" }, + new PressureTestPoints { Ident = 6, Input = "2E-07" }, + new PressureTestPoints { Ident = 7, Input = "2E-07" }, + new PressureTestPoints { Ident = 8, Input = "2E-07" }, + new PressureTestPoints { Ident = 9, Input = "2E-07" }, + new PressureTestPoints { Ident = 10, Input = "2E-07" } }; public ObservableCollection Testpoints { - get { return testpoints; } + get => testpoints; set { testpoints = value; diff --git a/Common/ProductionUiCordonel/FinalTest.xaml.cs b/Common/ProductionUiCordonel/FinalTest.xaml.cs index bd628968..3869b471 100644 --- a/Common/ProductionUiCordonel/FinalTest.xaml.cs +++ b/Common/ProductionUiCordonel/FinalTest.xaml.cs @@ -209,10 +209,7 @@ namespace ProductionUiCordonel _lastMsg = value; updateUi(lblMessage, _lastMsg); } - get - { - return _lastMsg; - } + get => _lastMsg; } private void updateUi(ContentControl c, String content) { @@ -261,10 +258,7 @@ namespace ProductionUiCordonel } } - get - { - return _currentPcbID; - } + get => _currentPcbID; } private void GetPcbMapping(String pcbID) { diff --git a/Common/ProductionUiCordonel/MainWindow.xaml.cs b/Common/ProductionUiCordonel/MainWindow.xaml.cs index 79df4910..6f4931fc 100644 --- a/Common/ProductionUiCordonel/MainWindow.xaml.cs +++ b/Common/ProductionUiCordonel/MainWindow.xaml.cs @@ -1,6 +1,5 @@ -using Newtonsoft.Json; -using ProductionUiCordonel.Model; -using System; +using System; +using System.ComponentModel; using System.IO; using System.Linq; using System.Net; @@ -9,6 +8,8 @@ using System.Timers; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using Newtonsoft.Json; +using ProductionUiCordonel.Model; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.CommonCore.Consts; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig; @@ -96,10 +97,7 @@ namespace ProductionUiCordonel } } - get - { - return _currentPcbID; - } + get => _currentPcbID; } public enum uiState @@ -116,10 +114,7 @@ namespace ProductionUiCordonel _currentState = value; updateUi(lblState, _currentState.ToString()); } - get - { - return _currentState; - } + get => _currentState; } private String _lastMsg; @@ -130,10 +125,7 @@ namespace ProductionUiCordonel _lastMsg = value; updateUi(lblMessage, _lastMsg); } - get - { - return _lastMsg; - } + get => _lastMsg; } public MainWindow() @@ -231,7 +223,7 @@ namespace ProductionUiCordonel private GenesisMeter CurrentMeter { - get { return _currentMeter; } + get => _currentMeter; set { _currentMeter = value; @@ -279,7 +271,7 @@ namespace ProductionUiCordonel } else { - LastMsg = $"No Meter found"; + LastMsg = "No Meter found"; DisposeAllConnections(); } @@ -314,16 +306,14 @@ namespace ProductionUiCordonel } return hasDetect; } - else - { - LastMsg = "Meter is still connected (locked)"; - return true; - } + + LastMsg = "Meter is still connected (locked)"; + return true; } - private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e) + private void Window_Closing(Object sender, CancelEventArgs e) { DisposeAllConnections(); } @@ -459,7 +449,7 @@ namespace ProductionUiCordonel - ucFinalRadioTest.OrderHasChanged += delegate (Object sender, EventArgs args) + ucFinalRadioTest.OrderHasChanged += delegate { txtOrderNr.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { txtOrderNr.Text = ucFinalRadioTest.OrderNumber.ToString(); })); }; diff --git a/Common/ProductionUiCordonel/Model/MarriageMultiModeViewModel.cs b/Common/ProductionUiCordonel/Model/MarriageMultiModeViewModel.cs index 7ed39bd5..9012588f 100644 --- a/Common/ProductionUiCordonel/Model/MarriageMultiModeViewModel.cs +++ b/Common/ProductionUiCordonel/Model/MarriageMultiModeViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Net; using System.Threading.Tasks; +using System.Windows; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -13,11 +14,11 @@ namespace ProductionUiCordonel.Model private Boolean canMarry; public Boolean CanMarry { - get { return canMarry; } + get => canMarry; set { canMarry = value; - NotifyPropertyChanged(nameof(CanMarry)); + NotifyPropertyChanged(); } } @@ -25,11 +26,11 @@ namespace ProductionUiCordonel.Model private Int32 serialNr; public Int32 SerialNr { - get { return serialNr; } + get => serialNr; set { serialNr = value; - NotifyPropertyChanged(nameof(SerialNr)); + NotifyPropertyChanged(); } } @@ -37,8 +38,8 @@ namespace ProductionUiCordonel.Model private Boolean locked = false; public MarriageMultiModeViewModel(String ctrName, Int32 slotNR, List barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID) { - base.VisibilityMarriage = System.Windows.Visibility.Visible; - base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler; + VisibilityMarriage = Visibility.Visible; + MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler; } internal async Task Store() @@ -74,11 +75,9 @@ namespace ProductionUiCordonel.Model return true; } - else - { - Log($"No result for {url} on Store"); - return false; - } + + Log($"No result for {url} on Store"); + return false; } diff --git a/Common/ProductionUiCordonel/Model/MultiModeChildViewModel.cs b/Common/ProductionUiCordonel/Model/MultiModeChildViewModel.cs index 947867d6..fe6d7edb 100644 --- a/Common/ProductionUiCordonel/Model/MultiModeChildViewModel.cs +++ b/Common/ProductionUiCordonel/Model/MultiModeChildViewModel.cs @@ -1,11 +1,11 @@ -using NLog; -using ProductionUiCordonel.Model; -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Timers; using System.Windows; +using NLog; +using ProductionUiCordonel.Model; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore; using Xylem.Common.Utils.Logging; @@ -29,45 +29,36 @@ namespace ProductionUiCordonel private Visibility visibilityMarriage = Visibility.Collapsed; public Visibility VisibilityMarriage { - get - { - return visibilityMarriage; - } + get => visibilityMarriage; set { visibilityMarriage = value; - NotifyPropertyChanged(nameof(VisibilityMarriage)); + NotifyPropertyChanged(); } } private Visibility visibilityPicking = Visibility.Collapsed; public Visibility VisibilityPicking { - get - { - return visibilityPicking; - } + get => visibilityPicking; set { visibilityPicking = value; - NotifyPropertyChanged(nameof(VisibilityPicking)); + NotifyPropertyChanged(); } } private Visibility visibilityPressure = Visibility.Collapsed; public Visibility VisibilityPressure { - get - { - return visibilityPressure; - } + get => visibilityPressure; set { visibilityPressure = value; - NotifyPropertyChanged(nameof(VisibilityPressure)); + NotifyPropertyChanged(); } } @@ -75,15 +66,12 @@ namespace ProductionUiCordonel public String currentSlotStateText = "none"; public String CurrentSlotStateText { - get - { - return currentSlotStateText; - } + get => currentSlotStateText; set { currentSlotStateText = value; - NotifyPropertyChanged(nameof(CurrentSlotStateText)); + NotifyPropertyChanged(); } } @@ -93,10 +81,7 @@ namespace ProductionUiCordonel private SlotState currentSlotState = SlotState.None; public SlotState CurrentSlotState { - get - { - return currentSlotState; - } + get => currentSlotState; set { currentSlotState = value; @@ -126,10 +111,8 @@ namespace ProductionUiCordonel case SlotState.Fatal: CurrentSlotStateText = "Schwerwiegender Fehler"; break; - default: - break; } - NotifyPropertyChanged(nameof(CurrentSlotState)); + NotifyPropertyChanged(); } } @@ -137,11 +120,11 @@ namespace ProductionUiCordonel private String slotInfo = "-"; public String SlotInfo { - get { return slotInfo; } + get => slotInfo; set { slotInfo = value; - NotifyPropertyChanged(nameof(SlotInfo)); + NotifyPropertyChanged(); } } @@ -160,37 +143,34 @@ namespace ProductionUiCordonel private String childName = "asd"; public String ChildName { - get { return childName; } + get => childName; set { childName = value; - NotifyPropertyChanged(nameof(ChildName)); + NotifyPropertyChanged(); } } private String order; public String Order { - get { return order; } + get => order; set { order = value; - NotifyPropertyChanged(nameof(Order)); + NotifyPropertyChanged(); } } public String CurrentPcbID { - get - { - return _currentPcbID; - } + get => _currentPcbID; set { _currentPcbID = value; - NotifyPropertyChanged(nameof(CurrentPcbID)); + NotifyPropertyChanged(); } } @@ -294,7 +274,7 @@ namespace ProductionUiCordonel } else { - Log($"No Meter found"); + Log("No Meter found"); DisposeAllConnections(); } @@ -325,11 +305,9 @@ namespace ProductionUiCordonel } return hasDetect; } - else - { - Log("Meter is still connected (locked)"); - return true; - } + + Log("Meter is still connected (locked)"); + return true; } private void DisposeAllConnections() diff --git a/Common/ProductionUiCordonel/Model/MultiModeMasterViewModel.cs b/Common/ProductionUiCordonel/Model/MultiModeMasterViewModel.cs index a1386b0d..ecb9affd 100644 --- a/Common/ProductionUiCordonel/Model/MultiModeMasterViewModel.cs +++ b/Common/ProductionUiCordonel/Model/MultiModeMasterViewModel.cs @@ -1,6 +1,4 @@ -using Logic.ProductionToProductMapper.Cordonel; -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO.Ports; @@ -8,10 +6,14 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; +using System.Windows.Media; +using Logic.ProductionToProductMapper.Cordonel; +using Newtonsoft.Json; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore; +using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; using Xylem.Common.Logic.SoftwareAccessHelper; namespace ProductionUiCordonel.Model @@ -23,65 +25,50 @@ namespace ProductionUiCordonel.Model private String pickingSlot = "-"; private String pickingResult = "-"; - private System.Windows.Media.Brush pickingResultColor; - public System.Windows.Media.Brush PickingResultColor + private Brush pickingResultColor; + public Brush PickingResultColor { - get - { - return pickingResultColor; - } + get => pickingResultColor; set { pickingResultColor = value; - NotifyPropertyChanged(nameof(PickingResultColor)); + NotifyPropertyChanged(); } } public String PickingState { - get - { - return pickingState; - } + get => pickingState; set { pickingState = value; - NotifyPropertyChanged(nameof(PickingState)); + NotifyPropertyChanged(); } } public String PickingScanner { - get - { - return pickingScanner; - } + get => pickingScanner; set { pickingScanner = value; - NotifyPropertyChanged(nameof(PickingScanner)); + NotifyPropertyChanged(); } } public String PickingSlot { - get - { - return pickingSlot; - } + get => pickingSlot; set { pickingSlot = value; - NotifyPropertyChanged(nameof(PickingSlot)); + NotifyPropertyChanged(); } } public String PickingResult { - get - { - return pickingResult; - } + get => pickingResult; set { pickingResult = value; - NotifyPropertyChanged(nameof(PickingResult)); + NotifyPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; @@ -147,13 +134,11 @@ namespace ProductionUiCordonel.Model isRuning = false; break; } - else - { - Input = a.ReadLine(); - a.Close(); - isRuning = false; - break; - } + + Input = a.ReadLine(); + a.Close(); + isRuning = false; + break; } } @@ -185,14 +170,14 @@ namespace ProductionUiCordonel.Model meter.SetupFromConfigFile(PickingSlotNr); Batch.AddMeter(meter); PickingState = "Am Zähler anmelden"; - if ((Boolean)meter.Login()) + if (meter.Login()) { - meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted); + meter.SetProcessState(DisplayCodes.PickingStarted); var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter); if (ret) { - meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested); + meter.SetProcessState(DisplayCodes.PickingTested); var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={PickingOrder}"; var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url); @@ -205,7 +190,7 @@ namespace ProductionUiCordonel.Model } else { - meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed); + meter.SetProcessState(DisplayCodes.PickingFailed); } } } @@ -215,7 +200,7 @@ namespace ProductionUiCordonel.Model private Boolean RunCheck(Dictionary checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent, GenesisMeter meter) { - PickingState = $"Üperprüfe Parameter"; + PickingState = "Üperprüfe Parameter"; var FrequencyReadOut = RegisterConverter.ConvertTo(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator")); if (FrequencyReadOut != Frequency) { @@ -236,11 +221,11 @@ namespace ProductionUiCordonel.Model { if (PressurePresent) { - PickingState = $"Pcb mit Drucksensor. Laut Auftrag keine verbaut"; + PickingState = "Pcb mit Drucksensor. Laut Auftrag keine verbaut"; } else { - PickingState = $"Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden"; + PickingState = "Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden"; } //todo raus return false; @@ -254,14 +239,14 @@ namespace ProductionUiCordonel.Model var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId); if (MeterFWApp == null || MeterFWApp.Version != item.Value) { - PickingState = $"Falsche FW, bitte Updaten"; + PickingState = "Falsche FW, bitte Updaten"; return false; } } catch (Exception) { - PickingState = $"Fehler beim auslesen der FW"; + PickingState = "Fehler beim auslesen der FW"; return false; } @@ -276,14 +261,14 @@ namespace ProductionUiCordonel.Model var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration"); if (!storeRet.All(a => a.Equals(0))) { - PickingState = $"Filesystem corrupt"; + PickingState = "Filesystem corrupt"; return false; } } catch (Exception) { - PickingState = $"Fehler beim überprüfen des Filesystems"; + PickingState = "Fehler beim überprüfen des Filesystems"; return false; } @@ -347,7 +332,7 @@ namespace ProductionUiCordonel.Model { try { - PickingState = $"Warte auf Pcb"; + PickingState = "Warte auf Pcb"; PickingSlot = $"Öffne EP {PickingSlotNr}"; tryMeter.SetupFromConfigFile(PickingSlotNr); Batch.AddMeter(tryMeter); @@ -367,7 +352,7 @@ namespace ProductionUiCordonel.Model else { PickingSlot = $"Keine Konnektivität EP {PickingSlotNr}"; - Log($"No Meter found"); + Log("No Meter found"); } @@ -413,11 +398,11 @@ namespace ProductionUiCordonel.Model PickingState = $"Vergleiche Auftragsdaten {PickingOrder} mit Pcb Eigenschaften"; - var converter = new System.Windows.Media.BrushConverter(); + var converter = new BrushConverter(); if (Compare(PickingOrderDetails.CheckAppsIdVersion, PickingOrderDetails.FrequencyIndicator, PickingOrderDetails.MeterSize, PickingOrderDetails.PressurePresent)) { //erfolg anzeigen und weiter - var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14"); + var b = (Brush)converter.ConvertFromString("#419C14"); b.Freeze(); PickingResultColor = b; sm = PickingStateMachine.MeterDone; @@ -426,15 +411,15 @@ namespace ProductionUiCordonel.Model { sm = PickingStateMachine.MeterError; - var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000"); + var b = (Brush)converter.ConvertFromString("#FF8000"); b.Freeze(); PickingResultColor = b; } break; case PickingStateMachine.MeterError: PickingOrderDetails = null; - PickingState = $"Vergleich abgeschlossen"; - PickingResult = $"Vergleich fertig fehlgeschlagen"; + PickingState = "Vergleich abgeschlossen"; + PickingResult = "Vergleich fertig fehlgeschlagen"; Thread.Sleep(10000); sm = PickingStateMachine.StartCom; @@ -442,7 +427,7 @@ namespace ProductionUiCordonel.Model case PickingStateMachine.MeterDone: - PickingState = $"Vergleich abgeschlossen warten auf Montage Rückmeldung"; + PickingState = "Vergleich abgeschlossen warten auf Montage Rückmeldung"; PickingResult = $"Pcb {PickingPcbId} wurde dem Auftrag {PickingOrder} hinzugefügt"; Thread.Sleep(10000); PickingScanner = $"Öfffne {PickingScannerPort}"; @@ -479,12 +464,12 @@ namespace ProductionUiCordonel.Model PickingBarScanner = new BarScanner(PickingScannerPort, token); PickingBarScanner.Start(); - PickingState = $"Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen"; + PickingState = "Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen"; sm = PickingStateMachine.WaitForBuildingPressureReady; } else { - PickingState = $"Montage Rückmeldung erhalten, auftrag Scannen"; + PickingState = "Montage Rückmeldung erhalten, auftrag Scannen"; sm = PickingStateMachine.StartCom; } } @@ -507,13 +492,11 @@ namespace ProductionUiCordonel.Model { } - PickingState = $"Montage Rückmeldung erhalten, auftrag Scannen"; + PickingState = "Montage Rückmeldung erhalten, auftrag Scannen"; sm = PickingStateMachine.StartCom; } } break; - default: - break; } Thread.Sleep(1000); diff --git a/Common/ProductionUiCordonel/Model/PickingMultiModeViewModel.cs b/Common/ProductionUiCordonel/Model/PickingMultiModeViewModel.cs index 17d153bb..e8704730 100644 --- a/Common/ProductionUiCordonel/Model/PickingMultiModeViewModel.cs +++ b/Common/ProductionUiCordonel/Model/PickingMultiModeViewModel.cs @@ -1,7 +1,4 @@ -using Logic.ProductionToProductMapper.Cordonel; -using Newtonsoft.Json; -using ProductionUiCordonel.Data; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; @@ -10,10 +7,15 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Media; +using Logic.ProductionToProductMapper.Cordonel; +using Newtonsoft.Json; +using ProductionUiCordonel.Data; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; +using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; using Xylem.Common.Logic.ProductionOrderCore.OrderData; using Xylem.Common.Logic.SoftwareAccessHelper; +using MessageBox = System.Windows.Forms.MessageBox; namespace ProductionUiCordonel.Model { @@ -23,21 +25,20 @@ namespace ProductionUiCordonel.Model private Boolean inputIsEnabled; public Boolean InputIsEnabled { - get { return inputIsEnabled; } + get => inputIsEnabled; set { inputIsEnabled = value; - NotifyPropertyChanged(nameof(InputIsEnabled)); + NotifyPropertyChanged(); } } - private Boolean locked; - public PickingMultiModeViewModel(String ctrName, Int32 slotNR, List barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID,false) + public PickingMultiModeViewModel(String ctrName, Int32 slotNR, List barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID, false) { VisibilityPicking = Visibility.Visible; - base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler; + MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler; } private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e) @@ -54,20 +55,17 @@ namespace ProductionUiCordonel.Model public override void InputText(String text) { Order = text; - ReloadData(false); + ReloadData(); TextForceUpdate(); } - internal void ReloadData(Boolean reset) + internal void ReloadData() { Task.Run(() => { try { - - - var orderNR = 0; - if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out orderNR)) + if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out var orderNR)) { var str = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={orderNR}"); @@ -81,12 +79,11 @@ namespace ProductionUiCordonel.Model return; } - var retCode = 0; - str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}",out retCode, 15000); + str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}", out var retCode, 15000); if (retCode == 417) { - System.Windows.Forms.MessageBox.Show("NO radio parameter found"); + MessageBox.Show(@"NO radio parameter found"); } if (OrderOverView.Count == OrderOverView.AssignedPicking) @@ -97,61 +94,52 @@ namespace ProductionUiCordonel.Model return; } - try + var OrderDteails = JsonConvert.DeserializeObject(str); + + + if (CurrentMeter != null) { - var OrderDteails = JsonConvert.DeserializeObject(str); - - - if (CurrentMeter != null) + try { - try + + + locked = true; + //Init(CurrentMeter, new Dictionary(), OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent); + + + var a = new Dictionary(); + a.Add(0, 486); + a.Add(15, 287); + if (OrderDteails.FrequencyIndicator == 868) { - - - locked = true; - //Init(CurrentMeter, new Dictionary(), OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent); - - - var a = new Dictionary(); - a.Add(0, 486); - a.Add(15, 287); - if (OrderDteails.FrequencyIndicator == 868) - { - a.Add(24, 1067); - } - else - { - a.Add(24, 1066); - } - - Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent); - - - var r = Run(CurrentMeter.PcbId, orderNR.ToString()); - - if (r) - { - doneCount = doneCount + 1; - } - locked = false; - UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount); + a.Add(24, 1067); } - catch (Exception ex) + else { - Log(ex.Message); + a.Add(24, 1066); } - finally + + Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent); + + + var r = Run(CurrentMeter.PcbId, orderNR.ToString()); + + if (r) { - locked = false; + doneCount = doneCount + 1; } + locked = false; + UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount); + } + catch (Exception ex) + { + Log(ex.Message); + } + finally + { + locked = false; } } - catch (Exception) - { - - throw; - } - } else { @@ -166,7 +154,7 @@ namespace ProductionUiCordonel.Model }); } - private void UpdatePickingUi(String state, System.Windows.Media.Brush StateColor, String order, Int32 toDo, Int32 done) + private void UpdatePickingUi(String state, Brush StateColor, String order, Int32 toDo, Int32 done) { Message = state; Order = order; @@ -209,17 +197,19 @@ namespace ProductionUiCordonel.Model public event EventHandler OnDataChanged; public event EventHandler OnUpdateUi; - public event PropertyChangedEventHandler PropertyChanged; + public new event PropertyChangedEventHandler PropertyChanged; private GenesisMeter currentMeter; - private PickingCompareItem baseFile; - public ObservableCollection Data { get; set; } + public ObservableCollection Data + { + get; set; + } private OverallStatus status = OverallStatus.NoDetect; private OverallStatus Status { - get { return status; } + get => status; set { status = value; @@ -227,7 +217,10 @@ namespace ProductionUiCordonel.Model } } - public String Message { get; set; } + public String Message + { + get; set; + } private enum OverallStatus { NoDetect, @@ -257,7 +250,7 @@ namespace ProductionUiCordonel.Model } } - public System.Windows.Media.Brush StatusColor + public Brush StatusColor { get { @@ -277,8 +270,14 @@ namespace ProductionUiCordonel.Model } } - public Int32 ToDo { get; private set; } - public Int32 Done { get; private set; } + public Int32 ToDo + { + get; private set; + } + public Int32 Done + { + get; private set; + } public void Init(GenesisMeter meter, Dictionary checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent) { @@ -287,48 +286,69 @@ namespace ProductionUiCordonel.Model currentMeter = meter; var data = new List(); - data.Add(new PickingResultCustomCheckData(delegate () + data.Add(new PickingResultCustomCheckData(delegate { - var r = meter.Login(); - meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted); - return new PickingItemCheckReturn() { Result = true, Msg = "done" }; + meter.Login(); + meter.SetProcessState(DisplayCodes.PickingStarted); + return new PickingItemCheckReturn { Result = true, Msg = "done" }; }) - { Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, CurrentValueText = "-" }); + { + Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, + CurrentValueText = "-" + }); - data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = $"{Frequency}MHz", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ; + data.Add(new PickingResultRegisterData + { + ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = $"{Frequency}MHz", + CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, + RegisterIdent = "SENSUSRADIO_FrequencyIndicator" + }); - data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" }); + data.Add(new PickingResultRegisterData + { + ReadMeter = meter, Index = data.Count, Ident = "MeterSize", + CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, + Result = null, RegisterIdent = "GENESISFLOW_MeterSize" + }); - data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Pressure", CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false, Result = null, RegisterIdent = "METROLOGYASST_PressurePresent" }); + data.Add(new PickingResultRegisterData + { + ReadMeter = meter, Index = data.Count, Ident = "Pressure", + CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false, + Result = null, RegisterIdent = "METROLOGYASST_PressurePresent" + }); foreach (var item in checkAppsIdVersion) { - data.Add(new PickingResultCustomCheckData(delegate () + data.Add(new PickingResultCustomCheckData(delegate { try { var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId); - if (MeterFWApp == null || MeterFWApp.Version != item.Value) + if (MeterFWApp.Version != item.Value) { - return new PickingItemCheckReturn() { Result = false, Msg = MeterFWApp.StrVersion }; + return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion }; } - return new PickingItemCheckReturn() { Result = true, Msg = MeterFWApp.StrVersion }; + return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion }; } catch (Exception) { - return new PickingItemCheckReturn() { Result = false, Msg = "error" }; + return new PickingItemCheckReturn { Result = false, Msg = "error" }; } }) - { Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}", HasError = false, Result = null, CurrentValueText = "-" }); ; + { + Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}", + HasError = false, Result = null, CurrentValueText = "-" + }); } - data.Add(new PickingResultCustomCheckData(delegate () + data.Add(new PickingResultCustomCheckData(delegate { try { @@ -337,20 +357,23 @@ namespace ProductionUiCordonel.Model var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration"); if (storeRet.All(a => a.Equals(0))) { - return new PickingItemCheckReturn() { Result = true, Msg = "Filesystem OK" }; + return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" }; } - return new PickingItemCheckReturn() { Result = false, Msg = "Filesystem corrupt" }; + return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" }; } catch (Exception) { - return new PickingItemCheckReturn() { Result = false, Msg = "error" }; + return new PickingItemCheckReturn { Result = false, Msg = "error" }; } }) - { Index = data.Count, Ident = $"Check Filesystem", CheckText = $"Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ; - + { + Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false, + Result = null, CurrentValueText = "checking" + }); + Status = OverallStatus.CheckingIsRunning; ChangeDataData(data); } @@ -373,12 +396,11 @@ namespace ProductionUiCordonel.Model if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value)) { - currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested); + currentMeter.SetProcessState(DisplayCodes.PickingTested); var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}"; var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url); - var result = false; - if (bool.TryParse(RetString, out result)) + if (bool.TryParse(RetString, out var result)) { Status = OverallStatus.CheckingIsDone; return result; @@ -390,23 +412,18 @@ namespace ProductionUiCordonel.Model return false; } + + currentMeter.SetProcessState(DisplayCodes.PickingFailed); + if (tmpData.All(a => a.HasError)) + { + Status = OverallStatus.CheckingIsHasError; + } else { - currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed); - if (tmpData.All(a => a.HasError)) - { - Status = OverallStatus.CheckingIsHasError; - } - else - { - Status = OverallStatus.CheckingIsNoMatch; - } - - return false; + Status = OverallStatus.CheckingIsNoMatch; } - - + return false; } internal void Empty() @@ -415,5 +432,9 @@ namespace ProductionUiCordonel.Model ChangeDataData(new List()); } + protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) + { + PropertyChanged?.Invoke(this, e); + } } } diff --git a/Common/ProductionUiCordonel/Model/PickingViewModel.cs b/Common/ProductionUiCordonel/Model/PickingViewModel.cs index 8c2425f7..af11b5fc 100644 --- a/Common/ProductionUiCordonel/Model/PickingViewModel.cs +++ b/Common/ProductionUiCordonel/Model/PickingViewModel.cs @@ -1,14 +1,15 @@ -using Logic.ProductionToProductMapper.Cordonel; -using ProductionUiCordonel.Data; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Threading; using System.Windows.Media; +using Logic.ProductionToProductMapper.Cordonel; +using ProductionUiCordonel.Data; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; +using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; using Xylem.Common.Logic.SoftwareAccessHelper; namespace ProductionUiCordonel.Model @@ -23,14 +24,10 @@ namespace ProductionUiCordonel.Model public ObservableCollection Data { get; set; } - public PickingViewModel() - { - - } private OverallStatus status = OverallStatus.NoDetect; private OverallStatus Status { - get { return status; } + get => status; set { status = value; @@ -68,7 +65,7 @@ namespace ProductionUiCordonel.Model } } - public System.Windows.Media.Brush StatusColor + public Brush StatusColor { get { @@ -96,39 +93,39 @@ namespace ProductionUiCordonel.Model currentMeter = meter; var data = new List(); - data.Add(new PickingResultCustomCheckData(delegate () - { + data.Add(new PickingResultCustomCheckData(delegate + { var r = meter.Login(); - meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted); - return new PickingItemCheckReturn() { Result = true, Msg = "done" }; + meter.SetProcessState(DisplayCodes.PickingStarted); + return new PickingItemCheckReturn { Result = true, Msg = "done" }; }) { Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, CurrentValueText = "-" }); if (Frequency != 0) { - data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = "433", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ; + data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = "433", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ; - data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" }); + data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" }); } foreach (var item in checkAppsIdVersion) { - data.Add(new PickingResultCustomCheckData(delegate () - { + data.Add(new PickingResultCustomCheckData(delegate + { try { var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId); if (MeterFWApp == null || MeterFWApp.Version != item.Value) { - return new PickingItemCheckReturn() { Result = false, Msg = MeterFWApp.StrVersion }; + return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion }; } - return new PickingItemCheckReturn() { Result = true, Msg = MeterFWApp.StrVersion }; + return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion }; } catch (Exception) { - return new PickingItemCheckReturn() { Result = false, Msg = "error" }; + return new PickingItemCheckReturn { Result = false, Msg = "error" }; } }) @@ -136,7 +133,7 @@ namespace ProductionUiCordonel.Model } - data.Add(new PickingResultCustomCheckData(delegate () + data.Add(new PickingResultCustomCheckData(delegate { try { @@ -145,19 +142,19 @@ namespace ProductionUiCordonel.Model var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration"); if (storeRet.All(a => a.Equals(0))) { - return new PickingItemCheckReturn() { Result = true, Msg = "Filesystem OK" }; + return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" }; } - return new PickingItemCheckReturn() { Result = false, Msg = "Filesystem corrupt" }; + return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" }; } catch (Exception) { - return new PickingItemCheckReturn() { Result = false, Msg = "error" }; + return new PickingItemCheckReturn { Result = false, Msg = "error" }; } }) - { Index = data.Count, Ident = $"Check Filesystem", CheckText = $"Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ; + { Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ; Status = OverallStatus.CheckingIsRunning; ChangeDataData(data); @@ -181,7 +178,7 @@ namespace ProductionUiCordonel.Model if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value)) { - currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested); + currentMeter.SetProcessState(DisplayCodes.PickingTested); var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}"; var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url); @@ -198,21 +195,19 @@ namespace ProductionUiCordonel.Model return false; } + + currentMeter.SetProcessState(DisplayCodes.PickingFailed); + if (tmpData.All(a => a.HasError)) + { + Status = OverallStatus.CheckingIsHasError; + } else { - currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed); - if (tmpData.All(a => a.HasError)) - { - Status = OverallStatus.CheckingIsHasError; - } - else - { - Status = OverallStatus.CheckingIsNoMatch; - } - - return false; + Status = OverallStatus.CheckingIsNoMatch; } + return false; + } diff --git a/Common/ProductionUiCordonel/Model/PressureMultiModeViewModel.cs b/Common/ProductionUiCordonel/Model/PressureMultiModeViewModel.cs index 0a74e9ed..f121524a 100644 --- a/Common/ProductionUiCordonel/Model/PressureMultiModeViewModel.cs +++ b/Common/ProductionUiCordonel/Model/PressureMultiModeViewModel.cs @@ -1,12 +1,14 @@ -using Newtonsoft.Json; -using ProductionUiCordonel.Data; -using ProductionUiCordonel.Event; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; +using System.Windows; +using Newtonsoft.Json; +using ProductionUiCordonel.Data; +using ProductionUiCordonel.Event; using Xylem.Common.CommonCore.Configuration; +using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts; using Xylem.Common.Logic.ProductionOrderCore.ProcessState; using Xylem.Common.Logic.ProductionOrderCore.TestResults; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -21,11 +23,11 @@ namespace ProductionUiCordonel.Model private PressureResultDataNotifyable result = new PressureResultDataNotifyable(); public PressureResultDataNotifyable Result { - get { return result; } + get => result; set { result = value; - NotifyPropertyChanged(nameof(Result)); + NotifyPropertyChanged(); } } @@ -33,11 +35,11 @@ namespace ProductionUiCordonel.Model private Boolean inputIsEnabled; public Boolean InputIsEnabled { - get { return inputIsEnabled; } + get => inputIsEnabled; set { inputIsEnabled = value; - NotifyPropertyChanged(nameof(InputIsEnabled)); + NotifyPropertyChanged(); } } @@ -47,7 +49,7 @@ namespace ProductionUiCordonel.Model public PressureMultiModeViewModel(String ctrName, Int32 slotNR, List barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID) { - base.VisibilityPressure = System.Windows.Visibility.Visible; + VisibilityPressure = Visibility.Visible; StationID = stationID; } @@ -75,7 +77,7 @@ namespace ProductionUiCordonel.Model { } - Result = new PressureResultDataNotifyable() { Remark = "loading", Testpoints = new ObservableCollection(), PcbId = "" }; + Result = new PressureResultDataNotifyable { Remark = "loading", Testpoints = new ObservableCollection(), PcbId = "" }; Task.Run(() => { try @@ -98,7 +100,7 @@ namespace ProductionUiCordonel.Model return new PressureResultDataNotifyable(); } - }).ContinueWith((a) => + }).ContinueWith(a => { var res = a.Result; res.PcbId = CurrentPcbID; @@ -119,7 +121,7 @@ namespace ProductionUiCordonel.Model { InputIsEnabled = false; var isStored = false; - var status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed; + var status = DisplayCodes.PressureTestedFailed; Task.Run(() => { @@ -127,13 +129,13 @@ namespace ProductionUiCordonel.Model if (successfull) { - status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested; + status = DisplayCodes.PressureTested; } try { if (StationID == 1) { - var addResult = new PressureTestResult() + var addResult = new PressureTestResult { FreeText = Result.Remark, Passed = successfull, @@ -145,19 +147,19 @@ namespace ProductionUiCordonel.Model if (!LocalWebRequest.PostRequestAsync(url, json: addResult)) { - throw new ApplicationException($"PressureState: NOT successful"); + throw new ApplicationException("PressureState: NOT successful"); } } else { - url = url + $"SetPressureStateDetailed"; + url = url + "SetPressureStateDetailed"; var mutedResult = Result.ToBase(); isStored = LocalWebRequest.PostRequestAsync(url, json: mutedResult); if (!isStored) { OnStoreDone?.Invoke(null, new StringArgs("Can not store Result")); - status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed; + status = DisplayCodes.PressureTestedFailed; } } @@ -168,12 +170,12 @@ namespace ProductionUiCordonel.Model catch (Exception ex) { Log(ex.Message); - status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed; + status = DisplayCodes.PressureTestedFailed; OnStoreDone?.Invoke(null, new StringArgs("Can not store Result")); } - if (status == Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested) + if (status == DisplayCodes.PressureTested) { OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. Meter can passed")); return; diff --git a/Common/ProductionUiCordonel/MultiMode.xaml.cs b/Common/ProductionUiCordonel/MultiMode.xaml.cs index 742b4da3..c8b01f79 100644 --- a/Common/ProductionUiCordonel/MultiMode.xaml.cs +++ b/Common/ProductionUiCordonel/MultiMode.xaml.cs @@ -1,9 +1,10 @@ -using ProductionUiCordonel.Model; -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Windows; +using System.Windows.Controls; using System.Windows.Input; +using ProductionUiCordonel.Model; namespace ProductionUiCordonel { @@ -45,7 +46,7 @@ namespace ProductionUiCordonel DataContext = multiModeMasterViewModel; InitializeComponent(); - this.Topmost = false; + Topmost = false; } private void keyUp(Object sender, KeyEventArgs e) { @@ -165,7 +166,7 @@ namespace ProductionUiCordonel throw new NotImplementedException(); } - private void TxtBarcodeInput_TextChanged(Object sender, System.Windows.Controls.TextChangedEventArgs e) + private void TxtBarcodeInput_TextChanged(Object sender, TextChangedEventArgs e) { //if (sender is TextBox text) //{ @@ -188,7 +189,7 @@ namespace ProductionUiCordonel } - private void Window_Closed(Object sender, System.EventArgs e) + private void Window_Closed(Object sender, EventArgs e) { cts.Cancel(); diff --git a/Common/ProductionUiCordonel/MultiModeChild.xaml.cs b/Common/ProductionUiCordonel/MultiModeChild.xaml.cs index a867e692..99e3dab9 100644 --- a/Common/ProductionUiCordonel/MultiModeChild.xaml.cs +++ b/Common/ProductionUiCordonel/MultiModeChild.xaml.cs @@ -1,11 +1,12 @@ -using ProductionUiCordonel.Model; -using System; +using System; using System.IO.Ports; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using ProductionUiCordonel.Event; +using ProductionUiCordonel.Model; namespace ProductionUiCordonel { @@ -24,33 +25,33 @@ namespace ProductionUiCordonel { InitializeComponent(); ViewModel = viewModel; - this.DataContext = ViewModel; + DataContext = ViewModel; if (ViewModel is PressureMultiModeViewModel pressureModel) { PressureControl.setViewModel(pressureModel); - this.Left = 0; - this.Top = 250; - this.Height = SystemParameters.PrimaryScreenHeight - 300; - this.Width = SystemParameters.PrimaryScreenWidth / 2; + Left = 0; + Top = 250; + Height = SystemParameters.PrimaryScreenHeight - 300; + Width = SystemParameters.PrimaryScreenWidth / 2; } if (ViewModel is PickingMultiModeViewModel pickingModel) { PickingControl.setViewModel(pickingModel); - this.Left = SystemParameters.VirtualScreenLeft; - this.Top = SystemParameters.VirtualScreenTop; - this.Height = SystemParameters.VirtualScreenHeight; - this.Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth; + Left = SystemParameters.VirtualScreenLeft; + Top = SystemParameters.VirtualScreenTop; + Height = SystemParameters.VirtualScreenHeight; + Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth; } if (ViewModel is MarriageMultiModeViewModel marriageModel) { MarriageControl.setViewModel(marriageModel); - this.Left = SystemParameters.PrimaryScreenWidth / 2; - this.Top = 250; - this.Height = SystemParameters.PrimaryScreenHeight - 300; - this.Width = SystemParameters.PrimaryScreenWidth / 2; + Left = SystemParameters.PrimaryScreenWidth / 2; + Top = 250; + Height = SystemParameters.PrimaryScreenHeight - 300; + Width = SystemParameters.PrimaryScreenWidth / 2; } @@ -72,17 +73,14 @@ namespace ProductionUiCordonel { break; } - else - { - var resText = a.ReadLine(); - this.Dispatcher.Invoke(DispatcherPriority.Normal, + var resText = a.ReadLine(); + Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => - { - ViewModel.InputText(resText); - } + { + ViewModel.InputText(resText); + } )); - } @@ -110,7 +108,7 @@ namespace ProductionUiCordonel } - private void PressureControl_OnBarcodeInput(Object sender, Event.StringArgs e) + private void PressureControl_OnBarcodeInput(Object sender, StringArgs e) { InputText(e.Content); } @@ -125,7 +123,7 @@ namespace ProductionUiCordonel { if (sender is Button btn) { - btn.Content = $"POS L{this.Left},T{this.Top },H{this.Height},W{this.Width}"; + btn.Content = $"POS L{Left},T{Top },H{Height},W{Width}"; } } diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs index 87d2d75e..c523b7e4 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs @@ -1,9 +1,10 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Linq; using System.Windows.Controls; using System.Windows.Threading; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -52,7 +53,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var url = $"{ServiceUrls.MeterInfoForTestBench()}{Meter.PcbId}"; var csdRet = LocalWebRequest.GetRequest(url); - var res = Newtonsoft.Json.JsonConvert.DeserializeObject(csdRet); + var res = JsonConvert.DeserializeObject(csdRet); var CalibrationRun = res[4]; var LastTestBechState = 0; @@ -88,7 +89,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { - UserControl.lblText.Content = $"Zähler nicht erfolgreich geprüft"; + UserControl.lblText.Content = "Zähler nicht erfolgreich geprüft"; } )); @@ -99,7 +100,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { - UserControl.lblText.Content = $"Zähler nicht erfolgreich vorbehandelt"; + UserControl.lblText.Content = "Zähler nicht erfolgreich vorbehandelt"; } )); currentProcessState = ProductionProcessState.Error; @@ -115,10 +116,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { - UserControl.lblText.Content = $"Batterie nicht lesbar"; + UserControl.lblText.Content = "Batterie nicht lesbar"; } )); - Meter.WriteLog($"Batterie nicht lesbar"); + Meter.WriteLog("Batterie nicht lesbar"); break; } var nowChargeV = BitConverter.ToUInt64(nowCharge.ToArray(), 0); @@ -139,8 +140,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions if (totalUsed > 10) { currentProcessState = ProductionProcessState.Error; - UserControl.lblText.Content = $"Batterie über 15% entladen"; - Meter.WriteLog($"Batterie über 15% entladen"); + UserControl.lblText.Content = "Batterie über 15% entladen"; + Meter.WriteLog("Batterie über 15% entladen"); } if (currentProcessState != ProductionProcessState.Error) diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckAttachment.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckAttachment.cs index 8e44fe3c..466b19d2 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckAttachment.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckAttachment.cs @@ -1,11 +1,12 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Collections.Generic; using System.Windows.Controls; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; using ProductionUiCordonel.UserControls.FinalTest; -using Xylem.Common.Logic.SoftwareAccessHelper; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Logic.ProductionOrderCore.Vako; +using Xylem.Common.Logic.SoftwareAccessHelper; namespace ProductionUiCordonel.ProductionProcesses.Actions { @@ -66,7 +67,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions try { var a = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetSingleVakoKey?ProductionOrderNumber={OrderNumber}&KeyName=C_GEN_PULS"); - var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject(a); + var myJsonResponse = JsonConvert.DeserializeObject(a); if (myJsonResponse.Value.ToLower() == "q" || myJsonResponse.Value.ToLower() == "k") { UserControl.SetDesc("Pulse Module anbauen!"); diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckOrderNumber.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckOrderNumber.cs index 296893d2..b92ef0c0 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckOrderNumber.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckOrderNumber.cs @@ -1,10 +1,10 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; -using System.Windows.Controls; -using ProductionUiCordonel.UserControls.FinalTest; +using System; using System.IO; using System.Net; +using System.Windows.Controls; using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; namespace ProductionUiCordonel.ProductionProcesses.Actions diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckSerialNumber.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckSerialNumber.cs index 3a40ec62..15e5f9e7 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckSerialNumber.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessCheckSerialNumber.cs @@ -1,6 +1,6 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; using ProductionUiCordonel.UserControls.FinalTest; namespace ProductionUiCordonel.ProductionProcesses.Actions diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs index 5cff6a33..11d2c952 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs @@ -1,9 +1,10 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Controls; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Logic.ProductionOrderCore; @@ -23,10 +24,17 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions } public override void InitUserControl() { - UserControl = new UcPlain(); - UserControl.lblHl.Content = name; - UserControl.lblText.Content = ""; - + UserControl = new UcPlain + { + lblHl = + { + Content = name + }, + lblText = + { + Content = "" + } + }; } public override UserControl GetControl() @@ -46,21 +54,21 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions public override void StartProcess() { - NewStatus($"Prüfe Verbindung"); + NewStatus("Prüfe Verbindung"); Progress = 0; if (!Meter.IsLoggedOn) { - NewStatus($"Login wird gestartet"); + NewStatus("Login wird gestartet"); Meter.Login(); } //Check access in Progress = 50; - NewStatus($"Zugang wird überprüft"); + NewStatus("Zugang wird überprüft"); //var res = base.Meter.ReadRegister(Register.Genesisflow.LedMode); //if (res != null && res.Length > 0) //{ Progress = 100; - NewStatus($"Zugang verifiziert"); + NewStatus("Zugang verifiziert"); currentProcessState = ProductionProcessState.Done; asyncProgrammingParametersTask = new Task>(() => @@ -71,7 +79,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}"; var csdRet = LocalWebRequest.GetRequest(url, 80000); - return Newtonsoft.Json.JsonConvert.DeserializeObject>(csdRet); + return JsonConvert.DeserializeObject>(csdRet); } catch (Exception ) diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessDone.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessDone.cs index 284a03d8..e91ab4be 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessDone.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessDone.cs @@ -1,7 +1,7 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Collections.Generic; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; using ProductionUiCordonel.UserControls.FinalTest; namespace ProductionUiCordonel.ProductionProcesses.Actions diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParameterizationVakoCsd.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParameterizationVakoCsd.cs index 15abdfd1..d16b4651 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParameterizationVakoCsd.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParameterizationVakoCsd.cs @@ -1,11 +1,11 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Logic.ProductionOrderCore; @@ -126,7 +126,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //SENSUSRADIO_EncryptionKey dont reserve SENSUSRADIO_EncryptionKey! if (item.RegisterName.ToLower().Contains("displaypow".ToLower()) || item.RegisterName.ToLower().Contains("METROLOGYASST_FlowPoint".ToLower())) { - overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, new Byte[] { item.RegisterValue.ToArray()[0] }, true, true)); + overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, new[] { item.RegisterValue.ToArray()[0] }, true, true)); } else if (item.RegisterName.ToLower().Contains("SENSUSRADIO_EncryptionKey".ToLower())) { @@ -146,9 +146,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //} } - overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmEnableMask", new Byte[] { 0x00, 0x00, 0x80, 0x53 }.Reverse().ToArray(), true, false)); ; - overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false)); - overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false)); + overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmEnableMask", new Byte[] { 0x00, 0x00, 0x80, 0x53 }.Reverse().ToArray())); ; + overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray())); + overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray())); foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Csd)) @@ -166,7 +166,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions } overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators", - (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false)); + (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray())); @@ -179,15 +179,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions overAllResult.Add(wirteRegisterInBetweenCheck("IRDA_MfgDate", Convert.ToInt32(ts.TotalSeconds))); overAllResult.Add(_currentGenesis_WriteRegister("LOGGER_TriggerLogFlush", - (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false)); + (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray())); overAllResult.Add(_currentGenesis_WriteRegister("NFC_EraseRMA", - (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false)); + (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray())); if (hasRadio) { overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter", - (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false)); + (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray())); overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay", (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true)); @@ -231,7 +231,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions } - Progress = 15 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 85, 0)); + Progress = 15 + ((Int32)Math.Round((done / (Double)overAllResult.Count) * 85, 0)); done = done + 1; } @@ -252,7 +252,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { currentProcessState = ProductionProcessState.Error; reTrysLeft = -1; - NewStatus($"Warnung!Fehler beim laden des Parametersatzes"); + NewStatus("Warnung!Fehler beim laden des Parametersatzes"); } diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParametrizationFix.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParametrizationFix.cs index 963c6943..b112ee4c 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParametrizationFix.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFinalParametrizationFix.cs @@ -1,13 +1,13 @@ -using Newtonsoft.Json; -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows.Controls; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFullReadOut.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFullReadOut.cs index 65615695..d474aa1c 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFullReadOut.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessFullReadOut.cs @@ -1,9 +1,9 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Linq; using System.Windows.Controls; using System.Windows.Threading; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; namespace ProductionUiCordonel.ProductionProcesses.Actions diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessGetFinalParametrizationVakoCsd.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessGetFinalParametrizationVakoCsd.cs index 1cd01f38..e809c3bf 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessGetFinalParametrizationVakoCsd.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessGetFinalParametrizationVakoCsd.cs @@ -1,9 +1,10 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Logic.ProductionOrderCore; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -54,7 +55,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}"; var csdRet = LocalWebRequest.GetRequest(url, 60000); - Result = Newtonsoft.Json.JsonConvert.DeserializeObject>(csdRet); + Result = JsonConvert.DeserializeObject>(csdRet); Progress = 100; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessLogOff.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessLogOff.cs index acceef95..b913711b 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessLogOff.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessLogOff.cs @@ -1,10 +1,10 @@ -using Logic.ProductionToProductMapper.Cordonel; -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Reflection; using System.Windows.Controls; +using Logic.ProductionToProductMapper.Cordonel; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Logic.SoftwareAccessHelper; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs index f71c500e..f96becb9 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs @@ -1,12 +1,12 @@ -using Newtonsoft.Json; -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Windows.Controls; +using Newtonsoft.Json; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -80,7 +80,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions } updateImage(UserControl.WriteToMeter, ret); Progress = Progress + 16; - //Check if new password is in the meter ... even the file wirte wasnt succesfull + //Check if new password is in the meter ... even the file write wasn't successful if (!ret) { Meter.Logout(); @@ -137,7 +137,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions private MeterPwdFile meterPwdFile; public Boolean RequestPassword() { - NewStatus($"Request Passwords"); + NewStatus("Request Passwords"); var url = ServiceUrls.GenesisGetPasswordContainerServiceUrl(); //url = "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId="; url = ($"{url}{Meter.PcbId}"); @@ -150,7 +150,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions if (errorCode == HttpStatusCode.OK.GetHashCode()) { pwContainer = JsonConvert.DeserializeObject(resp); - NewStatus($"Passwörter verfügbar"); + NewStatus("Passwörter verfügbar"); return true; } return false; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRadioCheck.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRadioCheck.cs index 669b6e04..41d0a0e7 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRadioCheck.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRadioCheck.cs @@ -1,20 +1,23 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; +using System.Configuration; using System.Linq; +using System.Net.Http; using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; -using ProductionUiCordonel.UserControls.FinalTest; using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Threading; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; +using SIRTCOM; +using Xylem.Common.CommonCore.Configuration; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; -using Newtonsoft.Json; -using Xylem.Common.CommonCore.Configuration; -using System.Configuration; -using System.Net.Http; -using System.Windows.Threading; -using Newtonsoft.Json.Linq; using Xylem.Common.Logic.SoftwareAccessHelper; +using Button = System.Windows.Controls.Button; +using UserControl = System.Windows.Controls.UserControl; namespace ProductionUiCordonel.ProductionProcesses.Actions { @@ -33,12 +36,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { UserControl = new UcRadioCheck(); - UserControl.OnRetryRequested += delegate (Object sender, EventArgs args) { GetRssi(); }; + UserControl.OnRetryRequested += delegate { GetRssi(); }; - UserControl.OnResetRequested += delegate (Object sender, EventArgs args) { Reset(); }; - UserControl.OnForceAPam += delegate (Object sender, EventArgs args) { forcePush(); }; - UserControl.OnDoneRequested += delegate (Object sender, EventArgs args) + UserControl.OnResetRequested += delegate { Reset(); }; + UserControl.OnForceAPam += delegate { forcePush(); }; + UserControl.OnDoneRequested += delegate { currentProcessState = ProductionProcessState.Done; @@ -86,7 +89,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions EncyptionKey = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetEncryptionKey?PcbID={Meter.PcbId}", 80000).ToUpper().Trim('\"'); if (!EncyptionKey.Equals(BitConverter.ToString(enc.ToArray()).Replace("-", ""))) { - System.Windows.Forms.MessageBox.Show("Funkschlüssel überprüfen!"); + MessageBox.Show("Funkschlüssel überprüfen!"); } EncyptionKey = BitConverter.ToString(enc.ToArray()).Replace("-", ""); @@ -99,9 +102,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //{ // Comport = 7; //} - BoxNr = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtBoxNr"]); + BoxNr = Convert.ToByte(ConfigurationManager.AppSettings["SirtBoxNr"]); - DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAddress:{RadioAdress}s\r\n", false); + DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAddress:{RadioAdress}s\r\n"); Meter.WriteRegister("SENSUSRADIO_IrDAModulePresent", 1, true, true); @@ -116,7 +119,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions #region FormerForm private SaveData saveData; - private SIRTCOM.Statemashine stm; + private Statemashine stm; private static HttpClient httpclient; private Byte? RSSI_PAM_Min; @@ -204,7 +207,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions stm.ClearPam(); stm.Stop(); } - DebugMessage("Reset\r\n", false); + DebugMessage("Reset\r\n"); clearRssi(); SetUi(); StartProcess(); @@ -279,14 +282,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions RSSI_PAM = null; RSSI_SEMI = null; - stm = new SIRTCOM.Statemashine(); + stm = new Statemashine(); Byte P81_1 = 0; saveData.RadioAdress = RadioAdress; stm.initialise((Byte)ByteCOMPort); - SIRTCOM.Wrapper wrp = new SIRTCOM.Wrapper(); + Wrapper wrp = new Wrapper(); stm.StartLoggin("C:\\GenesisLog\\log.txt"); // ist wohl nicht nötig da der SIRT richtig konfiguroert ist: @@ -310,7 +313,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions stm.OnStateChanged += Stm_OnStateChanged; stm.Start(); // Start polling - DebugMessage($" OK\r\n", true); + DebugMessage(" OK\r\n", true); Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE); Thread.Sleep(5000); //Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x01, true, false); @@ -324,8 +327,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions private void forcePush() { - Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x55, true, false); - Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x02, true, false); + Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x55); + Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x02); } @@ -373,21 +376,21 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions SetUi(); if (saveData.Result == 1) { - UserControl.ViewResult(10); + UserControl.ViewResult(); } } - private void Stm_OnStateChanged(Object sender, SIRTCOM.MyEventArgs e) + private void Stm_OnStateChanged(Object sender, MyEventArgs e) { // our Pam - SIRTCOM.PAM Pam = stm.GetPAM(1); + PAM Pam = stm.GetPAM(1); - if (Pam.State == SIRTCOM.PAM.PAMStates.Timeout) + if (Pam.State == PAM.PAMStates.Timeout) { - DebugMessage($"Timeout nach {Pam.GetTime()} s\r\n", false); + DebugMessage($"Timeout nach {Pam.GetTime()} s\r\n"); } if (Pam.CountSemi > 0) diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessShippingMode.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessShippingMode.cs index 400f5540..ed6f275a 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessShippingMode.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessShippingMode.cs @@ -1,10 +1,10 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using ProductionUiCordonel.UserControls.FinalTest; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessSpecialConfig.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessSpecialConfig.cs index 927bd7ae..f1cf1da5 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessSpecialConfig.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessSpecialConfig.cs @@ -1,8 +1,8 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; using ProductionUiCordonel.UserControls.FinalTest; namespace ProductionUiCordonel.ProductionProcesses.Actions diff --git a/Common/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs b/Common/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs index 52b39c61..c7dbe591 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs @@ -1,9 +1,9 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; namespace ProductionUiCordonel.ProductionProcesses @@ -13,7 +13,7 @@ namespace ProductionUiCordonel.ProductionProcesses private Int32 _progress; public Int32 Progress { - get { return _progress; } + get => _progress; set { _progress = value; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs b/Common/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs index 4b420f32..96976f1d 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs @@ -1,7 +1,7 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Threading; using System.Windows.Controls; +using ProductionUiCordonel.ProductionProcesses.Enum; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; namespace ProductionUiCordonel.ProductionProcesses diff --git a/Common/ProductionUiCordonel/ProductionProcesses/MultiProcessController.cs b/Common/ProductionUiCordonel/ProductionProcesses/MultiProcessController.cs index 6cbebc2e..5731f06a 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/MultiProcessController.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/MultiProcessController.cs @@ -1,9 +1,9 @@ -using ProductionUiCordonel.ProductionProcesses.Enum; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using ProductionUiCordonel.ProductionProcesses.Enum; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; namespace ProductionUiCordonel.ProductionProcesses diff --git a/Common/ProductionUiCordonel/Properties/Resources.Designer.cs b/Common/ProductionUiCordonel/Properties/Resources.Designer.cs index 25759934..c5794db5 100644 --- a/Common/ProductionUiCordonel/Properties/Resources.Designer.cs +++ b/Common/ProductionUiCordonel/Properties/Resources.Designer.cs @@ -8,10 +8,16 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + namespace ProductionUiCordonel.Properties { - using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,27 +25,27 @@ namespace ProductionUiCordonel.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", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [DebuggerNonUserCode()] + [CompilerGenerated()] internal class Resources { - private static global::System.Resources.ResourceManager resourceMan; + private static ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProductionUiCordonel.Properties.Resources", typeof(Resources).Assembly); + if (ReferenceEquals(resourceMan, null)) { + ResourceManager temp = new ResourceManager("ProductionUiCordonel.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -50,8 +56,8 @@ namespace ProductionUiCordonel.Properties { /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture { get { return resourceCulture; } @@ -63,70 +69,70 @@ namespace ProductionUiCordonel.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap CLEARMAtrix { + internal static Bitmap CLEARMAtrix { get { object obj = ResourceManager.GetObject("CLEARMAtrix", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap Connect_16x { + internal static Bitmap Connect_16x { get { object obj = ResourceManager.GetObject("Connect_16x", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap ConnectPlugged_16x { + internal static Bitmap ConnectPlugged_16x { get { object obj = ResourceManager.GetObject("ConnectPlugged_16x", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap iconCheck { + internal static Bitmap iconCheck { get { object obj = ResourceManager.GetObject("iconCheck", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap iconWarn { + internal static Bitmap iconWarn { get { object obj = ResourceManager.GetObject("iconWarn", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap iconWating { + internal static Bitmap iconWating { get { object obj = ResourceManager.GetObject("iconWating", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap Refresh_16x { + internal static Bitmap Refresh_16x { get { object obj = ResourceManager.GetObject("Refresh_16x", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } diff --git a/Common/ProductionUiCordonel/Properties/Settings.Designer.cs b/Common/ProductionUiCordonel/Properties/Settings.Designer.cs index 9bca8ed4..15aa4dc9 100644 --- a/Common/ProductionUiCordonel/Properties/Settings.Designer.cs +++ b/Common/ProductionUiCordonel/Properties/Settings.Designer.cs @@ -8,16 +8,20 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.Configuration; +using System.Runtime.CompilerServices; + namespace ProductionUiCordonel.Properties { - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + [CompilerGenerated()] + [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : ApplicationSettingsBase { - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); public static Settings Default { diff --git a/Common/ProductionUiCordonel/UserControls/FinalTest/UcBarcodeInput.xaml.cs b/Common/ProductionUiCordonel/UserControls/FinalTest/UcBarcodeInput.xaml.cs index f6f0caf3..afba3ed7 100644 --- a/Common/ProductionUiCordonel/UserControls/FinalTest/UcBarcodeInput.xaml.cs +++ b/Common/ProductionUiCordonel/UserControls/FinalTest/UcBarcodeInput.xaml.cs @@ -66,7 +66,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest internal void SetFocusMe() { - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { txtHiddenInput.Focus(); @@ -76,7 +76,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest public void inputKey(String input) { - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { BarcodeInput?.Invoke(this,input); @@ -101,7 +101,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest private void UserControl_MouseDown(Object sender, MouseButtonEventArgs e) { - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { //txtHiddenInput.Focus(); @@ -111,7 +111,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest private void LblInput_MouseDown(Object sender, MouseButtonEventArgs e) { - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { //txtHiddenInput.Focus(); diff --git a/Common/ProductionUiCordonel/UserControls/FinalTest/UcDialog.xaml.cs b/Common/ProductionUiCordonel/UserControls/FinalTest/UcDialog.xaml.cs index c1722aa5..44f0f20f 100644 --- a/Common/ProductionUiCordonel/UserControls/FinalTest/UcDialog.xaml.cs +++ b/Common/ProductionUiCordonel/UserControls/FinalTest/UcDialog.xaml.cs @@ -76,7 +76,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { var stackPnl = new StackPanel(); diff --git a/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml.cs b/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml.cs index e3ba784e..c4226889 100644 --- a/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml.cs +++ b/Common/ProductionUiCordonel/UserControls/FinalTest/UcRadioCheck.xaml.cs @@ -5,29 +5,30 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Threading; +using Color = System.Drawing.Color; namespace ProductionUiCordonel.UserControls.FinalTest { /// /// Interaction logic for UcRadioCheck.xaml /// - public partial class UcRadioCheck : UserControl + public partial class UcRadioCheck { public class UIContainerElement { public Int32? Value; - public System.Drawing.Color Color; + public Color Color; public UIContainerElement(Int32? value) { Value = value; if (!value.HasValue) { - Color = System.Drawing.Color.LightYellow; + Color = Color.LightYellow; } else { - Color = System.Drawing.Color.Transparent; + Color = Color.Transparent; } } @@ -65,35 +66,35 @@ namespace ProductionUiCordonel.UserControls.FinalTest if (!CordMin.Value.HasValue || CordRssi.Value.Value < CordMin.Value.Value) { success = false; - CordMin.Color = System.Drawing.Color.Tomato; - CordRssi.Color = System.Drawing.Color.White; + CordMin.Color = Color.Tomato; + CordRssi.Color = Color.White; } if (!SirtMin.Value.HasValue || SirtRssi.Value.Value < SirtMin.Value.Value) { success = false; - SirtMin.Color = System.Drawing.Color.Tomato; - SirtRssi.Color = System.Drawing.Color.White; + SirtMin.Color = Color.Tomato; + SirtRssi.Color = Color.White; } if (!CordMax.Value.HasValue || CordRssi.Value.Value > CordMax.Value.Value) { success = false; - CordMax.Color = System.Drawing.Color.Tomato; - CordRssi.Color = System.Drawing.Color.White; + CordMax.Color = Color.Tomato; + CordRssi.Color = Color.White; } if (!SirtMax.Value.HasValue || SirtRssi.Value.Value > SirtMax.Value.Value) { success = false; - SirtMax.Color = System.Drawing.Color.Tomato; - SirtRssi.Color = System.Drawing.Color.White; + SirtMax.Color = Color.Tomato; + SirtRssi.Color = Color.White; } if (success) { - CordRssi.Color = System.Drawing.Color.LightGreen; - SirtRssi.Color = System.Drawing.Color.LightGreen; + CordRssi.Color = Color.LightGreen; + SirtRssi.Color = Color.LightGreen; } } @@ -105,7 +106,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest public void SetUi(UIContainer uiContainer) { - this.Dispatcher.Invoke(DispatcherPriority.Send, + Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => { setLbl(lblCordMin, uiContainer.CordMin); @@ -122,7 +123,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest { lbl.Content = element.GetText(); lbl.Background = - new SolidColorBrush(Color.FromArgb(element.Color.A, element.Color.R, element.Color.G, element.Color.B)); + new SolidColorBrush(System.Windows.Media.Color.FromArgb(element.Color.A, element.Color.R, element.Color.G, element.Color.B)); } @@ -159,8 +160,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest var waitMS = WaitSeconds * 1000; while (waitMS > 0) { + var ms = waitMS; BtnDone.Dispatcher.Invoke(DispatcherPriority.Send, - new Action(() => { BtnDone.Content = $"Done({waitMS / 1000}s)"; } + new Action(() => { BtnDone.Content = $"Done({ms / 1000}s)"; } )); waitMS = waitMS - 1000; @@ -168,7 +170,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest } BtnDone.Dispatcher.Invoke(DispatcherPriority.Send, - new Action(() => { BtnDone.Content = $"Done"; } + new Action(() => { BtnDone.Content = "Done"; } )); OnDoneRequested?.Invoke(this, EventArgs.Empty); }); diff --git a/Common/ProductionUiCordonel/ctls/ctlMultiModeMarriage.xaml.cs b/Common/ProductionUiCordonel/ctls/ctlMultiModeMarriage.xaml.cs index f331c1a1..23351998 100644 --- a/Common/ProductionUiCordonel/ctls/ctlMultiModeMarriage.xaml.cs +++ b/Common/ProductionUiCordonel/ctls/ctlMultiModeMarriage.xaml.cs @@ -1,8 +1,9 @@ using System; -using ProductionUiCordonel.Model; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using ProductionUiCordonel.Model; +using MessageBox = System.Windows.Forms.MessageBox; namespace ProductionUiCordonel.ctls { @@ -32,11 +33,11 @@ namespace ProductionUiCordonel.ctls { if (a.Result) { - System.Windows.Forms.MessageBox.Show("Meter has passed"); + MessageBox.Show("Meter has passed"); } else { - System.Windows.Forms.MessageBox.Show("Meter not has passed"); + MessageBox.Show("Meter not has passed"); } }); diff --git a/Common/ProductionUiCordonel/ctls/ctlMultiModePressure.xaml.cs b/Common/ProductionUiCordonel/ctls/ctlMultiModePressure.xaml.cs index 54c28e3b..1f686ffc 100644 --- a/Common/ProductionUiCordonel/ctls/ctlMultiModePressure.xaml.cs +++ b/Common/ProductionUiCordonel/ctls/ctlMultiModePressure.xaml.cs @@ -1,10 +1,10 @@ -using ProductionUiCordonel.Event; -using ProductionUiCordonel.Model; -using System; +using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using ProductionUiCordonel.Event; +using ProductionUiCordonel.Model; using Xylem.Common.Logic.ProductionOrderCore.TestResults; namespace ProductionUiCordonel.ctls @@ -93,7 +93,7 @@ namespace ProductionUiCordonel.ctls { BarcodeInput = $"{BarcodeInput}{input}"; - if (input == System.Environment.NewLine) + if (input == Environment.NewLine) { var tmpOffset = BarcodeInputActiveOffset.Value; BarcodeInputActiveOffset = null;