private void WizardPagePlaceDevice_Initialize(object sender, AeroWizard.WizardPageInitEventArgs e) { this.wizardPagePlaceDevice.Controls.Add(this.imeiInput1); this.imeiInput1.clear(); this.imeiInput1.Focus(); //pictureBox1.Image = Image.FromFile(@"C:\Tools\logs\Rotating_earth_(large).gif"); Program.logIt("WizardPagePlaceDevice_Initialize: ++"); #if false tokenSource = new CancellationTokenSource(); // start task wait for device loaded Task t = Task.Factory.StartNew((o) => { // oe control Task tt = Task.Run(() => OEControl.load()); CancellationToken ct = (CancellationToken)o; utility.IniFile avia_device = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "AviaDevice.ini")); bool done = false; while (!done) { System.Threading.Thread.Sleep(1000); if (ct.IsCancellationRequested) { // camcelled. break; } else { string s = avia_device.GetString("device", "device", ""); if (string.Compare(s, "ready", true) == 0) { done = true; } } } // device connect. if (done) { this.Invoke(new Action(() => wizardControl1.NextPage())); } tt.Wait(); }, tokenSource.Token); #endif Program.logIt("WizardPagePlaceDevice_Initialize: --"); }
private void WizardPagePlaceDevice_Enter(object sender, EventArgs e) { Program.logIt("WizardPagePlaceDevice_Enter: ++"); Task.Run(() => OEControl.load()); //this.imeiInput1.clear(); // this.imeiInput1.Focus(); labelReady.Visible = false; wizardPagePlaceDevice.ShowNext = false; utility.IniFile ini = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "aviaDevice.ini")); //ini.WriteValue("device", "select", comboBoxModels.SelectedItem.ToString()); ini.DeleteSection("device"); //this.wizardPagePlaceDevice.Commit += new System.EventHandler<AeroWizard.WizardPageConfirmEventArgs>(this.WizardPagePlaceDevice_Commit); //this.wizardPagePlaceDevice.Commit += WizardPagePlaceDevice_Commit; Task.Run(() => { utility.IniFile avia_device = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "AviaDevice.ini")); bool done = false; while (!done) { System.Threading.Thread.Sleep(1000); { string s = avia_device.GetString("device", "device", ""); if (string.Compare(s, "ready", true) == 0) { done = true; } } } if (done) { this.Invoke(new Action(() => { labelReady.Visible = true; wizardPagePlaceDevice.ShowNext = true; })); } }); Program.logIt("WizardPagePlaceDevice_Enter: --"); }
private void ButtonLoad_Click(object sender, EventArgs e) { OEControl.load(); }