Files
XplorePlane/XP.Hardware.RaySource.Comet.Host/Forms/ForceExitPasswordDialog.cs
T

70 lines
2.1 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
namespace XP.Hardware.RaySource.Comet.Host
{
/// <summary>
/// 强制退出密码输入对话框
/// Force exit password input dialog
/// </summary>
internal sealed class ForceExitPasswordDialog : Form
{
private readonly TextBox _txtPassword;
/// <summary>
/// 用户输入的密码 | The password entered by user
/// </summary>
public string EnteredPassword => _txtPassword.Text;
public ForceExitPasswordDialog()
{
// 窗体属性 | Form properties
Text = "强制退出验证 | Force Exit Verification";
FormBorderStyle = FormBorderStyle.FixedDialog;
StartPosition = FormStartPosition.CenterParent;
MaximizeBox = false;
MinimizeBox = false;
ClientSize = new Size(320, 130);
// 提示标签 | Prompt label
var lbl = new Label
{
Text = "请输入管理员密码以强制退出:\r\nPlease enter admin password to force exit:",
Location = new Point(12, 12),
AutoSize = true
};
// 密码输入框 | Password text box
_txtPassword = new TextBox
{
Location = new Point(12, 52),
Size = new Size(290, 23),
UseSystemPasswordChar = true
};
// 确定按钮 | OK button
var btnOk = new Button
{
Text = "确定",
DialogResult = DialogResult.OK,
Location = new Point(146, 90),
Size = new Size(75, 28)
};
// 取消按钮 | Cancel button
var btnCancel = new Button
{
Text = "取消",
DialogResult = DialogResult.Cancel,
Location = new Point(227, 90),
Size = new Size(75, 28)
};
AcceptButton = btnOk;
CancelButton = btnCancel;
Controls.AddRange(new Control[] { lbl, _txtPassword, btnOk, btnCancel });
}
}
}