mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-10 21:57:46 +00:00
33 lines
733 B
C#
33 lines
733 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Threading;
|
|
using DialogHostAvalonia;
|
|
|
|
namespace v2rayN.Desktop.Views;
|
|
|
|
public partial class SudoPasswordInputView : UserControl
|
|
{
|
|
public SudoPasswordInputView()
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.Loaded += (s, e) => txtPassword.Focus();
|
|
|
|
btnSave.Click += (_, _) =>
|
|
{
|
|
if (string.IsNullOrEmpty(txtPassword.Text))
|
|
{
|
|
txtPassword.Focus();
|
|
return;
|
|
}
|
|
Dispatcher.UIThread.Post(() =>
|
|
{
|
|
DialogHost.Close(null, txtPassword.Text);
|
|
});
|
|
};
|
|
|
|
btnCancel.Click += (_, _) =>
|
|
{
|
|
DialogHost.Close(null);
|
|
};
|
|
}
|
|
}
|