Config file name modified
This commit is contained in:
+9
-6
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.33423.255
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36310.24 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{7A0EE7B8-6B7E-41E9-B679-319C8CA48CF1}"
|
||||
EndProject
|
||||
@@ -364,10 +364,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockGenesis", "Hardware\Wat
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonConsole", "CommonConsole\CommonConsole.csproj", "{AFC428F5-0141-4A3F-BEF2-470A89D972F6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SIRT", "SIRT", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
_MANUAL_CONTROL|Any CPU = _MANUAL_CONTROL|Any CPU
|
||||
_MANUAL_CONTROL|Mixed Platforms = _MANUAL_CONTROL|Mixed Platforms
|
||||
@@ -5865,7 +5864,7 @@ Global
|
||||
{4E8BB839-D40A-488C-88CE-F21811F1F476} = {43B54F41-6F09-4BCB-9F82-77621275831B}
|
||||
{56768A27-D0E4-430E-8E75-AFC7319F189A} = {C9393A97-C0BB-4D59-A879-B572BE04CE15}
|
||||
{E6081C0A-8452-44B4-8EB4-E0CAE9119830} = {56768A27-D0E4-430E-8E75-AFC7319F189A}
|
||||
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {99B23EE9-CE50-4924-A055-C39EFA038721}
|
||||
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
|
||||
{3332395B-122F-4DE5-A294-9DDAEA09F10C} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
||||
{890AA5E6-C55A-4E35-9841-999FA24B5025} = {3332395B-122F-4DE5-A294-9DDAEA09F10C}
|
||||
@@ -5922,10 +5921,14 @@ Global
|
||||
{A6B3AB5A-A567-4C77-80FB-1E1E19A00713} = {B5F43F61-4448-4992-85B5-7EDFB82FD643}
|
||||
{D7A7E1FF-D024-407F-B30D-4C519CFA7BF1} = {A6B3AB5A-A567-4C77-80FB-1E1E19A00713}
|
||||
{AFC428F5-0141-4A3F-BEF2-470A89D972F6} = {C17363DF-A043-4F25-8EBA-2B3B078227DC}
|
||||
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {99B23EE9-CE50-4924-A055-C39EFA038721}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
|
||||
EndGlobalSection
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
|
||||
@@ -22,7 +22,12 @@ namespace Xylem.Common.CommonCore.Consts
|
||||
/// <summary>
|
||||
/// Name for meter config
|
||||
/// </summary>
|
||||
public const String ConfigFileName = "MeterConfig.json";
|
||||
public const String MeterConfigFileName = "MeterConfig.json";
|
||||
|
||||
/// <summary>
|
||||
/// Name for SIRT config
|
||||
/// </summary>
|
||||
public const String SirtConfigFileName = "SirtConfig.json";
|
||||
|
||||
/// <summary>
|
||||
/// Name for offline information e.g. Passwords
|
||||
|
||||
@@ -798,7 +798,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
ledTransmit.GetTransmitPortSettings());
|
||||
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
|
||||
}
|
||||
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
|
||||
Configuration = new ProcessConfig(ProgramConfig.MeterConfigFileName);
|
||||
Logger.Debug($"Slot:{Slot} - Setup done");
|
||||
}
|
||||
|
||||
|
||||
@@ -667,7 +667,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
||||
ledTransmit.GetTransmitPortSettings());
|
||||
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
|
||||
}
|
||||
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
|
||||
Configuration = new ProcessConfig(ProgramConfig.MeterConfigFileName);
|
||||
|
||||
SetLogger();
|
||||
WriteLog("Setup done");
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
{
|
||||
//namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
//{
|
||||
|
||||
/// <summary>
|
||||
/// Configuration of ProductionUi
|
||||
/// </summary>
|
||||
public class ApplicationSettings
|
||||
{
|
||||
// /// <summary>
|
||||
// /// Configuration of ProductionUi
|
||||
// /// </summary>
|
||||
// public class ApplicationSettings
|
||||
// {
|
||||
|
||||
public class Pos
|
||||
{
|
||||
public Double Left { get; set; }
|
||||
public Double Top { get; set; }
|
||||
public Double Height { get; set; }
|
||||
public Double Width { get; set; }
|
||||
}
|
||||
public class MultiFormChilds
|
||||
{
|
||||
public Type ViewModelType { get; set; }
|
||||
public Boolean Visisble { get; set; }
|
||||
public String Name { get; set; }
|
||||
public Int32 Slot { get; set; }
|
||||
public String TextPort { get; set; }
|
||||
public Pos StartPos { get; set; }
|
||||
// public class Pos
|
||||
// {
|
||||
// public Double Left { get; set; }
|
||||
// public Double Top { get; set; }
|
||||
// public Double Height { get; set; }
|
||||
// public Double Width { get; set; }
|
||||
// }
|
||||
// public class MultiFormChilds
|
||||
// {
|
||||
// public Type ViewModelType { get; set; }
|
||||
// public Boolean Visisble { get; set; }
|
||||
// public String Name { get; set; }
|
||||
// public Int32 Slot { get; set; }
|
||||
// public String TextPort { get; set; }
|
||||
// public Pos StartPos { get; set; }
|
||||
|
||||
}
|
||||
public Int32 Slot { get; set; }
|
||||
// }
|
||||
// public Int32 Slot { get; set; }
|
||||
|
||||
public Int32? PressureStationId { get; set; }
|
||||
public Boolean AutoDetect { get; set; }
|
||||
// public Int32? PressureStationId { get; set; }
|
||||
// public Boolean AutoDetect { get; set; }
|
||||
|
||||
public Boolean AccessToPresuretestTab { get; set; }
|
||||
public Boolean AccessToMarrieTab { get; set; }
|
||||
public Boolean AccessToFinalcheckTab { get; set; }
|
||||
// public Boolean AccessToPresuretestTab { get; set; }
|
||||
// public Boolean AccessToMarrieTab { get; set; }
|
||||
// public Boolean AccessToFinalcheckTab { get; set; }
|
||||
|
||||
public Boolean AccessToSettingTab { get; set; }
|
||||
public Boolean AccessToStatusTab { get; set; }
|
||||
public Boolean AccessToPickingTab { get; set; }
|
||||
// public Boolean AccessToSettingTab { get; set; }
|
||||
// public Boolean AccessToStatusTab { get; set; }
|
||||
// public Boolean AccessToPickingTab { get; set; }
|
||||
|
||||
|
||||
public Int32? SirtComport433 { get; set; }
|
||||
public Int32? SirtComport866 { get; set; }
|
||||
public Int32? SirtBoxNr { get; set; }
|
||||
// public Int32? SirtComport433 { get; set; }
|
||||
// public Int32? SirtComport866 { get; set; }
|
||||
// public Int32? SirtBoxNr { get; set; }
|
||||
|
||||
public Int32? StationId { get; set; }
|
||||
// public Int32? StationId { get; set; }
|
||||
|
||||
public List<MultiFormChilds> ChildForms { get; set; }
|
||||
// public List<MultiFormChilds> ChildForms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public ApplicationSettings()
|
||||
{
|
||||
Slot = 0;
|
||||
AutoDetect = false;
|
||||
AccessToPresuretestTab = false;
|
||||
AccessToMarrieTab = false;
|
||||
AccessToFinalcheckTab = false;
|
||||
AccessToSettingTab = false;
|
||||
AccessToPickingTab = false;
|
||||
AccessToStatusTab = false;
|
||||
PressureStationId = null;
|
||||
SirtComport433 = null;
|
||||
SirtComport866 = null;
|
||||
SirtBoxNr = null;
|
||||
ChildForms = new List<MultiFormChilds>();
|
||||
StationId = null;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public ApplicationSettings(String file)
|
||||
{
|
||||
//var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
//nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
|
||||
// /// <summary>
|
||||
// /// ctor
|
||||
// /// </summary>
|
||||
// public ApplicationSettings()
|
||||
// {
|
||||
// Slot = 0;
|
||||
// AutoDetect = false;
|
||||
// AccessToPresuretestTab = false;
|
||||
// AccessToMarrieTab = false;
|
||||
// AccessToFinalcheckTab = false;
|
||||
// AccessToSettingTab = false;
|
||||
// AccessToPickingTab = false;
|
||||
// AccessToStatusTab = false;
|
||||
// PressureStationId = null;
|
||||
// SirtComport433 = null;
|
||||
// SirtComport866 = null;
|
||||
// SirtBoxNr = null;
|
||||
// ChildForms = new List<MultiFormChilds>();
|
||||
// StationId = null;
|
||||
// }
|
||||
// /// <inheritdoc />
|
||||
// public ApplicationSettings(String file)
|
||||
// {
|
||||
// //var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
// //nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
|
||||
|
||||
//if (!File.Exists(configFile))
|
||||
//{
|
||||
var configFile = Path.Combine(file);
|
||||
if (!File.Exists(configFile))
|
||||
{
|
||||
Slot = 0;
|
||||
AutoDetect = false;
|
||||
AccessToPresuretestTab = false;
|
||||
AccessToMarrieTab = false;
|
||||
AccessToFinalcheckTab = false;
|
||||
AccessToSettingTab = false;
|
||||
AccessToPickingTab = false;
|
||||
AccessToStatusTab = false;
|
||||
PressureStationId = null;
|
||||
ChildForms = new List<MultiFormChilds>();
|
||||
StationId = null;
|
||||
return;
|
||||
}
|
||||
//}
|
||||
// //if (!File.Exists(configFile))
|
||||
// //{
|
||||
// var configFile = Path.Combine(file);
|
||||
// if (!File.Exists(configFile))
|
||||
// {
|
||||
// Slot = 0;
|
||||
// AutoDetect = false;
|
||||
// AccessToPresuretestTab = false;
|
||||
// AccessToMarrieTab = false;
|
||||
// AccessToFinalcheckTab = false;
|
||||
// AccessToSettingTab = false;
|
||||
// AccessToPickingTab = false;
|
||||
// AccessToStatusTab = false;
|
||||
// PressureStationId = null;
|
||||
// ChildForms = new List<MultiFormChilds>();
|
||||
// StationId = null;
|
||||
// return;
|
||||
// }
|
||||
// //}
|
||||
|
||||
using (var tr = new StreamReader(configFile))
|
||||
{
|
||||
var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
|
||||
if (meterConfig != null)
|
||||
{
|
||||
Slot = meterConfig.Slot;
|
||||
AutoDetect = meterConfig.AutoDetect;
|
||||
AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
|
||||
AccessToMarrieTab = meterConfig.AccessToMarrieTab;
|
||||
AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
|
||||
AccessToSettingTab = meterConfig.AccessToSettingTab;
|
||||
AccessToPickingTab = meterConfig.AccessToPickingTab;
|
||||
AccessToStatusTab = meterConfig.AccessToStatusTab;
|
||||
PressureStationId = meterConfig.PressureStationId;
|
||||
// using (var tr = new StreamReader(configFile))
|
||||
// {
|
||||
// var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
|
||||
// if (meterConfig != null)
|
||||
// {
|
||||
// Slot = meterConfig.Slot;
|
||||
// AutoDetect = meterConfig.AutoDetect;
|
||||
// AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
|
||||
// AccessToMarrieTab = meterConfig.AccessToMarrieTab;
|
||||
// AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
|
||||
// AccessToSettingTab = meterConfig.AccessToSettingTab;
|
||||
// AccessToPickingTab = meterConfig.AccessToPickingTab;
|
||||
// AccessToStatusTab = meterConfig.AccessToStatusTab;
|
||||
// PressureStationId = meterConfig.PressureStationId;
|
||||
|
||||
ChildForms = meterConfig.ChildForms;
|
||||
StationId = meterConfig.StationId;
|
||||
}
|
||||
}
|
||||
// ChildForms = meterConfig.ChildForms;
|
||||
// StationId = meterConfig.StationId;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public void Update(String file)
|
||||
{
|
||||
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
nameof(Hardware.WaterMeter.Genesis), file);
|
||||
// public void Update(String file)
|
||||
// {
|
||||
// var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
// nameof(Hardware.WaterMeter.Genesis), file);
|
||||
|
||||
if (!File.Exists(configFile))
|
||||
{
|
||||
configFile = Path.Combine(file);
|
||||
}
|
||||
// if (!File.Exists(configFile))
|
||||
// {
|
||||
// configFile = Path.Combine(file);
|
||||
// }
|
||||
|
||||
File.WriteAllText(file, JsonConvert.SerializeObject(this));
|
||||
}
|
||||
// File.WriteAllText(file, JsonConvert.SerializeObject(this));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -141,10 +141,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
InitializeFormState();
|
||||
}
|
||||
|
||||
private ApplicationSettings Settings
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
//private ApplicationSettings Settings
|
||||
//{
|
||||
// get; set;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the FinalTest GUI:
|
||||
@@ -183,7 +183,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
}
|
||||
|
||||
cbxSlotBox.SelectedIndex = 0;
|
||||
Settings = new ApplicationSettings("ProductionUiConfig.json");
|
||||
//Settings = new ApplicationSettings("ProductionUiConfig.json");
|
||||
|
||||
UseSetting(true);
|
||||
|
||||
@@ -248,7 +248,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
//}
|
||||
if (setSlot)
|
||||
{
|
||||
cbxSlotBox.SelectedValue = Settings.Slot;
|
||||
//cbxSlotBox.SelectedValue = Settings.Slot;
|
||||
cbxSlotBox.SelectedValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,10 +864,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
|
||||
|
||||
}
|
||||
|
||||
private void StoreSetting()
|
||||
{
|
||||
Settings.Update("ProductionUiConfig.json");
|
||||
}
|
||||
//private void StoreSetting()
|
||||
//{
|
||||
// Settings.Update("ProductionUiConfig.json");
|
||||
//}
|
||||
|
||||
//private void BtnConnect_Click(Object sender, RoutedEventArgs e)
|
||||
//{
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
cbcSlotType.HeaderText = SlotTypeString;
|
||||
|
||||
LoadFromFile();
|
||||
_configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
|
||||
_configuration = new ProcessConfig(ProgramConfig.MeterConfigFileName);
|
||||
cbUseMinMaxCheck.Checked = _configuration.UseMinMaxCheck;
|
||||
cbUseRegisterWatch.Checked = _configuration.UseRegisterWatchService;
|
||||
txtWachSeriveUrl.Text = _configuration.RegisterWatchServiceUrl;
|
||||
@@ -401,28 +401,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
private void cbUseRegisterWatch_CheckedChanged(Object sender, EventArgs e)
|
||||
{
|
||||
_configuration.UseRegisterWatchService = cbUseRegisterWatch.Checked;
|
||||
_configuration.Update(ProgramConfig.ConfigFileName);
|
||||
_configuration.Update(ProgramConfig.MeterConfigFileName);
|
||||
StoreToPc();
|
||||
}
|
||||
|
||||
private void cbUseMinMaxCheck_CheckedChanged(Object sender, EventArgs e)
|
||||
{
|
||||
_configuration.UseMinMaxCheck = cbUseMinMaxCheck.Checked;
|
||||
_configuration.Update(ProgramConfig.ConfigFileName);
|
||||
_configuration.Update(ProgramConfig.MeterConfigFileName);
|
||||
StoreToPc();
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(Object sender, EventArgs e)
|
||||
{
|
||||
_configuration.RegisterWatchServiceUrl = txtWachSeriveUrl.Text;
|
||||
_configuration.Update(ProgramConfig.ConfigFileName);
|
||||
_configuration.Update(ProgramConfig.MeterConfigFileName);
|
||||
StoreToPc();
|
||||
}
|
||||
|
||||
private void cbUpdateFiles_CheckedChanged(Object sender, EventArgs e)
|
||||
{
|
||||
_configuration.AutoUpdateFiles = cbUpdateFiles.Checked;
|
||||
_configuration.Update(ProgramConfig.ConfigFileName);
|
||||
_configuration.Update(ProgramConfig.MeterConfigFileName);
|
||||
StoreToPc();
|
||||
}
|
||||
|
||||
@@ -503,6 +503,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
else
|
||||
{
|
||||
// ReSharper disable once LocalizableElement
|
||||
MessageBox.Show("Developer mode! Configuration.json can be exchanged on individual requirements.\n" +
|
||||
"\nRISK:\n" +
|
||||
"- Register ranges cannot be checked\n" +
|
||||
@@ -510,7 +511,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
|
||||
_configuration.ProductionMode = cbxProductionMode.Checked;
|
||||
_configuration.Update(ProgramConfig.ConfigFileName);
|
||||
_configuration.Update(ProgramConfig.MeterConfigFileName);
|
||||
StoreToPc();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user