Update Avalonia to preview, Minor Refactor
- 0.9.0-preview7 - Set MainWindow's DataContext to itself
This commit is contained in:
parent
664acd3249
commit
0c0617df24
23
BFR.sln
23
BFR.sln
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 15.0.26124.0
|
VisualStudioVersion = 16.0.29411.108
|
||||||
MinimumVisualStudioVersion = 15.0.26124.0
|
MinimumVisualStudioVersion = 15.0.26124.0
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BFR", "BFR\BFR.csproj", "{9D0FCB76-B39F-4986-BE64-938CA8F0D64D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -12,7 +14,24 @@ Global
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
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
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5A7A7691-987D-4C2F-AC95-7524A6F2F4A4}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,13 +1,23 @@
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
|
||||||
namespace BFR
|
namespace BFR
|
||||||
{
|
{
|
||||||
public class App : Application
|
public class App : Application
|
||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize() =>
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
switch (ApplicationLifetime)
|
||||||
|
{
|
||||||
|
case IClassicDesktopStyleApplicationLifetime desktop:
|
||||||
|
desktop.MainWindow = new MainWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
</AvaloniaResource>
|
</AvaloniaResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="0.8.2" />
|
<PackageReference Include="Avalonia" Version="0.9.0-preview7" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="0.8.2" />
|
<PackageReference Include="Avalonia.Desktop" Version="0.9.0-preview7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
@ -6,14 +5,13 @@ namespace BFR
|
||||||
{
|
{
|
||||||
public class MainWindow : Window
|
public class MainWindow : Window
|
||||||
{
|
{
|
||||||
public MainWindow()
|
public MainWindow() =>
|
||||||
{
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
DataContext = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using Avalonia;
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Logging.Serilog;
|
using Avalonia.Logging.Serilog;
|
||||||
|
|
||||||
namespace BFR
|
namespace BFR
|
||||||
|
@ -9,19 +8,12 @@ namespace BFR
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
// yet and stuff might break.
|
// 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.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
=> AppBuilder.Configure<App>()
|
=> AppBuilder.Configure<App>()
|
||||||
.UsePlatformDetect()
|
.UsePlatformDetect()
|
||||||
.LogToDebug();
|
.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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user