MainWindow.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  using System.Collections.Generic;
 7  using System.IO;
 8  using System.Linq;
 9  using System.Runtime.InteropServices;
10  using System.Runtime.InteropServices.WindowsRuntime;
11  using Microsoft.UI.Xaml;
12  using Microsoft.UI.Xaml.Controls;
13  using Microsoft.UI.Xaml.Controls.Primitives;
14  using Microsoft.UI.Xaml.Data;
15  using Microsoft.UI.Xaml.Input;
16  using Microsoft.UI.Xaml.Media;
17  using Microsoft.UI.Xaml.Navigation;
18  using Windows.Foundation;
19  using Windows.Foundation.Collections;
20  
21  namespace KeyboardManagerEditorUI
22  {
23      /// <summary>
24      /// An empty window that can be used on its own or navigated to within a Frame.
25      /// </summary>
26      public sealed partial class MainWindow : Window
27      {
28          [DllImport("KeyboardManagerEditorLibraryWrapper.dll", CallingConvention = CallingConvention.Cdecl)]
29          private static extern bool CheckIfRemappingsAreValid();
30  
31          public MainWindow()
32          {
33              this.InitializeComponent();
34          }
35  
36          private void MyButton_Click(object sender, RoutedEventArgs e)
37          {
38              // Call the C++ function to check if the current remappings are valid
39              myButton.Content = CheckIfRemappingsAreValid() ? "Valid" : "Invalid";
40          }
41      }
42  }