I am having a bit of trouble putting two progress bars in the same tick event. The second progress bar either loads to 0% or 100% and nothing between these two values. This is the code i have so far.
void timeElapsed(object sender, EventArgs e)
{
progressBar1.Value = (int)(power.BatteryLifePercent * 100);
label1.Text = string.Format("{0}%", (power.BatteryLifePercent * 100));
cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";
var unused = cpuCounter.NextValue();
progressBar2.Value = (int)(cpuCounter.NextValue());
label2.Text = "CPU " + progressBar2.Value.ToString() + "%";
}
The first progress bar loads fine and the battery percentage is correct however the second progress bar always is on 100% or 0%.