Good day.
There was a problem with backgroundWorker, that is, it works at 60% and does not work at 40%, and everything happens randomly, for example, with 3 attempts to start it works, and with the next 4 it turns off at the first cycle. What could be the problem?
private void backgroundWorker1_DoWork_1(object sender, DoWorkEventArgs e) { bool BeginCycle = true; while (BeginCycle != false) { GetSensorData(); GraphMemory(); if (backgroundWorker1.CancellationPending) { BeginCycle = false; e.Cancel = true; break; } else if (!backgroundWorker1.CancellationPending) { BeginCycle = true; if (VariableVideoController.AdapterCompatibility[Form1.BufIndex] != MainClass.GetSensor.Vendor) { this.Invoke(new Action(() => textBox17.Text = "N/A")); } try { if ( VariableVideoController.AdapterCompatibility[Form1.BufIndex] == MainClass.GetSensor.Vendor) { this.Invoke(new Action(() => textBox17.Text = MainClass.GetSensor.GetGPUCore.ToString() + " MHz")); } } catch (Exception Error) { return; } } } } private void FormVideocardInfo_FormClosed(object sender, FormClosedEventArgs e) { backgroundWorker1.CancelAsync(); }
GetSensorData()- if it is important to describe your problem, then give the code, if not, remove it from the example. - VladD