diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs index c74bb39560..51cb611f87 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs @@ -131,6 +131,24 @@ namespace ICSharpCode.Svn } #endregion + #region Cancel support + bool cancel; + + public void Cancel() + { + cancel = true; + } + + SvnError OnCancel(IntPtr baton) + { + // TODO: lookup correct error number + if (cancel) + return SvnError.Create(1, SvnError.NoError, "User cancelled."); + else + return SvnError.NoError; + } + #endregion + AprPoolHandle memoryPool; SvnClient client; Dictionary statusCache = new Dictionary(StringComparer.InvariantCultureIgnoreCase); @@ -142,6 +160,7 @@ namespace ICSharpCode.Svn memoryPool = new AprPoolHandle(); client = new SvnClient(memoryPool.Pool); client.Context.NotifyFunc2 = new SvnDelegate(new SvnWcNotify.Func2(OnNotify)); + client.Context.CancelFunc = new SvnDelegate(new SvnClient.CancelFunc(OnCancel)); } public void Dispose() @@ -300,6 +319,7 @@ namespace ICSharpCode.Svn // and register authorization if necessary CheckNotDisposed(); OpenAuth(); + cancel = false; if (OperationStarted != null) OperationStarted(this, new SubversionOperationEventArgs { Operation = operationName }); } diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs index c9992d636e..74e49a531f 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs @@ -42,8 +42,12 @@ namespace ICSharpCode.Svn }; AsynchronousWaitDialog waitDialog = null; client.OperationStarted += delegate(object sender, SubversionOperationEventArgs e) { - if (waitDialog != null) + if (waitDialog == null) { waitDialog = AsynchronousWaitDialog.ShowWaitDialog("svn " + e.Operation); +// waitDialog.Cancelled += delegate { +// client.Cancel(); +// }; + } }; client.OperationFinished += delegate { if (waitDialog != null) { diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs index 50d80cdaf9..7f8d9be8c4 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs @@ -106,6 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui void Run() { Thread.Sleep(ShowWaitDialogDelay); + bool isShowingDialog; lock (lockObject) { if (disposed) return; @@ -115,8 +116,9 @@ namespace ICSharpCode.SharpDevelop.Gui UpdateTask(); dlg.CreateControl(); IntPtr h = dlg.Handle; // force handle creation + isShowingDialog = showingDialog; } - if (showingDialog) { + if (isShowingDialog) { Application.Run(); } else { Application.Run(dlg); @@ -250,8 +252,8 @@ namespace ICSharpCode.SharpDevelop.Gui get { return showingDialog; } set { if (showingDialog != value) { - showingDialog = value; lock (lockObject) { + showingDialog = value; if (dlg != null && disposed == false) { if (value) { dlg.BeginInvoke(new MethodInvoker(dlg.Hide));