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,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,9 @@
<Application x:Class="F4SD_Cockpit_ConfigLoader.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:F4SD_Cockpit_ConfigLoader"
StartupUri="MainWindow.xaml" Startup="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>

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);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BC84E4DD-8D84-481F-9F1E-685AFC15D1E8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>F4SD_Cockpit_ConfigLoader</RootNamespace>
<AssemblyName>F4SD-Cockpit-ConfigLoader</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo_FASD.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="MaterialIcons, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialIcons.1.0.3\lib\MaterialIcons.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="XamlAnimatedGif, Version=2.0.0.0, Culture=neutral, PublicKeyToken=20a987d8023d9690, processorArchitecture=MSIL">
<HintPath>..\packages\XamlAnimatedGif.2.3.1\lib\net45\XamlAnimatedGif.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.F4SD.GlobalConfig.cs">
<Link>Common\C4IT.F4SD.GlobalConfig.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.F4SD.HealthCardConfig.cs">
<Link>Common\C4IT.F4SD.HealthCardConfig.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.F4SD.MenuItem.cs">
<Link>Common\C4IT.F4SD.MenuItem.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.Base.cs">
<Link>Common\C4IT.FASD.Base.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.ConfigBase.cs">
<Link>Common\C4IT.FASD.ConfigBase.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.CopyTemplatesConfig.cs">
<Link>Common\C4IT.FASD.CopyTemplatesConfig.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.IconConfig.cs">
<Link>Common\C4IT.FASD.IconConfig.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.MenuSectionConfig.cs">
<Link>Common\C4IT.FASD.MenuSectionConfig.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.QuickActionConfig.cs">
<Link>Common\C4IT.FASD.QuickActionConfig.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Configuration\C4IT.Configuration.ConfigHelper.cs">
<Link>Common\C4IT.Configuration.ConfigHelper.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Logging\C4IT.Logging.LogManager.cs">
<Link>Common\C4IT.Logging.LogManager.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\MultiLanguage\C4IT.MultiLanguage.MultiLanguageSupport.cs">
<Link>Common\C4IT.MultiLanguage.MultiLanguageSupport.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\XML\C4IT.XML.ConfigParsing.cs">
<Link>Common\C4IT.XML.ConfigParsing.cs</Link>
</Compile>
<Compile Include="..\CommonAssemblyAttributes.cs">
<Link>Common\CommonAssemblyAttributes.cs</Link>
</Compile>
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\F4SD-Cockpit-ServerCore\DataHistoryConfigClusters.cs">
<Link>Common\DataHistoryConfigClusters.cs</Link>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-CopyTemplate-Configuration.xsd">
<Link>Config\F4SD-CopyTemplate-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-DataClusters-Configuration.xsd">
<Link>Config\F4SD-DataClusters-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-HealthCard-Configuration.xsd">
<Link>Config\F4SD-HealthCard-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-Icon-Configuration.xsd">
<Link>Config\F4SD-Icon-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-Infrastructure-Configuration.xsd">
<Link>Config\F4SD-Infrastructure-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-MenuSection-Configuration.xsd">
<Link>Config\F4SD-MenuSection-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\C4IT_DataHistoryProvider_Test\Config\F4SD-QuickAction-Configuration.xsd">
<Link>Config\F4SD-QuickAction-Configuration.xsd</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="logo_FASD.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Circle_animaited.gif" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,89 @@
<Window x:Class="F4SD_Cockpit_ConfigLoader.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
xmlns:local="clr-namespace:F4SD_Cockpit_ConfigLoader"
mc:Ignorable="d"
Title="F4SD Configuration Loader Demo" Height="800" Width="1024" Icon="/logo_FASD.ico" Loaded="Window_Loaded">
<Window.Resources>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="4">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="10,10,10,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0">Path to configuration files:</TextBlock>
<TextBox x:Name="textBoxConfigPath" x:FieldModifier="private" Text="" Grid.Column="1" Margin="10,0,0,0"/>
<Button x:Name="buttonSelectConfigPath" x:FieldModifier="private" Content="..." Grid.Column="2" Margin="10,0,0,0" Width="30" Style="{DynamicResource ButtonStyle1}" Click="buttonSelectConfigPath_Click" />
</Grid>
<Button x:Name="buttonLoadConfigFiles" x:FieldModifier="private" Content="Load configuration files" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,10,10" Padding="8,1,8,1" Style="{DynamicResource ButtonStyle1}" Click="buttonLoadConfigFiles_Click"/>
<RichTextBox x:Name="rtbProtocol" x:FieldModifier="private" Grid.Row="2" IsReadOnly="True" Margin="10,10,10,10" FontSize="13"/>
<Border x:Name="WaitingImage" x:FieldModifier="private" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="30" Width="100" Height="100" Background="#848282" >
<Image gif:AnimationBehavior.SourceUri="Circle_animaited.gif" gif:AnimationBehavior.RepeatBehavior="Forever" Width="80" Height="80" Stretch="UniformToFill"/>
</Border>
</Grid>
</Window>

View File

@@ -0,0 +1,255 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
using C4IT.Logging;
using C4IT.XML;
using C4IT.FASD.Base;
using C4IT.DataHistoryProvider;
using static C4IT.Logging.cLogManager;
namespace F4SD_Cockpit_ConfigLoader
{
public partial class MainWindow : Window
{
public MainWindow()
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
InitializeComponent();
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
WaitingImage.Visibility = Visibility.Collapsed;
textBoxConfigPath.Text = App.ConfigFilesFolder;
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
private void buttonSelectConfigPath_Click(object sender, RoutedEventArgs e)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
var openFileDlg = new System.Windows.Forms.OpenFileDialog();
openFileDlg.FileName = textBoxConfigPath.Text;
openFileDlg.ValidateNames = false;
openFileDlg.CheckFileExists = false;
openFileDlg.CheckPathExists = true;
openFileDlg.FileName = "select a folder.";
var result = openFileDlg.ShowDialog();
if (result is System.Windows.Forms.DialogResult.OK)
{
var _path = openFileDlg.FileName;
_path = System.IO.Path.GetDirectoryName(_path);
if (System.IO.Directory.Exists(_path))
textBoxConfigPath.Text = _path;
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
private void buttonLoadConfigFiles_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrWhiteSpace(textBoxConfigPath.Text))
return;
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
rtbProtocol.Document.Blocks.Clear();
var _path = textBoxConfigPath.Text;
if (System.IO.Directory.Exists(_path))
{
App.SaveConfigPath(_path);
AddProtocolText($"Loading configuration files from folder '{_path}'...", Colors.Blue);
LoadConfiguration(_path);
}
else
{
AddProtocolText($"The path '{_path}' could not be found!", Colors.Red);
rtbProtocol.AppendText("");
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
}
private void AddProtocolText(string _text, Color _color)
{
try
{
var paragraph = new Paragraph();
var run = new Run(_text)
{
Foreground = new SolidColorBrush(_color)
};
paragraph.Inlines.Add(run);
rtbProtocol.Document.Blocks.Add(paragraph);
}
catch (Exception E)
{
LogException(E);
}
}
private void AddProtocol(List<cXmlParserNodeMessage> _parsingMessages)
{
foreach (var _msg in _parsingMessages)
{
var _strMsg = cXmlParser.GetMessageString(_msg);
var _col = Colors.Black;
switch (_msg.Level)
{
case LogLevels.Info:
_col = Colors.Black;
break;
case LogLevels.Warning:
_col = Colors.DarkOrange;
break;
case LogLevels.Error:
_col = Colors.Red;
break;
case LogLevels.Fatal:
_col = Colors.Purple;
break;
case LogLevels.Debug:
_col = Colors.DarkGray;
break;
}
AddProtocolText(" " + _strMsg, _col);
}
}
private void AddProtocolResult(cFasdBaseConfig _config, List<cXmlParserNodeMessage> _parsingMessages, string FileName)
{
AddProtocol(_parsingMessages);
if (_config?.IsValid is true)
{
if (_parsingMessages?.Count >= 1)
AddProtocolText($" Configuration file '{cDataHistoryConfigClusters.constFileNameF4sdConfig}' is valid but has some annotations!", Colors.DarkOrange);
else
AddProtocolText($" Configuration file '{cDataHistoryConfigClusters.constFileNameF4sdConfig}' is valid.", Colors.DarkGreen);
}
else
AddProtocolText($" Configuration file '{cDataHistoryConfigClusters.constFileNameF4sdConfig}' has non trivial errors and is invalid!", Colors.Red);
rtbProtocol.AppendText("");
}
private async void LoadConfiguration(string configPath)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
var _currentCursor = Cursor;
try
{
Cursor = System.Windows.Input.Cursors.Wait;
WaitingImage.Visibility = Visibility.Visible;
buttonLoadConfigFiles.IsEnabled = false;
buttonSelectConfigPath.IsEnabled = false;
List<cXmlParserNodeMessage> _parsingMessages = null;
// load and validate the data clusters configuration file
var _cfgClusters = new cDataHistoryConfigClusters();
AddProtocolText($" Loading and parsing configuration file '{_cfgClusters._fileNameConfig}'", Colors.Black);
await Task.Run(() =>
{
_cfgClusters.LoadFromFile(out _parsingMessages, Folder: configPath);
});
AddProtocolResult(_cfgClusters, _parsingMessages, _cfgClusters._fileNameConfig);
// load and validate the client configuration files
var _Configs = new Dictionary<enumFasdConfigurationType, cFasdBaseConfig>();
var _lst = Enum.GetValues(typeof(enumFasdConfigurationType)).Cast<enumFasdConfigurationType>();
foreach (var _entry in _lst)
{
if (_entry != enumFasdConfigurationType.unknown)
{
var _cfg = cFasdBaseConfig.CreateConfigByType(_entry);
if (_cfg != null)
{
AddProtocolText($" Loading and parsing configuration file '{_cfg._fileNameConfig}'", Colors.Black);
await Task.Run(() =>
{
_cfg.LoadFromFile(out _parsingMessages, Folder: configPath);
});
AddProtocolResult(_cfg, _parsingMessages, _cfg._fileNameConfig);
}
}
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
WaitingImage.Visibility = Visibility.Collapsed;
buttonLoadConfigFiles.IsEnabled = true;
buttonSelectConfigPath.IsEnabled = true;
Cursor = _currentCursor;
if (CM != null) LogMethodEnd(CM);
}
}
}
}

View File

@@ -0,0 +1,9 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("F4SD Cockpit ConfigLoader Demo")]
[assembly: ComVisible(false)]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace F4SD_Cockpit_ConfigLoader.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// 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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("F4SD_Cockpit_ConfigLoader.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace F4SD_Cockpit_ConfigLoader.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
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB