private void OnShowHddLoadsCallback(object state) { if (string.IsNullOrEmpty(this.currentSelectedHdd)) { return; } var hddLoad = string.Empty; bool allHdds = false; allHdds = this.currentSelectedHdd == WsapmTools.GetCommonDiaplayNameAllDrives(); try { if (allHdds) { hddLoad = WsapmConvert.ConvertByteToKB(this.hddLoad.GetCurrentHddLoadTotalAllHdds()).ToString("0.00") + " KB/s"; } else { hddLoad = WsapmConvert.ConvertByteToKB(this.hddLoad.GetCurrentHddLoadInBytesPerSecond(this.currentSelectedHdd)).ToString("0.00") + " KB/s"; } } catch (Exception) { } Dispatcher.Invoke((Action)(() => { this.labelCurrentHddLoad.Content = hddLoad; })); }
public AddHddWindow(HddToMonitor[] allDrives) { InitializeComponent(); this.allDrives = allDrives; var hdds = WsapmTools.GetAvailableLogicalVolumeNames(); foreach (var hdd in hdds) { this.comboBoxAvailableDrives.Items.Add(hdd); } this.comboBoxAvailableDrives.Items.Add(WsapmTools.GetCommonDiaplayNameAllDrives()); this.hddLoad = new HddLoadCurrent(); this.hddLoadTimer = null; this.hddLoadTimer = new Timer(OnShowHddLoadsCallback, null, new TimeSpan(), this.displayRefreshInterval); }