Files
Wino-Mail/Wino.Mail.WinUI/App.xaml.cs

74 lines
2.1 KiB
C#
Raw Normal View History

2024-07-12 21:45:42 +02:00
using System.Text;
using Microsoft.Extensions.DependencyInjection;
2024-07-12 01:11:39 +02:00
using Microsoft.UI.Xaml;
2024-07-13 03:45:55 +02:00
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
2024-07-12 21:45:42 +02:00
using Wino.Core;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Services;
2024-07-13 03:45:55 +02:00
using Wino.Core.WinUI.Services;
using Wino.Views;
using WinUIEx;
2024-07-12 02:29:17 +02:00
namespace Wino
2024-07-12 01:11:39 +02:00
{
public partial class App : Application
{
2024-07-13 03:45:55 +02:00
private WindowEx m_Window;
private Frame m_ShellFrame;
2024-07-12 02:29:17 +02:00
2024-07-12 01:11:39 +02:00
public App()
{
2024-07-13 03:45:55 +02:00
if (WebAuthenticator.CheckOAuthRedirectionActivation()) return;
2024-07-12 21:45:42 +02:00
InitializeComponent();
Services = ConfigureServices();
_logInitializer = Services.GetService<ILogInitializer>();
ConfigureLogger();
ConfigureAppCenter();
ConfigurePrelaunch();
ConfigureXbox();
_themeService = Services.GetService<IThemeService>();
_databaseService = Services.GetService<IDatabaseService>();
_appInitializerService = Services.GetService<IAppInitializerService>();
_synchronizerFactory = Services.GetService<IWinoSynchronizerFactory>();
_translationService = Services.GetService<ITranslationService>();
2024-07-13 03:45:55 +02:00
_appShellService = Services.GetService<IAppShellService>();
2024-07-12 21:45:42 +02:00
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
2024-07-12 01:11:39 +02:00
}
2024-07-12 21:45:42 +02:00
protected override async void OnLaunched(LaunchActivatedEventArgs args)
2024-07-12 01:11:39 +02:00
{
2024-07-13 03:45:55 +02:00
ConfigureWindow();
_appShellService.AppWindow = m_Window;
2024-07-12 21:45:42 +02:00
foreach (var service in initializeServices)
{
await service.InitializeAsync();
}
2024-07-12 01:11:39 +02:00
2024-07-13 03:45:55 +02:00
m_ShellFrame.Navigate(typeof(AppShell));
m_Window.Activate();
}
private void ConfigureWindow()
{
m_Window = new WindowEx
{
SystemBackdrop = new MicaBackdrop(),
ExtendsContentIntoTitleBar = true,
MinWidth = 420
};
m_ShellFrame = new Frame();
m_Window.Content = m_ShellFrame;
2024-07-12 21:45:42 +02:00
}
2024-07-12 01:11:39 +02:00
}
}