public UnbindDisposer(SvnClient client, ProgressDialog dlg) { if (client == null) throw new ArgumentNullException("client"); else if (dlg == null) throw new ArgumentNullException("dlg"); _client = client; _dlg = dlg; }
/// <summary> /// Call this to start the operation. /// </summary> /// <param name="caption">The caption to use in the progress dialog.</param> public void Start(string caption) { Thread thread = new Thread(new ParameterizedThreadStart(this.Run)); ISvnClientPool pool = _context.GetService<ISvnClientPool>(); IAnkhDialogOwner dialogOwner = _context.GetService<IAnkhDialogOwner>(); using (ProgressDialog dialog = new ProgressDialog()) using (SvnClient client = pool.GetClient()) using (CreateUpdateReport ? BindOutputPane(client) : null) using (dialog.Bind(client)) { _sync = dialog; dialog.Caption = caption; dialog.Context = _context; thread.Name = "AnkhSVN Worker"; bool threadStarted = false; dialog.HandleCreated += delegate { if (!threadStarted) { threadStarted = true; thread.Start(client); } }; _invoker = dialog; do { if (!_closed) { dialog.ShowDialog(_context); } else Application.DoEvents(); // Show the dialog again if the thread join times out // Do this to handle the acase where the service wants to // pop up a dialog before canceling. // BH: Experienced this 2008-09-29 when our repository server // accepted http connections but didn't handle them in time } while (!thread.Join(2500)); } if (_cancelled) { // NOOP } else if (_exception != null) throw new ProgressRunnerException(this._exception); }