Repository navigation
Expand file tree
/
Copy pathApp.axaml.cs
More file actions
46 lines (41 loc) · 1.5 KB
/
Copy pathApp.axaml.cs
File metadata and controls
46 lines (41 loc) · 1.5 KB
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
43
44
45
46
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading;
using FluentBrowser.Cef;
using FluentBrowser.Services;
using FluentBrowser.Views;
namespace FluentBrowser
{
public partial class App : Application
{
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
StorageService.EnsureDirs();
try
{
CefRuntime.Initialize(new CefRuntimeSettings
{
CachePath = System.IO.Path.Combine(StorageService.AppDataDir, "Cache"),
RemoteDebuggingPort = BrowserApp.Settings.EnableRemoteDebugging ? 9222 : 0,
});
}
catch (Exception ex)
{
Console.Error.WriteLine("CEF initialization failed: " + ex);
}
var main = new MainWindow();
desktop.MainWindow = main;
main.Show();
// Drive CEF's external message pump from the UI thread.
var pump = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(10) };
pump.Tick += (_, _) => CefRuntime.DoMessageLoopWork();
pump.Start();
desktop.Exit += (_, _) => CefRuntime.Shutdown();
}
base.OnFrameworkInitializationCompleted();
}
}
}