Add host activity and DB browser, and keep dialogs, drag-drop, and idle maintenance responsive.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
23
src/Explorer.App/ModelessWindowClose.cs
Normal file
23
src/Explorer.App/ModelessWindowClose.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Explorer.App;
|
||||
|
||||
/// <summary>
|
||||
/// Close helpers for windows opened with <see cref="Window.Show"/>.
|
||||
/// <see cref="Button.IsCancel"/> sets <see cref="Window.DialogResult"/>, which throws on modeless windows.
|
||||
/// </summary>
|
||||
internal static class ModelessWindowClose
|
||||
{
|
||||
public static void EnableEscape(Window window)
|
||||
=> window.PreviewKeyDown += (_, e) =>
|
||||
{
|
||||
if (e.Key != Key.Escape)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
window.Close();
|
||||
e.Handled = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user