diff --git a/README.md b/README.md index a8fbee9..6949136 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ On startup, you can choose if you want to use UIA2 or UIA3 (see [FAQ](https://gi ###### Choose Version Dialog ![Choose Version](https://raw.githubusercontent.com/wiki/FlauTech/FlaUInspect/images/choose_version.png) +Version could also specified in appsettings.json file. If you do this, the application will start silently, i.e. 'Choose Version Dialog' will not pop up + ###### Main Screen ![Main Screen](https://raw.githubusercontent.com/wiki/FlauTech/FlaUInspect/images/main_screen.png) diff --git a/src/FlaUInspect/App.config b/src/FlaUInspect/App.config index 8bde09a..fc51563 100644 --- a/src/FlaUInspect/App.config +++ b/src/FlaUInspect/App.config @@ -1,7 +1,7 @@ - + diff --git a/src/FlaUInspect/App.xaml.cs b/src/FlaUInspect/App.xaml.cs index 9f569c1..a5bc151 100644 --- a/src/FlaUInspect/App.xaml.cs +++ b/src/FlaUInspect/App.xaml.cs @@ -1,9 +1,33 @@ -namespace FlaUInspect +using Microsoft.Extensions.Configuration; +using System; +using System.IO; +using System.Windows; + +namespace FlaUInspect { /// /// Interaction logic for App.xaml /// - public partial class App + public partial class App : Application { + private static Lazy configuration = new Lazy(ReadConfiguration); + + public static new App Current => (App)Application.Current; + + public Settings.FlaUInspect Configuration => configuration.Value; + + private static Settings.FlaUInspect ReadConfiguration() + { + IConfigurationRoot configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false) + .Build(); + + // Read the configuration settings + var setting = new Settings.FlaUInspect(); + configuration.Bind(nameof(Settings.FlaUInspect), setting); + + return setting; + } } } diff --git a/src/FlaUInspect/FlaUInspect.csproj b/src/FlaUInspect/FlaUInspect.csproj index 26a4194..414a73a 100644 --- a/src/FlaUInspect/FlaUInspect.csproj +++ b/src/FlaUInspect/FlaUInspect.csproj @@ -9,7 +9,7 @@ Properties FlaUInspect FlaUInspect - v4.7.1 + v4.8 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -64,6 +64,12 @@ + + + + + + MSBuild:Compile @@ -76,6 +82,7 @@ + @@ -126,6 +133,9 @@ + + PreserveNewest + @@ -143,7 +153,12 @@ + + + + + @@ -159,30 +174,9 @@ - - - - - - - - - - - - - - - - 3.2.0 - - - 3.2.0 - -