public DialogResult Start() { switch (Task) { case Tasks.DumpKernel: Text = Resources.DumpingKernel; break; case Tasks.FlashKernel: if (!string.IsNullOrEmpty(Mod)) { Text = Resources.FlasingCustom; } else { Text = Resources.FlasingOriginal; } break; case Tasks.Memboot: Text = Resources.UploadingGames; break; } SetProgress(0, 1); if (!WaitingForm.WaitForDevice(vid, pid)) { DialogResult = DialogResult.Abort; return(DialogResult); } thread = new Thread(StartThread); thread.Start(); return(ShowDialog()); }
private void WaitForDeviceInvoke(UInt16 vid, UInt16 pid) { waitDeviceResult = null; if (InvokeRequired) { Invoke(new Action <UInt16, UInt16>(WaitForDeviceInvoke), new object[] { vid, pid }); return; } waitDeviceResult = WaitingForm.WaitForDevice(vid, pid); }
public DialogResult Start() { SetProgress(0, 1); if (!WaitingForm.WaitForDevice(vid, pid)) { DialogResult = DialogResult.Abort; return(DialogResult); } thread = new Thread(StartThread); thread.Start(); return(ShowDialog()); }
void WaitForDeviceFromThread() { if (InvokeRequired) { Invoke(new Action(WaitForDeviceFromThread)); return; } if (fel != null) { fel.Close(); } DeviceWaitResult = WaitingForm.WaitForDevice(vid, pid) ? DialogResult.OK : DialogResult.Abort; }
DialogResult WaitForDeviceFromThread() { if (InvokeRequired) { return((DialogResult)Invoke(new Func <DialogResult>(WaitForDeviceFromThread))); } SetStatus(Resources.WaitingForDevice); if (fel != null) { fel.Close(); } TaskbarProgress.SetState(this.Handle, TaskbarProgress.TaskbarStates.Paused); if (WaitingForm.WaitForDevice(vid, pid)) { fel = new Fel(); if (!File.Exists(fes1Path)) { throw new FileNotFoundException(fes1Path + " not found"); } if (!File.Exists(ubootPath)) { throw new FileNotFoundException(ubootPath + " not found"); } fel.Fes1Bin = File.ReadAllBytes(fes1Path); fel.UBootBin = File.ReadAllBytes(ubootPath); fel.Open(vid, pid); SetStatus(Resources.UploadingFes1); fel.InitDram(true); TaskbarProgress.SetState(this.Handle, TaskbarProgress.TaskbarStates.Normal); return(DialogResult.OK); } else { return(DialogResult.Abort); } }