-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPromptDialog.cs
29 lines (28 loc) · 974 Bytes
/
PromptDialog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileManager
{
public static class PromptDialog
{
public static string ShowDialog(string text, string caption)
{
Form prompt = new Form();
prompt.Width = 300;
prompt.Height = 150;
prompt.Text = caption;
Label textLabel = new Label() { Left = 50, Top = 20, Text = text };
TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 180 };
Button confirmation = new Button() { Text = "Ok", Left = 90, Width = 100, Top = 70 };
confirmation.Click += (sender, e) => prompt.Close();
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.Controls.Add(textBox);
prompt.ShowDialog();
return textBox.Text;
}
}
}