diff ServerMonitor/Controls/FileCheckControl.cs @ 9:7127d5b5ac75

Code cleanup and comments
author Brad Greco <brad@bgreco.net>
date Mon, 08 Apr 2019 21:29:54 -0400
parents 96f0b028176d
children 832a07de0f90
line wrap: on
line diff
--- a/ServerMonitor/Controls/FileCheckControl.cs	Sat Mar 09 20:14:03 2019 -0500
+++ b/ServerMonitor/Controls/FileCheckControl.cs	Mon Apr 08 21:29:54 2019 -0400
@@ -1,14 +1,8 @@
 using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
 
 namespace ServerMonitorApp
 {
+    /// <summary>Control for editing a file check.</summary>
     [CheckType(typeof(FileCheck))]
     public partial class FileCheckControl : CheckControl
     {
@@ -19,10 +13,12 @@
 
         private void DiskSpaceCheckControl_Load(object sender, EventArgs e)
         {
+            // Initialize the combo boxes to non-empty values.
             FileSizeComparisonComboBox.SelectedIndex = 0;
             DateModifiedComparisonComboBox.SelectedIndex = 0;
         }
 
+        /// <summary>Sets the values of the controls from a check's properties.</summary>
         public override void LoadCheck(Check check1)
         {
             FileCheck check = (FileCheck)check1;
@@ -36,12 +32,14 @@
             DateModifiedTextBox.Text = check.DateModified.ToString();
             DateModifiedUnitsComboBox.SelectedIndex = (int)check.DateModifiedUnits;
 
-            if (FileSizeTextBox.Text == "0")
+            // Blank out text boxes that are disabled and have a blank-looking value.
+            if (FileSizeTextBox.Text == "0" && !check.CheckFileSize)
                 FileSizeTextBox.Clear();
-            if (DateModifiedTextBox.Text == "0")
+            if (DateModifiedTextBox.Text == "0" && !check.CheckDateModified)
                 DateModifiedTextBox.Clear();
         }
 
+        /// <summary>Updates the properties of a check from user input.</summary>
         public override void UpdateCheck(Check check1)
         {
             FileCheck check = (FileCheck)check1;