public Form_CpuTempMonitorSettings(CpuTemp temp, IWinhuePluginHost host) { InitializeComponent(); Temp = temp; Host = host; temp.OnTempUpdated += temp_OnTempUpdated; Temp.Start(); if (Dispatcher.CheckAccess()) { cbListCpuSensors.Items.Clear(); foreach (ISensor sensor in temp.cpuSensors) { cbListCpuSensors.Items.Add(sensor); if (sensor.Name.Contains("Package")) { cbListCpuSensors.SelectedIndex = cbListCpuSensors.Items.Count - 1; } } } else { Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { cbListCpuSensors.Items.Clear(); foreach (ISensor sensor in temp.cpuSensors) { cbListCpuSensors.Items.Add(sensor); if (sensor.Name.Contains("Package")) { cbListCpuSensors.SelectedIndex = cbListCpuSensors.Items.Count - 1; } } })); } }
public CpuTempMonitor() { _temp = new CpuTemp(1); _temp.OnTempUpdated += temp_OnTempUpdated; LoadSettings(); }