mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Windows.Navigation;
|
|
using CommunityToolkit.Mvvm.DependencyInjection;
|
|
using Flow.Launcher.SettingPages.ViewModels;
|
|
using Flow.Launcher.ViewModel;
|
|
|
|
namespace Flow.Launcher.SettingPages.Views;
|
|
|
|
public partial class SettingsPaneGeneral
|
|
{
|
|
private SettingsPaneGeneralViewModel _viewModel = null!;
|
|
private readonly SettingWindowViewModel _settingViewModel = Ioc.Default.GetRequiredService<SettingWindowViewModel>();
|
|
|
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
|
{
|
|
// Sometimes the navigation is not triggered by button click,
|
|
// so we need to reset the page type
|
|
_settingViewModel.PageType = typeof(SettingsPaneGeneral);
|
|
|
|
// If the navigation is not triggered by button click, view model will be null again
|
|
if (_viewModel == null)
|
|
{
|
|
_viewModel = Ioc.Default.GetRequiredService<SettingsPaneGeneralViewModel>();
|
|
DataContext = _viewModel;
|
|
}
|
|
if (!IsInitialized)
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
base.OnNavigatedTo(e);
|
|
}
|
|
}
|