working on Person Form
This commit is contained in:
@ -707,6 +707,62 @@ namespace EduNetworkBuilder
|
||||
return mac;
|
||||
}
|
||||
|
||||
public static string TextPromptBox(string Prompt, Icon theIcon=null, bool isPassword = false)
|
||||
{
|
||||
return TextPromptBox(Prompt, "", "", theIcon, isPassword);
|
||||
}
|
||||
public static string TextPromptBox(string Prompt, string Title, Icon theIcon = null, bool isPassword=false)
|
||||
{
|
||||
return TextPromptBox(Prompt, Title, "", theIcon, isPassword);
|
||||
}
|
||||
public static string TextPromptBox(string Prompt, string Title, string oldtext, Icon theIcon, bool isPassword)
|
||||
{
|
||||
//we need to choose a language:
|
||||
int yspace = 10;
|
||||
Form TextInputForm = new Form();
|
||||
TextInputForm.Text = Prompt;
|
||||
Label lblText = new Label();
|
||||
lblText.Location = new Point(5, 5);
|
||||
lblText.AutoSize = true;
|
||||
lblText.Text = Prompt;
|
||||
if(theIcon != null)
|
||||
TextInputForm.Icon = theIcon;
|
||||
if (oldtext == null) oldtext = "";
|
||||
|
||||
TextBox tbEvent = new TextBox();
|
||||
tbEvent.Location = new Point(lblText.Location.X, lblText.Location.Y + lblText.Height + yspace);
|
||||
tbEvent.Width = 120;
|
||||
tbEvent.Text = oldtext;//Populate it with the old data if we can
|
||||
if (isPassword)
|
||||
tbEvent.PasswordChar = '*';
|
||||
|
||||
TextInputForm.Width = tbEvent.Location.X + tbEvent.Width + 30;
|
||||
TextInputForm.Height = 90;
|
||||
TextInputForm.AutoSize = true;
|
||||
|
||||
Button btnAccept = new Button();
|
||||
btnAccept.Location = new Point(tbEvent.Location.X, tbEvent.Location.Y + tbEvent.Height + yspace);
|
||||
btnAccept.Text = "OK";
|
||||
btnAccept.Click += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; f.Close(); };
|
||||
|
||||
Button btnCancel = new Button();
|
||||
btnCancel.Location = new Point(btnAccept.Location.X + btnAccept.Width + 10, tbEvent.Location.Y + tbEvent.Height + 10);
|
||||
btnCancel.Text = "Cancel";
|
||||
btnCancel.Click += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; tbEvent.Text = ""; f.Close(); };
|
||||
|
||||
|
||||
TextInputForm.Controls.Add(lblText);
|
||||
TextInputForm.Controls.Add(tbEvent);
|
||||
TextInputForm.Controls.Add(btnAccept);
|
||||
TextInputForm.Controls.Add(btnCancel);
|
||||
|
||||
TextInputForm.AcceptButton = btnAccept;
|
||||
TextInputForm.CancelButton = btnCancel;
|
||||
|
||||
TextInputForm.ShowDialog();
|
||||
return tbEvent.Text;
|
||||
}
|
||||
|
||||
public static bool MAC_Exists(string MAC)
|
||||
{
|
||||
Network myNet = GetNetwork();
|
||||
|
Reference in New Issue
Block a user