/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/MainWindow.xaml.cs
64 строки
2 KB
moooyo
[Keyboard Manager] Build the WinUI 3 editor self-contained to fix launch crash (0xC0000409) (#49524)
28 июл 2026, 11:00
Не верифицирован
28 июл 2026, 11:00
130a779
Код
Авторство
О чём код?
// 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.Collections.ObjectModel; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using KeyboardManagerEditorUI.Helpers; using ManagedCommon; using Microsoft.UI; using Microsoft.UI.Windowing; 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; using WinUIEx; namespace KeyboardManagerEditorUI { public sealed partial class MainWindow : WindowEx { public MainWindow() { this.InitializeComponent(); SetTitleBar(); this.Activated += MainWindow_Activated; this.Closed += MainWindow_Closed; } private void SetTitleBar() { ExtendsContentIntoTitleBar = true; this.SetIcon(@"Assets\KeyboardManagerEditor\Keyboard.ico"); this.SetTitleBar(titleBar); Title = "Keyboard Manager"; WindowHelpers.ForceTopBorder1PixelInsetOnWindows10(this.GetWindowHandle()); } private void MainWindow_Activated(object sender, WindowActivatedEventArgs args) { if (args.WindowActivationState == WindowActivationState.Deactivated) { // Release the keyboard hook when the window is deactivated KeyboardHookHelper.Instance.CleanupHook(); } } private void MainWindow_Closed(object sender, WindowEventArgs args) { KeyboardHookHelper.Instance.Dispose(); this.Activated -= MainWindow_Activated; this.Closed -= MainWindow_Closed; } } }