Mercurial > servermonitor
view ServerMonitor/Controls/DiskSpaceCheckControl.cs @ 2:453ecc1ed9ea
Disk space check
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Sun, 06 Jan 2019 20:49:08 -0500 |
parents | |
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."); } } } }