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