OobePeek.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.Library; 6 using Microsoft.PowerToys.Settings.UI.OOBE.Enums; 7 using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; 8 using Microsoft.PowerToys.Settings.UI.Views; 9 using Microsoft.UI.Xaml.Controls; 10 using Microsoft.UI.Xaml.Navigation; 11 12 namespace Microsoft.PowerToys.Settings.UI.OOBE.Views 13 { 14 /// <summary> 15 /// An empty page that can be used on its own or navigated to within a Frame. 16 /// </summary> 17 public sealed partial class OobePeek : Page 18 { 19 public OobePowerToysModule ViewModel { get; set; } 20 21 public OobePeek() 22 { 23 this.InitializeComponent(); 24 ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.Peek]); 25 DataContext = ViewModel; 26 } 27 28 private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) 29 { 30 if (OobeShellPage.OpenMainWindowCallback != null) 31 { 32 OobeShellPage.OpenMainWindowCallback(typeof(PeekPage)); 33 } 34 35 ViewModel.LogOpeningSettingsEvent(); 36 } 37 38 protected override void OnNavigatedTo(NavigationEventArgs e) 39 { 40 ViewModel.LogOpeningModuleEvent(); 41 HotkeyControl.Keys = SettingsRepository<PeekSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.ActivationShortcut.GetKeysList(); 42 } 43 44 protected override void OnNavigatedFrom(NavigationEventArgs e) 45 { 46 ViewModel.LogClosingModuleEvent(); 47 } 48 } 49 }