mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-21 21:50:12 +08:00
57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using BetterGenshinImpact.Helpers.DpiAwareness;
|
|
using BetterGenshinImpact.ViewModel;
|
|
using System;
|
|
using System.Windows.Media;
|
|
using Wpf.Ui;
|
|
using Wpf.Ui.Controls;
|
|
|
|
namespace BetterGenshinImpact.View;
|
|
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : FluentWindow, INavigationWindow
|
|
{
|
|
public MainWindowViewModel ViewModel { get; }
|
|
|
|
public MainWindow(MainWindowViewModel viewModel, IPageService pageService, INavigationService navigationService)
|
|
{
|
|
DataContext = ViewModel = viewModel;
|
|
|
|
InitializeComponent();
|
|
this.InitializeDpiAwareness();
|
|
|
|
SetPageService(pageService);
|
|
navigationService.SetNavigationControl(RootNavigation);
|
|
}
|
|
|
|
protected override void OnSourceInitialized(EventArgs e)
|
|
{
|
|
base.OnSourceInitialized(e);
|
|
|
|
if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
|
{
|
|
Background = new SolidColorBrush(Colors.Transparent);
|
|
WindowBackdrop.ApplyBackdrop(this, WindowBackdropType.Mica);
|
|
}
|
|
}
|
|
|
|
public INavigationView GetNavigation() => RootNavigation;
|
|
|
|
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
|
|
|
|
public void SetServiceProvider(IServiceProvider serviceProvider)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void SetPageService(IPageService pageService)
|
|
{
|
|
RootNavigation.SetPageService(pageService);
|
|
}
|
|
|
|
public void ShowWindow() => Show();
|
|
|
|
public void CloseWindow() => Close();
|
|
}
|