-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.axaml.cs
42 lines (41 loc) · 1.24 KB
/
App.axaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using voicio.ViewModels;
using voicio.Views;
using voicio.Models;
using System.Threading.Tasks;
using voicio.Services;
namespace voicio
{
public partial class App : Application
{
public App()
{
MainGlobalView AppModelView = new MainGlobalView();
DataContext = AppModelView;
}
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public async override void OnFrameworkInitializationCompleted()
{
var tempdb = new HelpContext();
tempdb.Database.EnsureCreated(); //create DB if no DB is found
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
desktop.ShutdownMode = Avalonia.Controls.ShutdownMode.OnExplicitShutdown;
}
await Task.Run(() =>
{
new VoiceService().StartService();
});
base.OnFrameworkInitializationCompleted();
}
}
}