Files
PowerToys/src/modules/keyboardmanager/KeyboardManagerEditorUI/MainWindow.xaml.cs
Hao Liu 68afc6623f [KeyboardManager WinUI3] Create WinUI3 project and wrapper for Keyboard Manager Editor (#37427)
* Set up KBM WinUI3 Editor UI project

* Test invoking the KBM library via wrapper for WinUI3 C# UI

* Set up Editor Library Wrapper and enable logging

* fix spelling

* update spacing and remove unused file

* fix formatting

* update sln

* update wrapper project config

* import common props

* update UI reference

* gate the new editor with the experimentation toggle in settings
2025-02-18 17:10:15 +08:00

43 lines
1.4 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;
namespace KeyboardManagerEditorUI
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
[DllImport("KeyboardManagerEditorLibraryWrapper.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern bool CheckIfRemappingsAreValid();
public MainWindow()
{
this.InitializeComponent();
}
private void MyButton_Click(object sender, RoutedEventArgs e)
{
// Call the C++ function to check if the current remappings are valid
myButton.Content = CheckIfRemappingsAreValid() ? "Valid" : "Invalid";
}
}
}