public void ListenToCPUUsage(VitalIndicator indicator) { var text = (string)indicator.label.Content; Action task = () => { var usage = GetCPUUsage(); var usageText = text + usage + "%"; Action updateUI = () => { indicator.UpdateIndicator(usageText, usage); }; indicator.Dispatcher.Invoke(updateUI); }; InvokeEverySeconds(task, 2); }
public void ListenToGPULoad(VitalIndicator indicator) { var text = (string)indicator.label.Content; Action task = () => { var usage = gpuReport.load; var usageText = text + usage + "%"; Action updateUI = () => { indicator.UpdateIndicator(usageText, usage); }; indicator.Dispatcher.Invoke(updateUI); }; task(); InvokeEverySeconds(task, 2); }
public void ListenToGPUFanSpeed(VitalIndicator indicator) { var text = (string)indicator.label.Content; Action task = () => { var usage = gpuReport.fanSpeed; var usagePercent = (((double)gpuReport.fanSpeed / 4000.0) * 100.0); var usageText = text + usage + " RPM"; Action updateUI = () => { indicator.UpdateIndicator(usageText, usagePercent); }; indicator.Dispatcher.Invoke(updateUI); }; task(); InvokeEverySeconds(task, 2); }
public void ListenToGPUTemp(VitalIndicator indicator) { var text = (string)indicator.label.Content; Action task = () => { var tempf = gpuReport.tempFahrenheit; var tempPercent = ((tempf / 200.0) * 100); var usageText = text + tempf + "F"; Action updateUI = () => { indicator.UpdateIndicator(usageText, tempPercent); }; indicator.Dispatcher.Invoke(updateUI); }; task(); InvokeEverySeconds(task, 2); }
public void ListenToDrive(VitalIndicator indicator, DriveInfo drive) { var driveLabel = drive.Name; driveLabel = driveLabel.Replace(@":\", "") + " : "; var percentUsed = Math.Abs((((100 * drive.AvailableFreeSpace / drive.TotalSize)) - 100)); Action task = () => { var usedText = driveLabel + percentUsed + "%"; Action updateUI = () => { indicator.UpdateIndicator(usedText, percentUsed); }; indicator.Dispatcher.Invoke(updateUI); }; task(); InvokeEverySeconds(task, 120); }