Browse Source

r7441@daniel-notebook (orig r3403): daniel | 2008-08-17 17:03:08 +0200

Show AsynchronousWaitDialog while svn operation is running.


git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3413 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
e9651c33a5
  1. 20
      src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs
  2. 6
      src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs
  3. 6
      src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs

20
src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClientWrapper.cs

@ -131,6 +131,24 @@ namespace ICSharpCode.Svn @@ -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<string, Status> statusCache = new Dictionary<string, Status>(StringComparer.InvariantCultureIgnoreCase);
@ -142,6 +160,7 @@ namespace ICSharpCode.Svn @@ -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 @@ -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 });
}

6
src/AddIns/Misc/SubversionAddIn/Project/Src/SvnMessageView.cs

@ -42,8 +42,12 @@ namespace ICSharpCode.Svn @@ -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) {

6
src/Main/Base/Project/Src/Gui/Dialogs/AsynchronousWaitDialog.cs

@ -106,6 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -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 @@ -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 @@ -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));

Loading…
Cancel
Save