/ src / settings-ui / Settings.UI / SettingsXAML / Views / AlwaysOnTopPage.xaml.cs
AlwaysOnTopPage.xaml.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using Microsoft.PowerToys.Settings.UI.Helpers;
 6  using Microsoft.PowerToys.Settings.UI.Library;
 7  using Microsoft.PowerToys.Settings.UI.ViewModels;
 8  using Microsoft.UI.Xaml.Controls;
 9  
10  namespace Microsoft.PowerToys.Settings.UI.Views
11  {
12      public sealed partial class AlwaysOnTopPage : NavigablePage, IRefreshablePage
13      {
14          private AlwaysOnTopViewModel ViewModel { get; set; }
15  
16          public AlwaysOnTopPage()
17          {
18              var settingsUtils = SettingsUtils.Default;
19              ViewModel = new AlwaysOnTopViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<AlwaysOnTopSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
20              DataContext = ViewModel;
21              InitializeComponent();
22  
23              Loaded += (s, e) => ViewModel.OnPageLoaded();
24          }
25  
26          public void RefreshEnabledState()
27          {
28              ViewModel.RefreshEnabledState();
29          }
30      }
31  }