MainPage.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 System;
 6  
 7  using Microsoft.UI.Xaml;
 8  using Microsoft.UI.Xaml.Controls;
 9  using PowerToys.FileLocksmithLib.Interop;
10  using PowerToys.FileLocksmithUI.ViewModels;
11  
12  namespace PowerToys.FileLocksmithUI.Views
13  {
14      public sealed partial class MainPage : Page
15      {
16          public MainViewModel ViewModel { get; private set; }
17  
18          public MainPage()
19          {
20              this.InitializeComponent();
21              ViewModel = new MainViewModel();
22              DataContext = ViewModel;
23          }
24  
25          private async void ShowSelectedPathsButton_Click(object sender, RoutedEventArgs e)
26          {
27              await SelectedFilesListDialog.ShowAsync();
28          }
29  
30          private async void ShowProcessFiles_Click(object sender, RoutedEventArgs e)
31          {
32              var processResult = (ProcessResult)((FrameworkElement)sender).DataContext;
33              ProcessFilesListDialogTextBlock.Text = string.Join(Environment.NewLine, processResult.files);
34  
35              await ProcessFilesListDialog.ShowAsync();
36          }
37      }
38  }