/ src / modules / cmdpal / Microsoft.CmdPal.UI / Settings / ExtensionPage.xaml.cs
ExtensionPage.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.CmdPal.UI.ViewModels;
 6  using Microsoft.UI.Xaml.Controls;
 7  using Microsoft.UI.Xaml.Navigation;
 8  
 9  namespace Microsoft.CmdPal.UI.Settings;
10  
11  public sealed partial class ExtensionPage : Page
12  {
13      private readonly TaskScheduler _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
14  
15      public ProviderSettingsViewModel? ViewModel { get; private set; }
16  
17      public ExtensionPage()
18      {
19          this.InitializeComponent();
20      }
21  
22      protected override void OnNavigatedTo(NavigationEventArgs e)
23      {
24          ViewModel = e.Parameter is ProviderSettingsViewModel vm
25              ? vm
26              : throw new ArgumentException($"{nameof(ExtensionPage)} navigation args should be passed a {nameof(ProviderSettingsViewModel)}");
27      }
28  
29      private async void RankButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
30      {
31          await FallbackRankerDialog.ShowAsync();
32      }
33  }