Browse Source

Fixed command debug window

CPKreuz 2 years ago
parent
commit
c5f2bb15db

+ 5 - 0
src/PixiEditor/Views/Dialogs/CommandDebugPopup.xaml

@@ -14,6 +14,11 @@
         Foreground="White"
         Title="Command Debug" Height="450" Width="800">
 
+    <Window.CommandBindings>
+        <CommandBinding Command="{x:Static SystemCommands.CloseWindowCommand}" CanExecute="CommandBinding_CanExecute"
+                        Executed="CommandBinding_Executed_Close" />
+    </Window.CommandBindings>
+
     <WindowChrome.WindowChrome>
         <WindowChrome CaptionHeight="32" GlassFrameThickness="0.1"
                       ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />

+ 11 - 0
src/PixiEditor/Views/Dialogs/CommandDebugPopup.xaml.cs

@@ -2,6 +2,7 @@
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Documents;
+using System.Windows.Input;
 using System.Windows.Media;
 using PixiEditor.Models.Commands;
 using PixiEditor.Models.Commands.Commands;
@@ -110,6 +111,16 @@ public partial class CommandDebugPopup : Window
         void Error(string text) => inlines.Add(new Run(text) { Foreground = errorBrush });
     }
 
+    private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+    {
+        e.CanExecute = true;
+    }
+
+    private void CommandBinding_Executed_Close(object sender, ExecutedRoutedEventArgs e)
+    {
+        SystemCommands.CloseWindow(this);
+    }
+
     internal class CommandDebug
     {
         public Command Command { get; }