diff --git a/BFR.sln b/BFR.sln index 2f92ebd..3600a8c 100644 --- a/BFR.sln +++ b/BFR.sln @@ -1,8 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29411.108 MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BFR", "BFR\BFR.csproj", "{9D0FCB76-B39F-4986-BE64-938CA8F0D64D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,7 +14,24 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|x64.ActiveCfg = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|x64.Build.0 = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Debug|x86.Build.0 = Debug|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|Any CPU.Build.0 = Release|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|x64.ActiveCfg = Release|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|x64.Build.0 = Release|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|x86.ActiveCfg = Release|Any CPU + {9D0FCB76-B39F-4986-BE64-938CA8F0D64D}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A7A7691-987D-4C2F-AC95-7524A6F2F4A4} + EndGlobalSection EndGlobal diff --git a/BFR/App.xaml.cs b/BFR/App.xaml.cs index f514325..4f675dd 100644 --- a/BFR/App.xaml.cs +++ b/BFR/App.xaml.cs @@ -1,13 +1,23 @@ using Avalonia; using Avalonia.Markup.Xaml; +using Avalonia.Controls.ApplicationLifetimes; namespace BFR { public class App : Application { - public override void Initialize() - { + public override void Initialize() => AvaloniaXamlLoader.Load(this); + + public override void OnFrameworkInitializationCompleted() + { + switch (ApplicationLifetime) + { + case IClassicDesktopStyleApplicationLifetime desktop: + desktop.MainWindow = new MainWindow(); + break; + } + base.OnFrameworkInitializationCompleted(); } - } + } } \ No newline at end of file diff --git a/BFR/BFR.csproj b/BFR/BFR.csproj index 03ff300..5ca4a61 100644 --- a/BFR/BFR.csproj +++ b/BFR/BFR.csproj @@ -12,7 +12,7 @@ - - + + diff --git a/BFR/MainWindow.xaml.cs b/BFR/MainWindow.xaml.cs index dd7b215..b093bd1 100644 --- a/BFR/MainWindow.xaml.cs +++ b/BFR/MainWindow.xaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; @@ -6,14 +5,13 @@ namespace BFR { public class MainWindow : Window { - public MainWindow() - { + public MainWindow() => InitializeComponent(); - } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); + DataContext = this; } } } \ No newline at end of file diff --git a/BFR/Program.cs b/BFR/Program.cs index bf5c5ff..a8b38a0 100644 --- a/BFR/Program.cs +++ b/BFR/Program.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia; +using Avalonia; using Avalonia.Logging.Serilog; namespace BFR @@ -9,19 +8,12 @@ namespace BFR // Initialization code. Don't use any Avalonia, third-party APIs or any // SynchronizationContext-reliant code before AppMain is called: things aren't initialized // yet and stuff might break. - public static void Main(string[] args) => BuildAvaloniaApp().Start(AppMain, args); + public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); // Avalonia configuration, don't remove; also used by visual designer. public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() .LogToDebug(); - - // Your application's entry point. Here you can initialize your MVVM framework, DI - // container, etc. - private static void AppMain(Application app, string[] args) - { - app.Run(new MainWindow()); - } } }