This commit is contained in:
CreepyCrafter24 2020-03-16 20:31:00 +01:00
parent 84ab3faf5e
commit 8fff6b1500

View File

@ -5,21 +5,27 @@ namespace UpTool2
{ {
internal partial class AppNameDialog : Form internal partial class AppNameDialog : Form
{ {
public string name; private string _name;
private AppNameDialog() => InitializeComponent(); private AppNameDialog() => InitializeComponent();
public static string Show() public new static string Show()
{ {
using AppNameDialog dialog = new AppNameDialog(); using AppNameDialog dialog = new AppNameDialog();
dialog.ShowDialog(); dialog.ShowDialog();
return dialog.name; return dialog._name;
} }
private void AppNameDialog_FormClosed(object sender, FormClosedEventArgs e) => name = nameBox.Text; private void AppNameDialog_FormClosed(object sender, FormClosedEventArgs e) => _name = nameBox.Text;
private void AppNameDialog_FormClosing(object sender, FormClosingEventArgs e) => name = nameBox.Text; private void AppNameDialog_FormClosing(object sender, FormClosingEventArgs e) => _name = nameBox.Text;
private void textBox1_TextChanged(object sender, EventArgs e) => name = nameBox.Text; private void nameBox_TextChanged(object sender, EventArgs e) => _name = nameBox.Text;
private void nameBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
Close();
}
} }
} }