Mercurial > servermonitor
view ServerMonitor/Controls/DiskSpaceCheckControl.cs @ 5:b6fe203af9d5
Private key passwords and validation
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Thu, 28 Feb 2019 21:19:32 -0500 |
parents | 453ecc1ed9ea |
children | 7127d5b5ac75 |
line wrap: on
line source
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 { [CheckType(typeof(DiskSpaceCheck))] public partial class DiskSpaceCheckControl : CheckControl { public DiskSpaceCheckControl() { InitializeComponent(); } private void DiskSpaceCheckControl_Load(object sender, EventArgs e) { FreeSpaceUnitsComboBox.SelectedIndex = 1; } public override void LoadCheck(Check check1) { DiskSpaceCheck check = (DiskSpaceCheck)check1; DeviceTextBox.Text = check.Device; FreeSpaceTextBox.Text = check.MinFreeSpace.ToString(); FreeSpaceUnitsComboBox.SelectedIndex = (int)check.FreeSpaceUnits; } public override void UpdateCheck(Check check1) { DiskSpaceCheck check = (DiskSpaceCheck)check1; check.Device = DeviceTextBox.Text.Trim(); check.FreeSpaceUnits = (FreeSpaceUnits)FreeSpaceUnitsComboBox.SelectedIndex; try { check.MinFreeSpace = double.Parse(FreeSpaceTextBox.Text); } catch { check.MinFreeSpace = 0; throw new UpdateCheckException("Free space must be numeric."); } } } }