bloxstrap/Bloxstrap/Views/MainWindow.xaml.cs
pizzaboxer 58fb73c127
Refactor class structure for singletons/utilities
cleanup necessary namespaces and adjust namespaces for certain classes to better represent what they're for
models, helpers and tools are all different and shouldnt really be under the same namespace
2023-04-26 21:14:35 +01:00

55 lines
1.5 KiB
C#

using System;
using System.Windows.Controls;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls.Interfaces;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
using Bloxstrap.Extensions;
using Bloxstrap.ViewModels;
namespace Bloxstrap.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : INavigationWindow
{
private readonly IThemeService _themeService = new ThemeService();
private readonly IDialogService _dialogService = new DialogService();
public MainWindow()
{
App.Logger.WriteLine("[MainWindow::MainWindow] Initializing menu");
DataContext = new MainWindowViewModel(this, _dialogService);
SetTheme();
InitializeComponent();
_dialogService.SetDialogControl(RootDialog);
}
public void SetTheme()
{
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
_themeService.SetSystemAccent();
}
#region INavigationWindow methods
public Frame GetFrame() => RootFrame;
public INavigation GetNavigation() => RootNavigation;
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
public void SetPageService(IPageService pageService) => RootNavigation.PageService = pageService;
public void ShowWindow() => Show();
public void CloseWindow() => Close();
#endregion INavigationWindow methods
}
}