private void WizardPageInProcess_Initialize(object sender, AeroWizard.WizardPageInitEventArgs e) { this.wizardPageInProcess.Controls.Add(this.imeiInput1); this.imeiInput1.Focus(); labelStatus.Text = "Scan in progress"; this.wizardPageInProcess.Text = labelStatus.Text; Task t = Task.Run(() => { Task tt = Task.Run(() => OEControl.scan()); bool done = false; int step = 0; utility.IniFile avia_device = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "AviaDevice.ini")); while (!done) { System.Threading.Thread.Sleep(300); wizardControl1.Invoke(new Action(() => { progressBar1.Value = Math.Min(step++, progressBar1.Maximum); progressBar1.Update(); })); // check the progress string cmd = avia_device.GetString("query", "command", ""); if (string.Compare(cmd, "PMP", true) == 0) { wizardControl1.Invoke(new Action(() => { labelStatus.Text = "Inspection in progress"; this.wizardPageInProcess.Text = labelStatus.Text; })); } // check result string grade = avia_device.GetString("device", "grade", ""); if (!string.IsNullOrEmpty(grade)) { Program.logIt($"Result: {grade}"); done = true; step = 100; wizardControl1.Invoke(new Action(() => { progressBar1.Value = progressBar1.Maximum; progressBar1.Update(); })); } } wizardControl1.Invoke(new Action(() => { wizardControl1.NextPage(); })); tt.Wait(); }); }
private void ButtonScan_Click(object sender, EventArgs e) { OEControl.scan(); }