Storage queries run in the background with cancellation and covering indexes so switching views no longer freezes the UI. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
760 B
C#
31 lines
760 B
C#
using System.Windows;
|
|
|
|
namespace Explorer.App;
|
|
|
|
public partial class PromptWindow : Window
|
|
{
|
|
public PromptWindow(string title, string message, string initial)
|
|
{
|
|
InitializeComponent();
|
|
Title = title;
|
|
Message.Text = message;
|
|
Input.Text = initial;
|
|
Input.SelectAll();
|
|
Loaded += (_, _) => Input.Focus();
|
|
}
|
|
|
|
public string Value => Input.Text;
|
|
|
|
private void OnOk(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = true;
|
|
Close();
|
|
}
|
|
|
|
public static string? Ask(Window owner, string title, string message, string initial)
|
|
{
|
|
var dlg = new PromptWindow(title, message, initial) { Owner = owner };
|
|
return dlg.ShowDialog() == true ? dlg.Value : null;
|
|
}
|
|
}
|