first commit

This commit is contained in:
Meik
2025-11-11 11:12:05 +01:00
commit 69e2cda8cd
912 changed files with 428004 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Shapes;
using C4IT.Logging;
using Microsoft.Win32;
using static C4IT.Logging.cLogManager;
namespace F4SD_Cockpit_ConfigLoader
{
public partial class App : Application
{
public const string constRegPath = "SOFTWARE\\Consulting4IT GmbH\\First Aid Service Desk\\ConfigLoaderDemo";
public const string constRegValuePath = "ConfigFilesPath";
public static string ConfigFilesFolder = null;
private void Application_Startup(object sender, StartupEventArgs e)
{
// intialize the file based logging
cLogManagerFile.CreateInstance(false);
DefaultLogger.LogAssemblyInfo();
LoadConfig();
}
private void LoadConfig()
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
// load the last used folder for the config files
var _regKey = Registry.CurrentUser.OpenSubKey(constRegPath);
if (_regKey != null)
{
var _strFolder = _regKey.GetValue(constRegValuePath).ToString();
if (Directory.Exists(_strFolder))
ConfigFilesFolder = _strFolder;
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
public static void SaveConfigPath(string _path)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
var _regKey = Registry.CurrentUser.CreateSubKey(constRegPath, true);
if (_regKey != null)
_regKey.SetValue(constRegValuePath, _path, RegistryValueKind.String);
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
}
}