-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.axaml.cs
More file actions
61 lines (53 loc) · 2.15 KB
/
App.axaml.cs
File metadata and controls
61 lines (53 loc) · 2.15 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Gamelist_Manager.ViewModels;
using Gamelist_Manager.Views;
using LibVLCSharp.Shared;
using System.Linq;
namespace Gamelist_Manager;
public partial class App : Application
{
public override void Initialize()
{
// Initialize LibVLC core library for video playback
try
{
Core.Initialize();
// Fire-and-forget: start the expensive LibVLC engine construction immediately
// so it's ready (or nearly ready) by the time the user opens the media panel.
_ = MediaPreviewViewModel.PreloadLibVLCAsync();
}
catch (System.Exception ex)
{
// Log LibVLC initialization error
System.Console.WriteLine("WARNING: LibVLC initialization failed. Video playback will not be available.");
System.Console.WriteLine($"Error: {ex.Message}");
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux))
{
System.Console.WriteLine("\nOn Linux, make sure you have installed:");
System.Console.WriteLine(" sudo apt-get install vlc libvlc5 libvlccore9");
System.Console.WriteLine("or");
System.Console.WriteLine(" sudo dnf install vlc vlc-core");
System.Console.WriteLine("or");
System.Console.WriteLine(" sudo pacman -S vlc");
}
// Don't crash the app - continue without video support
}
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
// Load and apply saved theme settings before showing the main window
SettingsViewModel.ApplyThemeOnStartup();
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
}
base.OnFrameworkInitializationCompleted();
}
}