Mercurial > servermonitor
view ServerMonitor/Forms/InputDialog.cs @ 6:c1dffaac66fa
- Don't show multiple password dialogs for the same key if the first one was cancelled.
- Add option to trim log files.
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Fri, 01 Mar 2019 21:38:22 -0500 |
parents | b6fe203af9d5 |
children | 7127d5b5ac75 |
line wrap: on
line source
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ServerMonitorApp { public partial class InputDialog : Form { public string Message { get; set; } public Icon MessageIcon { get; set; } public string Input { get; private set; } = ""; public InputDialog() { InitializeComponent(); } private void InputDialog_Load(object sender, EventArgs e) { MessageIconPictureBox.Image = (MessageIcon ?? SystemIcons.Question).ToBitmap(); MessageLabel.Text = Message; } public static string ShowDialog(string message, Icon icon = null, IWin32Window owner = null) { using (InputDialog dialog = new InputDialog() { Message = message, MessageIcon = icon }) { return dialog.ShowDialog(owner) == DialogResult.OK ? dialog.Input : null; } } private void InputTextBox_TextChanged(object sender, EventArgs e) { Input = InputTextBox.Text; } } }