stuff
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
namespace CordonelAssemblyLine.Model
|
||||
{
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class ExeConfig
|
||||
{
|
||||
public static readonly string DllFilePath
|
||||
= typeof(ExeConfig).Assembly.Location;
|
||||
public static readonly ExeConfig Current = new ExeConfig();
|
||||
|
||||
public int PickingSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
_ = int.TryParse(GetValue(), out var value);
|
||||
|
||||
return value;
|
||||
}
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public string PickingBarcode
|
||||
{
|
||||
get => GetValue();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public int LeakSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
_ = int.TryParse(GetValue(), out var value);
|
||||
|
||||
return value;
|
||||
}
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public int LeakStationId
|
||||
{
|
||||
get
|
||||
{
|
||||
_ = int.TryParse(GetValue(), out var value);
|
||||
|
||||
return value;
|
||||
}
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public string LeakTester
|
||||
{
|
||||
get => GetValue();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public int MarriageSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
_ = int.TryParse(GetValue(), out var value);
|
||||
|
||||
return value;
|
||||
}
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public string MarriageBarcode
|
||||
{
|
||||
get => GetValue();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
private static string GetValue([CallerMemberName] string key = "")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return default(string);
|
||||
}
|
||||
|
||||
var configuration = ConfigurationManager.OpenExeConfiguration(DllFilePath);
|
||||
var settings = configuration?.AppSettings?.Settings ?? new KeyValueConfigurationCollection();
|
||||
|
||||
if (!settings.AllKeys.Contains(key))
|
||||
{
|
||||
return default(string);
|
||||
}
|
||||
|
||||
return settings[key].Value;
|
||||
}
|
||||
|
||||
private static void SetValue(object value, [CallerMemberName] string key = "")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dll = typeof(ExeConfig).Assembly.Location;
|
||||
var configuration = ConfigurationManager.OpenExeConfiguration(DllFilePath);
|
||||
var settings = configuration?.AppSettings?.Settings ?? new KeyValueConfigurationCollection();
|
||||
|
||||
if (!settings.AllKeys.Contains(key))
|
||||
{
|
||||
settings.Add(key, string.Empty);
|
||||
}
|
||||
|
||||
settings[key].Value = $"{value}";
|
||||
|
||||
configuration.Save(ConfigurationSaveMode.Modified);
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,6 @@ namespace CordonelAssemblyLine.Model
|
||||
|
||||
|
||||
private Timer tmrAutoDetect;
|
||||
private readonly Stichproben.Cordonel.Stichproben stichproben;
|
||||
|
||||
public LeakViewModel(Int32 slotNR, Int32? stationID = null)
|
||||
{
|
||||
@@ -161,8 +160,6 @@ namespace CordonelAssemblyLine.Model
|
||||
$"2x10-7 { System.Environment.NewLine} " +
|
||||
$"2*10^-7 { System.Environment.NewLine} " +
|
||||
"0,0000002";
|
||||
|
||||
this.stichproben = new Stichproben.Cordonel.Stichproben(typeof(LeakViewModel).Assembly.Location);
|
||||
}
|
||||
|
||||
public Boolean isHydraulicStaion()
|
||||
@@ -392,7 +389,9 @@ namespace CordonelAssemblyLine.Model
|
||||
if (int.TryParse($"{this.CurrentPcbID}", out var pcbId))
|
||||
{
|
||||
CurrentMeter.Login();
|
||||
var result = this.stichproben.ShouldBePressureTested(pcbId);
|
||||
|
||||
// jedes mal neu wegen die ExeConfig.Current.LeakStationId
|
||||
var result = new StichprobenManager(ExeConfig.Current.LeakStationId).ShouldBePressureTested(pcbId);
|
||||
|
||||
if (result.ShouldBePressureTested)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user