protected static CustomWorkerDialog ShowAsync(System.Type workerDialogType, EventBackgroundWorker worker) { AsyncWorkerDialog parameter = new AsyncWorkerDialog { UICulture = Thread.CurrentThread.CurrentUICulture, DialogType = workerDialogType, Worker = worker }; Thread thread = new Thread(new ParameterizedThreadStart(CustomWorkerDialog.RunDialog)); thread.SetApartmentState(ApartmentState.STA); thread.Start(parameter); parameter.AsyncWaitHandle.WaitOne(); return parameter.Dialog; }
public bool Run(IWin32Window owner, EventBackgroundWorker woker) { return this.Run(owner, woker, ThreadPriority.Normal); }
public bool Run(IWin32Window owner, EventBackgroundWorker worker, ThreadPriority priority) { Debug.Assert(!this.CompletedEvent.WaitOne(0, false)); base.ShowInTaskbar = false; this.tsbTopMost.Visible = false; base.StartPosition = FormStartPosition.CenterParent; this.FWorker = worker; this.AttachEvents(); this.CreateHandle(); worker.RunAsync(priority); if (this.CompletedEvent.WaitOne(500, false)) { return (base.DialogResult == DialogResult.OK); } return (base.ShowDialog(owner) == DialogResult.OK); }
private void Write189_EventBackgroundWorker(string n, string ns, EventBackgroundWorker o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } } else if (!needType) { System.Type type = o.GetType(); if (type != typeof(EventBackgroundWorker)) { if (type != typeof(CustomAsyncFolder)) { throw base.CreateUnknownTypeException(o); } this.Write194_CustomAsyncFolder(n, ns, (CustomAsyncFolder) o, isNullable, true); } } }