diff ServerMonitor/Forms/InputDialog.cs @ 9:7127d5b5ac75

Code cleanup and comments
author Brad Greco <brad@bgreco.net>
date Mon, 08 Apr 2019 21:29:54 -0400
parents c1dffaac66fa
children
line wrap: on
line diff
--- a/ServerMonitor/Forms/InputDialog.cs	Sat Mar 09 20:14:03 2019 -0500
+++ b/ServerMonitor/Forms/InputDialog.cs	Mon Apr 08 21:29:54 2019 -0400
@@ -1,21 +1,19 @@
 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
 {
+    /// <summary>Message dialog with an input box.</summary>
     public partial class InputDialog : Form
     {
+        /// <summary>Message to show.</summary>
         public string Message { get; set; }
 
+        /// <summary>Icon to show.</summary>
         public Icon MessageIcon { get; set; }
 
+        /// <summary>The text entered by the user.</summary>
         public string Input { get; private set; } = "";
 
         public InputDialog()
@@ -29,6 +27,17 @@
             MessageLabel.Text = Message;
         }
 
+        /// <summary>Updates the public property with the checked state so it can be read by the dialog owner.</summary>
+        private void InputTextBox_TextChanged(object sender, EventArgs e)
+        {
+            Input = InputTextBox.Text;
+        }
+
+        /// <summary>Creates and shows an input box dialog.</summary>
+        /// <param name="message">The message to display.</param>
+        /// <param name="icon">The icon to display.</param>
+        /// <param name="owner">The dialog owner.</param>
+        /// <returns>The string entered by the user, or null if the dialog was cancelled.</returns>
         public static string ShowDialog(string message, Icon icon = null, IWin32Window owner = null)
         {
             using (InputDialog dialog = new InputDialog() { Message = message, MessageIcon = icon })
@@ -36,10 +45,5 @@
                 return dialog.ShowDialog(owner) == DialogResult.OK ? dialog.Input : null;
             }
         }
-
-        private void InputTextBox_TextChanged(object sender, EventArgs e)
-        {
-            Input = InputTextBox.Text;
-        }
     }
 }