Skip to content

Commit 2477b23

Browse files
committed
Minor code style changes
1 parent 2ff4eb7 commit 2477b23

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

src/CodeBreaker.Avalonia/CodeBreaker.Avalonia/App.axaml.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Codebreaker.ViewModels;
66
using Codebreaker.ViewModels.Contracts.Services;
77
using Codebreaker.ViewModels.Services;
8-
using CodeBreaker.Avalonia.Contracts.Services.Navigation;
98
using CodeBreaker.Avalonia.Services;
109
using CodeBreaker.Avalonia.Services.Navigation;
1110
using CodeBreaker.Avalonia.Views;
@@ -18,12 +17,9 @@
1817
namespace CodeBreaker.Avalonia;
1918
public partial class App : Application
2019
{
21-
private readonly IHost _host;
22-
2320
public App()
2421
{
2522
this.SetDotnetEnvironmentVariable();
26-
2723
var builder = Host.CreateApplicationBuilder(Environment.GetCommandLineArgs());
2824

2925
// Configuration
@@ -42,22 +38,20 @@ public App()
4238
{
4339
client.BaseAddress = new(builder.Configuration.GetRequired("ApiBase"));
4440
});
45-
_host = builder.Build();
46-
DefaultScope = _host!.Services.CreateScope();
41+
var host = builder.Build();
42+
DefaultScope = host.Services.CreateScope();
4743
}
4844

49-
internal new static App Current => (App)Application.Current!;
45+
internal IServiceScope DefaultScope { get; private set; }
5046

51-
internal IServiceScope? DefaultScope { get; private set; }
47+
internal new static App Current => (App)Application.Current!;
5248

5349
public T GetService<T>()
5450
where T : class =>
55-
DefaultScope!.ServiceProvider.GetRequiredService<T>();
51+
DefaultScope.ServiceProvider.GetRequiredService<T>();
5652

57-
public override void Initialize()
58-
{
53+
public override void Initialize() =>
5954
AvaloniaXamlLoader.Load(this);
60-
}
6155

6256
public override void OnFrameworkInitializationCompleted()
6357
{

0 commit comments

Comments
 (0)