Mercurial > servermonitor
comparison ServerMonitor/Forms/InputDialog.cs @ 5:b6fe203af9d5
Private key passwords and validation
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Thu, 28 Feb 2019 21:19:32 -0500 |
parents | |
children | c1dffaac66fa |
comparison
equal
deleted
inserted
replaced
4:3142e52cbe69 | 5:b6fe203af9d5 |
---|---|
1 using System; | |
2 using System.Collections.Generic; | |
3 using System.ComponentModel; | |
4 using System.Data; | |
5 using System.Drawing; | |
6 using System.Linq; | |
7 using System.Text; | |
8 using System.Threading.Tasks; | |
9 using System.Windows.Forms; | |
10 | |
11 namespace ServerMonitorApp | |
12 { | |
13 public partial class InputDialog : Form | |
14 { | |
15 public string Message { get; set; } | |
16 | |
17 public Icon MessageIcon { get; set; } | |
18 | |
19 public string Input { get; private set; } | |
20 | |
21 public InputDialog() | |
22 { | |
23 InitializeComponent(); | |
24 } | |
25 | |
26 private void InputDialog_Load(object sender, EventArgs e) | |
27 { | |
28 MessageIconPictureBox.Image = (MessageIcon ?? SystemIcons.Question).ToBitmap(); | |
29 MessageLabel.Text = Message; | |
30 } | |
31 | |
32 public static string ShowDialog(string message, Icon icon = null, IWin32Window owner = null) | |
33 { | |
34 using (InputDialog dialog = new InputDialog() { Message = message, MessageIcon = icon }) | |
35 { | |
36 return dialog.ShowDialog(owner) == DialogResult.OK ? dialog.Input : null; | |
37 } | |
38 } | |
39 | |
40 private void InputTextBox_TextChanged(object sender, EventArgs e) | |
41 { | |
42 Input = InputTextBox.Text; | |
43 } | |
44 } | |
45 } |