Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/addins')
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs2
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs6
-rw-r--r--main/src/addins/MacPlatform/MacProxyCredentialProvider.cs4
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs5
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs8
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SearchBar.cs4
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SelectorView.cs2
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/StatusBar.cs6
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs24
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs2
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs2
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs8
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs26
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs7
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInProjectHandler.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInSolutionHandler.cs59
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopProjectSystem.cs9
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageCompatibilityChecker.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectOperations.cs69
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs2
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs11
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferencesService.cs5
-rw-r--r--main/src/addins/MonoDeveloperExtensions/Commands.cs4
-rw-r--r--main/src/addins/NUnit/Gui/TestResultsPad.cs14
-rw-r--r--main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs2
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs20
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs8
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.Gui/WorkingCopyFormatDialog.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs8
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/StatusBar.xaml.cs2
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/WPFToolbar.cs5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs4
-rw-r--r--main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs2
52 files changed, 279 insertions, 271 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs
index f26821ec2d..546be6ad18 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs
@@ -301,7 +301,7 @@ namespace MonoDevelop.CSharp.ClassOutline
bool RefillOutlineStore ()
{
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
Gdk.Threads.Enter ();
refreshingOutline = false;
if (outlineTreeStore == null || !outlineTreeView.IsRealized) {
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs
index 3d9f2fda4e..1552b656cb 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs
@@ -27,7 +27,7 @@
//
using System;
-
+using MonoDevelop.Core;
using MonoDevelop.Deployment;
using MonoDevelop.Ide;
@@ -58,10 +58,10 @@ namespace MonoDevelop.Deployment.Gui
//IFileReplacePolicy is not likely to be running in the GUI thread
//so use some DispatchService magic to synchronously call the dialog in the GUI thread
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
using (var dialog = new FileReplaceDialog (response, source, sourceModified.ToString (), target, targetModified.ToString ()))
response = (FileReplaceDialog.ReplaceResponse) MessageService.ShowCustomDialog (dialog);
- });
+ }).Wait ();
switch (response) {
case FileReplaceDialog.ReplaceResponse.Replace:
diff --git a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
index 9ccc5d79d7..8b929b78d9 100644
--- a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
+++ b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
@@ -98,7 +98,7 @@ namespace MonoDevelop.MacIntegration
{
NetworkCredential result = null;
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
using (var ns = new NSAutoreleasePool ()) {
var message = credentialType == CredentialType.ProxyCredentials
@@ -163,7 +163,7 @@ namespace MonoDevelop.MacIntegration
var password = passwordInput.StringValue;
result = new NetworkCredential (username, password);
}
- });
+ }).Wait ();
// store the obtained credentials in the keychain
// but don't store for the root url since it may have other credentials
diff --git a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs b/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
index 4684c43565..26fa1d872a 100644
--- a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
@@ -27,6 +27,7 @@ using System;
using AppKit;
using CoreGraphics;
using Foundation;
+using MonoDevelop.Core;
using MonoDevelop.Ide;
namespace MonoDevelop.MacIntegration.MainToolbar
@@ -43,12 +44,12 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public override void ViewDidMoveToWindow ()
{
NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif =>
- DispatchService.GuiDispatch (toolbarItem.UpdateWidth));
+ Runtime.RunInMainThread (() => toolbarItem.UpdateWidth ()));
NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillEnterFullScreenNotification, notif =>
CenteringSpaceToolbarItem.WindowFullscreening = true);
NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEnterFullScreenNotification, notif => {
CenteringSpaceToolbarItem.WindowFullscreening = false;
- DispatchService.GuiDispatch (toolbarItem.UpdateWidth);
+ Runtime.RunInMainThread (() => toolbarItem.UpdateWidth ());
});
base.ViewDidMoveToWindow ();
diff --git a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
index 3a3bf90904..0a9ff4a042 100644
--- a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
@@ -148,7 +148,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
};
IDisposable resizeTimer = null;
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillStartLiveResizeNotification, notif => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillStartLiveResizeNotification, notif => Runtime.RunInMainThread (() => {
if (!IsCorrectNotification (selector, notif.Object))
return;
@@ -162,7 +162,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
});
}));
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => Runtime.RunInMainThread (() => {
if (!IsCorrectNotification (selector, notif.Object))
return;
@@ -171,7 +171,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
selector.RequestResize ();
}));
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, notif => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, notif => Runtime.RunInMainThread (() => {
if (!IsCorrectNotification (selector, notif.Object))
return;
@@ -274,7 +274,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
MaxSize = new CGSize (360, 22),
};
- Action<NSNotification> resizeAction = notif => DispatchService.GuiDispatch (() => {
+ Action<NSNotification> resizeAction = notif => Runtime.RunInMainThread (() => {
// Skip updates with a null Window. Only crashes on Mavericks.
// The View gets updated once again when the window resize finishes.
if (bar.Window == null)
diff --git a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
index cb1037a0e3..565fffba40 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
@@ -72,7 +72,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
void Initialize ()
{
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResignKeyNotification, notification => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResignKeyNotification, notification => Runtime.RunInMainThread (() => {
var other = (NSWindow)notification.Object;
LogMessage ($"Lost focus from resign key: {other.DebugDescription}.");
@@ -81,7 +81,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
LostFocus (this, null);
}
}));
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notification => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notification => Runtime.RunInMainThread (() => {
var other = (NSWindow)notification.Object;
LogMessage ($"Lost focus from resize: {other.DebugDescription}.");
if (notification.Object == Window) {
diff --git a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
index 21b7f938d0..e7581a9b6a 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
@@ -327,7 +327,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
base.ViewDidMoveToWindow ();
NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification,
- notification => DispatchService.GuiDispatch (RealignTexts));
+ notification => Runtime.RunInMainThread ((Action) RealignTexts));
RealignTexts ();
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
index cf9f3a4824..4948163b90 100644
--- a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
@@ -167,7 +167,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
wc++;
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (ec > 0) {
buildResultVisible = true;
buildResultText.AttributedString = new NSAttributedString (ec.ToString (), foregroundColor: NSColor.Text,
@@ -197,7 +197,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
TaskService.Errors.TasksAdded += updateHandler;
TaskService.Errors.TasksRemoved += updateHandler;
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification, notif => DispatchService.GuiDispatch (() => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification, notif => Runtime.RunInMainThread (() => {
if (Window == null)
return;
@@ -450,7 +450,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public void ShowMessage (IconId image, string message, bool isMarkup, NSColor color)
{
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
bool changed = LoadText (message, isMarkup, color);
LoadPixbuf (image);
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
index c5f37354a0..65ad712d29 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
@@ -80,7 +80,7 @@ namespace MonoDevelop.Debugger.Soft
static T InvokeSynch<T> (Func<T> func)
{
- if (MonoDevelop.Ide.DispatchService.IsGuiThread)
+ if (Runtime.IsMainThread)
return func ();
var ev = new System.Threading.ManualResetEvent (false);
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index dfc399f9dd..9991801685 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -385,7 +385,7 @@ namespace MonoDevelop.Debugger
cancelRegistration = console.CancellationToken.Register (Stop);
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (DebugSessionStarted != null)
DebugSessionStarted (null, EventArgs.Empty);
NotifyLocationChanged ();
@@ -434,7 +434,7 @@ namespace MonoDevelop.Debugger
currentConsole.Dispose ();
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
HideExceptionCaughtDialog ();
if (currentIcon != null) {
@@ -457,23 +457,23 @@ namespace MonoDevelop.Debugger
static void UnsetDebugLayout ()
{
// Dispatch synchronously to avoid start/stop races
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
IdeApp.Workbench.HideCommandBar ("Debug");
if (IdeApp.Workbench.CurrentLayout == "Debug") {
IdeApp.Workbench.CurrentLayout = oldLayout ?? "Solution";
}
oldLayout = null;
- });
+ }).Wait ();
}
static void SetDebugLayout ()
{
// Dispatch synchronously to avoid start/stop races
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
oldLayout = IdeApp.Workbench.CurrentLayout;
IdeApp.Workbench.CurrentLayout = "Debug";
IdeApp.Workbench.ShowCommandBar ("Debug");
- });
+ }).Wait ();
}
public static bool IsDebugging {
@@ -705,7 +705,7 @@ namespace MonoDevelop.Debugger
static void OnBusyStateChanged (object s, BusyStateEventArgs args)
{
isBusy = args.IsBusy;
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
busyDialog.UpdateBusyState (args);
if (args.IsBusy) {
if (busyStatusIcon == null) {
@@ -737,7 +737,7 @@ namespace MonoDevelop.Debugger
nextStatementLocations.Clear ();
currentBacktrace = null;
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
HideExceptionCaughtDialog ();
if (ResumedEvent != null)
ResumedEvent (null, a);
@@ -785,7 +785,7 @@ namespace MonoDevelop.Debugger
static void NotifyPaused ()
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (PausedEvent != null)
PausedEvent (null, EventArgs.Empty);
NotifyLocationChanged ();
@@ -796,7 +796,7 @@ namespace MonoDevelop.Debugger
static void NotifyException (TargetEventArgs args)
{
if (args.Type == TargetEventType.UnhandledException || args.Type == TargetEventType.ExceptionThrown) {
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (CurrentFrame != null) {
ShowExceptionCaughtDialog ();
}
@@ -913,7 +913,7 @@ namespace MonoDevelop.Debugger
set {
if (currentBacktrace != null && value < currentBacktrace.FrameCount) {
currentFrame = value;
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
NotifyCurrentFrameChanged ();
});
}
@@ -940,7 +940,7 @@ namespace MonoDevelop.Debugger
else
currentFrame = -1;
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
NotifyCallStackChanged ();
NotifyCurrentFrameChanged ();
NotifyLocationChanged ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
index 4d9bc48f2f..52ac37e34e 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
@@ -272,7 +272,7 @@ namespace MonoDevelop.Debugger
batchChanged.Add (watch);
return;
}
- DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
if (WatchChanged != null)
WatchChanged (this, new PinnedWatchEventArgs (watch));
});
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
index 6258a1768d..23dccd0463 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
@@ -228,7 +228,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
public void Refresh ()
{
// GUI assert here is to catch Bug 434065 - Exception while going to the editor
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
if (toolboxService.Initializing) {
toolboxWidget.CustomMessage = GettextCatalog.GetString ("Initializing...");
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
index 3b025914ed..3f8fbdeb1c 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
@@ -84,11 +84,11 @@ namespace MonoDevelop.DesignerSupport
openFiles = new List<string> ();
if (!IdeApp.IsInitialized)
return openFiles;
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
foreach (var doc in IdeApp.Workbench.Documents)
if (doc.Editor != null)
openFiles.Add (doc.FileName);
- });
+ }).Wait ();
}
return openFiles;
}
@@ -175,7 +175,7 @@ namespace MonoDevelop.DesignerSupport
}
//these documents are open, so needs to run in GUI thread
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
foreach (KeyValuePair<FilePath, string> item in filesToWrite) {
try {
@@ -213,7 +213,7 @@ namespace MonoDevelop.DesignerSupport
LoggingService.LogError ("CodeBehindWriter failed", ex);
}
}
- });
+ }).Wait ();
filesToWrite = null;
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
index 0d802499f4..68c6ddf7f8 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
@@ -184,7 +184,7 @@ namespace MonoDevelop.DesignerSupport
ctx.Dispose ();
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
AddUserItems (nodes);
initializing--;
SaveConfiguration ();
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
index 2638aada29..2f2e4c8591 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
@@ -117,7 +117,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
if (System.IO.File.Exists (fileName)) {
watcher.Path = Path.GetDirectoryName (fileName);
watcher.Filter = Path.GetFileName (fileName);
- watcher.Changed += DispatchService.GuiDispatchDelegate (new FileSystemEventHandler (OnSteticFileChanged));
+ watcher.Changed += OnSteticFileChanged;
watcher.EnableRaisingEvents = true;
}
}
@@ -161,17 +161,19 @@ namespace MonoDevelop.GtkCore.GuiBuilder
void OnSteticFileChanged (object s, FileSystemEventArgs args)
{
- lock (fileSaveLock) {
- if (lastSaveTime == System.IO.File.GetLastWriteTime (fileName))
- return;
- }
-
- if (GuiBuilderService.HasOpenDesigners (project, true)) {
- if (MessageService.AskQuestion (GettextCatalog.GetString ("The project '{0}' has been modified by an external application. Do you want to reload it?", project.Name), GettextCatalog.GetString ("Unsaved changes in the open GTK designers will be lost."), AlertButton.Cancel, AlertButton.Reload) != AlertButton.Reload)
- return;
- }
- if (!disposed)
- Reload ();
+ Runtime.RunInMainThread (() => {
+ lock (fileSaveLock) {
+ if (lastSaveTime == System.IO.File.GetLastWriteTime (fileName))
+ return;
+ }
+
+ if (GuiBuilderService.HasOpenDesigners (project, true)) {
+ if (MessageService.AskQuestion (GettextCatalog.GetString ("The project '{0}' has been modified by an external application. Do you want to reload it?", project.Name), GettextCatalog.GetString ("Unsaved changes in the open GTK designers will be lost."), AlertButton.Cancel, AlertButton.Reload) != AlertButton.Reload)
+ return;
+ }
+ if (!disposed)
+ Reload ();
+ });
}
public void Reload ()
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
index 2c2f22d28a..b511d9fd7e 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
@@ -113,7 +113,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
public static Stetic.Application SteticApp {
get {
// Stetic is not thread safe, so all has to be done in the gui thread
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
if (steticApp == null) {
steticApp = Stetic.ApplicationFactory.CreateApplication (Stetic.IsolationMode.None);
steticApp.AllowInProcLibraries = false;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs
index 1cb98ff733..78ca552c89 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs
@@ -58,11 +58,10 @@ namespace MonoDevelop.GtkCore.GuiBuilder
}
List<ItemToolboxNode> list = new List<ItemToolboxNode> ();
- ComponentType[] types = null;
- DispatchService.GuiSyncDispatch (delegate {
+ var types = Runtime.RunInMainThread (delegate {
// Stetic is not thread safe, it has to be used from the gui thread
- types = GuiBuilderService.SteticApp.GetComponentTypes (filename);
- });
+ return GuiBuilderService.SteticApp.GetComponentTypes (filename);
+ }).Result;
foreach (ComponentType ct in types) {
if (ct.Category == "window")
continue;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInProjectHandler.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInProjectHandler.cs
index 25b779b780..ce70af4f70 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInProjectHandler.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInProjectHandler.cs
@@ -1,36 +1,37 @@
-//
-// UpdateAllPackagesInProjectHandler.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+//
+// UpdateAllPackagesInProjectHandler.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
using System.Collections.Generic;
using System.Linq;
using MonoDevelop.PackageManagement;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
-
+using MonoDevelop.Core;
+
namespace MonoDevelop.PackageManagement.Commands
{
public class UpdateAllPackagesInProjectHandler : PackagesCommandHandler
@@ -40,7 +41,7 @@ namespace MonoDevelop.PackageManagement.Commands
try {
IPackageManagementProject project = PackageManagementServices.Solution.GetActiveProject ();
RestoreBeforeUpdateAction.Restore (project, () => {
- DispatchService.GuiSyncDispatch (() => Update (project));
+ Runtime.RunInMainThread (() => Update (project)).Wait ();
});
} catch (Exception ex) {
ShowStatusBarError (ex);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInSolutionHandler.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInSolutionHandler.cs
index 035126352f..e6b0d0d4bb 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInSolutionHandler.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/UpdateAllPackagesInSolutionHandler.cs
@@ -1,36 +1,37 @@
-//
-// UpdateAllPackagesInSolutionCommandHandler.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+//
+// UpdateAllPackagesInSolutionCommandHandler.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
using System.Collections.Generic;
using System.Linq;
using MonoDevelop.PackageManagement;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
-
+using MonoDevelop.Core;
+
namespace MonoDevelop.PackageManagement.Commands
{
public class UpdateAllPackagesInSolutionHandler : PackagesCommandHandler
@@ -41,9 +42,9 @@ namespace MonoDevelop.PackageManagement.Commands
UpdateAllPackagesInSolution updateAllPackages = CreateUpdateAllPackagesInSolution ();
ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingPackagesInSolutionMessage (updateAllPackages.Projects);
RestoreBeforeUpdateAction.Restore (updateAllPackages.Projects, () => {
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
Update (updateAllPackages, progressMessage);
- });
+ }).Wait ();
});
} catch (Exception ex) {
ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingPackagesInSolutionMessage ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
index cf20c9755d..22c835f102 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
@@ -454,7 +454,7 @@ namespace MonoDevelop.PackageManagement
{
// Put it back on the GUI thread so the correct synchronization context
// is used. The image loading will be done on a background thread.
- DispatchService.GuiDispatch (() => imageLoader.LoadFrom (iconUrl, row));
+ Runtime.RunInMainThread (() => imageLoader.LoadFrom (iconUrl, row));
}
bool IsOddRow (int row)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
index 0eecfd350d..1fc090597e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
@@ -72,7 +72,7 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
void RefreshAllChildNodes ()
{
- DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
foreach (DotNetProject project in IdeApp.Workspace.GetAllItems<DotNetProject> ()) {
RefreshChildNodes (project);
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
index 88ae83b30c..26cedc9004 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
@@ -235,7 +235,7 @@ namespace MonoDevelop.PackageManagement
protected virtual void GuiDispatch (Action handler)
{
- DispatchService.GuiDispatch (handler);
+ Runtime.RunInMainThread (handler);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopProjectSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopProjectSystem.cs
index 7f22015029..99369c9c09 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopProjectSystem.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopProjectSystem.cs
@@ -55,7 +55,7 @@ namespace MonoDevelop.PackageManagement
new PackageManagementFileService (),
PackageManagementServices.ProjectService,
PackageManagementServices.PackageManagementEvents,
- DispatchService.GuiSyncDispatch,
+ DefaultGuiSyncDispatcher,
GuiSyncDispatchWithException)
{
}
@@ -473,11 +473,16 @@ namespace MonoDevelop.PackageManagement
static Task GuiSyncDispatchWithException (Func<Task> func)
{
- if (DispatchService.IsGuiThread)
+ if (Runtime.IsMainThread)
throw new InvalidOperationException ("GuiSyncDispatch called from GUI thread");
return Runtime.RunInMainThread (func);
}
+ internal static void DefaultGuiSyncDispatcher (MessageHandler action)
+ {
+ Runtime.RunInMainThread (() => action ()).Wait ();
+ }
+
void GuiSyncDispatch (Func<Task> func)
{
guiSyncDispatcherFunc (func).Wait ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageCompatibilityChecker.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageCompatibilityChecker.cs
index 12d9c9827d..f142f72935 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageCompatibilityChecker.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageCompatibilityChecker.cs
@@ -1,29 +1,29 @@
-//
-// PackageCompatibilityChecker.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+//
+// PackageCompatibilityChecker.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -32,7 +32,8 @@ using System.Runtime.Versioning;
using MonoDevelop.PackageManagement;
using MonoDevelop.Ide;
using NuGet;
-
+using MonoDevelop.Core;
+
namespace MonoDevelop.PackageManagement
{
public class PackageCompatibilityChecker
@@ -120,7 +121,7 @@ namespace MonoDevelop.PackageManagement
protected virtual void GuiDispatch (Action handler)
{
- DispatchService.GuiDispatch (handler);
+ Runtime.RunInMainThread (handler);
}
public void GenerateReport (TextWriter writer)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
index 95c2a22941..385cc5266b 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
@@ -101,7 +101,7 @@ namespace MonoDevelop.PackageManagement
protected virtual void GuiSyncDispatch (MessageHandler handler)
{
- DispatchService.GuiSyncDispatch (handler);
+ Runtime.RunInMainThread (() => handler ()).Wait ();
}
void PackageOperationMessageLogged (object sender, PackageOperationMessageLoggedEventArgs e)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
index c935c4ef85..83a9ba4925 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
@@ -71,9 +71,9 @@ namespace MonoDevelop.PackageManagement
public void OpenFile (string path)
{
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
IdeApp.Workbench.OpenDocument (path, null, true);
- });
+ }).Wait ();
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs
index 9bd1d85ebe..4027a7b124 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs
@@ -1,34 +1,35 @@
-//
-// PackageManagementProgressProvider.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+//
+// PackageManagementProgressProvider.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
using MonoDevelop.PackageManagement;
using NuGet;
using MonoDevelop.Ide;
-
+using MonoDevelop.Core;
+
namespace MonoDevelop.PackageManagement
{
public class PackageManagementProgressProvider : IProgressProvider
@@ -36,7 +37,7 @@ namespace MonoDevelop.PackageManagement
Action<Action> guiDispatcher;
public PackageManagementProgressProvider (IPackageRepositoryFactoryEvents repositoryFactoryEvents)
- : this (repositoryFactoryEvents, h => DispatchService.GuiDispatch (h))
+ : this (repositoryFactoryEvents, h => Runtime.RunInMainThread (h))
{
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectOperations.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectOperations.cs
index 49ccd1b854..ee2d961cd2 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectOperations.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectOperations.cs
@@ -1,29 +1,29 @@
-//
-// PackageManagementProjectOperations.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+//
+// PackageManagementProjectOperations.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -31,7 +31,8 @@ using MonoDevelop.PackageManagement;
using MonoDevelop.Ide;
using MonoDevelop.Projects;
using NuGet;
-
+using MonoDevelop.Core;
+
namespace MonoDevelop.PackageManagement
{
public class PackageManagementProjectOperations : IPackageManagementProjectOperations
@@ -66,7 +67,7 @@ namespace MonoDevelop.PackageManagement
{
List<IPackageAction> actions = null;
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
IPackageRepository repository = CreatePackageRepository (packageSourceUrl);
IPackageManagementProject packageManagementProject = solution.GetProject (repository, new DotNetProjectProxy ((DotNetProject)project));
actions = packages.Select (packageReference => {
@@ -75,7 +76,7 @@ namespace MonoDevelop.PackageManagement
action.PackageVersion = new SemanticVersion (packageReference.Version);
return (IPackageAction)action;
}).ToList ();
- });
+ }).Wait ();
ProgressMonitorStatusMessage progressMessage = GetProgressMonitorStatusMessages (actions);
backgroundActionRunner.RunAndWait (progressMessage, actions);
@@ -98,19 +99,15 @@ namespace MonoDevelop.PackageManagement
public IEnumerable<PackageManagementPackageReference> GetInstalledPackages (Project project)
{
- List<PackageManagementPackageReference> packageReferences = null;
-
- DispatchService.GuiSyncDispatch (() => {
+ return Runtime.RunInMainThread (() => {
string url = RegisteredPackageSources.DefaultPackageSourceUrl;
var repository = registeredPackageRepositories.CreateRepository (new PackageSource (url));
IPackageManagementProject packageManagementProject = solution.GetProject (repository, new DotNetProjectProxy ((DotNetProject)project));
- packageReferences = packageManagementProject
+ return packageManagementProject
.GetPackageReferences ()
.Select (packageReference => new PackageManagementPackageReference (packageReference.Id, packageReference.Version.ToString ()))
.ToList ();
- });
-
- return packageReferences;
+ }).Result;
}
void PackageUninstalled (object sender, ParentPackageOperationEventArgs e)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
index ef239bd110..b884bb563b 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
@@ -139,7 +139,7 @@ namespace MonoDevelop.PackageManagement
/// </summary>
void RefreshProjectReferences (bool refreshMSBuildTargets)
{
- DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
foreach (IDotNetProject projectInSolution in solution.GetDotNetProjects ()) {
if (refreshMSBuildTargets) {
projectInSolution.RefreshProjectBuilder ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
index 6474b90952..9e7095dc14 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
@@ -36,7 +36,7 @@ namespace MonoDevelop.PackageManagement
{
public static void ShowPackageConsole (this ProgressMonitor monitor)
{
- DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
var aggregatedMonitor = (PackageManagementProgressMonitor)monitor;
Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (aggregatedMonitor.ConsoleMonitor);
if (pad != null) {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
index 9e79237e71..237d3ba750 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
@@ -38,13 +38,11 @@ namespace MonoDevelop.PackageManagement
{
public class ThreadSafePackageManagementEvents : IThreadSafePackageManagementEvents
{
- static Action<MessageHandler> defaultGuiSyncDispatcher = DispatchService.GuiSyncDispatch;
-
Action<MessageHandler> guiSyncDispatcher;
IPackageManagementEvents unsafeEvents;
public ThreadSafePackageManagementEvents (IPackageManagementEvents unsafeEvents)
- : this (unsafeEvents, defaultGuiSyncDispatcher)
+ : this (unsafeEvents, MonoDevelopProjectSystem.DefaultGuiSyncDispatcher)
{
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs
index 19509840cf..bf24661425 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs
@@ -255,7 +255,7 @@ namespace MonoDevelop.PackageManagement
protected virtual void GuiDispatch (MessageHandler handler)
{
- DispatchService.GuiSyncDispatch (handler);
+ Runtime.RunInMainThread (() => handler ()).Wait ();
}
T GuiSyncDispatch<T> (Func<T> action)
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs
index 8877b2d292..6193f36310 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs
@@ -8,6 +8,7 @@ using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide;
using System.Collections.Generic;
using MonoDevelop.Core.Assemblies;
+using System.Threading.Tasks;
namespace MonoDevelop.WebReferences.Commands
{
@@ -89,21 +90,21 @@ namespace MonoDevelop.WebReferences.Commands
UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext ();
UpdateReferenceContext.BeginProgress (GettextCatalog.GetPluralString ("Updating web reference", "Updating web references", items.Count));
- DispatchService.ThreadDispatch (() => {
+ Task.Run (() => {
for (int i = 0; i < items.Count; i ++) {
- DispatchService.GuiDispatch (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
+ Runtime.RunInMainThread (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
try {
items [i].Update();
} catch (Exception ex) {
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
MessageService.ShowError (GettextCatalog.GetString ("Failed to update Web Reference '{0}'", items [i].Name), ex);
DisposeUpdateContext ();
- });
+ }).Wait ();
return;
}
}
- DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
// Make sure that we save all relevant projects, there should only be 1 though
foreach (var project in items.Select (i =>i.Project).Distinct ())
IdeApp.ProjectOperations.SaveAsync (project);
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferencesService.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferencesService.cs
index 00aa735380..d8b367469c 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferencesService.cs
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferencesService.cs
@@ -29,6 +29,7 @@ using MonoDevelop.Projects;
using System.Collections.Generic;
using MonoDevelop.WebReferences.WCF;
using MonoDevelop.WebReferences.WS;
+using MonoDevelop.Core;
namespace MonoDevelop.WebReferences
{
@@ -62,11 +63,11 @@ namespace MonoDevelop.WebReferences
// This is called from a background thread when webreferences are being
// updated asynchronously, so lets keep things simple for the users of
// this event and just ensure we proxy it to the main thread.
- if (MonoDevelop.Ide.DispatchService.IsGuiThread) {
+ if (Runtime.IsMainThread) {
if (WebReferencesChanged != null)
WebReferencesChanged (null, new WebReferencesChangedEventArgs (project));
} else {
- MonoDevelop.Ide.DispatchService.GuiDispatch (() => {
+ Runtime.RunInMainThread (() => {
if (WebReferencesChanged != null)
WebReferencesChanged (null, new WebReferencesChangedEventArgs (project));
});
diff --git a/main/src/addins/MonoDeveloperExtensions/Commands.cs b/main/src/addins/MonoDeveloperExtensions/Commands.cs
index 7c68a9da1a..9601cd5eb0 100644
--- a/main/src/addins/MonoDeveloperExtensions/Commands.cs
+++ b/main/src/addins/MonoDeveloperExtensions/Commands.cs
@@ -30,7 +30,7 @@ using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
-
+using System.Threading.Tasks;
namespace MonoDeveloper
{
@@ -45,7 +45,7 @@ namespace MonoDeveloper
{
DotNetProject p = IdeApp.ProjectOperations.CurrentSelectedProject as DotNetProject;
if (p != null)
- DispatchService.BackgroundDispatch (new StatefulMessageHandler (Install), p);
+ Task.Run (() => Install (p));
}
protected override void Update (CommandInfo info)
diff --git a/main/src/addins/NUnit/Gui/TestResultsPad.cs b/main/src/addins/NUnit/Gui/TestResultsPad.cs
index 32bbd7716b..1908a3e83f 100644
--- a/main/src/addins/NUnit/Gui/TestResultsPad.cs
+++ b/main/src/addins/NUnit/Gui/TestResultsPad.cs
@@ -811,43 +811,43 @@ namespace MonoDevelop.NUnit
}
public void InitializeTestRun (UnitTest test)
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
pad.InitializeTestRun (test);
});
}
public void FinishTestRun ()
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
pad.FinishTestRun ();
});
}
public void Cancel ()
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
pad.Cancel ();
});
}
public void BeginTest (UnitTest test)
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
monitor.BeginTest (test);
});
}
public void EndTest (UnitTest test, UnitTestResult result)
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
monitor.EndTest (test, result);
});
}
public void ReportRuntimeError (string message, Exception exception)
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
monitor.ReportRuntimeError (message, exception);
});
}
public void WriteGlobalLog (string message)
{
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
monitor.WriteGlobalLog (message);
});
}
diff --git a/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs b/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs
index fd11cbfa3f..900d6090e6 100644
--- a/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs
+++ b/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs
@@ -206,7 +206,7 @@ namespace MonoDevelop.NUnit
ld.Path = AssemblyPath;
ld.TestInfoCachePath = cacheLoaded ? null : TestInfoCachePath;
ld.Callback = delegate {
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
AsyncCreateTests (ld);
});
};
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs
index c77ae223e4..091402071e 100644
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs
@@ -36,6 +36,7 @@ using MonoDevelop.Ide.Editor.Extension;
using MonoDevelop.Ide.Editor;
using System.Threading.Tasks;
using System.Threading;
+using MonoDevelop.Core;
namespace MonoDevelop.TextTemplating.Gui
{
@@ -231,7 +232,7 @@ namespace MonoDevelop.TextTemplating.Gui
void RefillOutlineStore ()
{
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
Gdk.Threads.Enter ();
refreshingOutline = false;
if (outlineTreeStore == null || !outlineTreeView.IsRealized)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
index 2866537935..8188e9e607 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
@@ -163,7 +163,7 @@ namespace MonoDevelop.VersionControl.Git
msg = GettextCatalog.GetString ("No changes were available to stash");
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
IdeApp.Workbench.StatusBar.ShowMessage (msg);
});
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs
index c7351a8632..787d96bc0b 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs
@@ -128,14 +128,12 @@ namespace MonoDevelop.VersionControl.Git
state.KeyUsed++;
else {
SelectFileDialog dlg = null;
- bool success = false;
-
- DispatchService.GuiSyncDispatch (() => {
+ bool success = Runtime.RunInMainThread (() => {
dlg = new SelectFileDialog (GettextCatalog.GetString ("Select a private SSH key to use."));
dlg.ShowHidden = true;
dlg.CurrentFolder = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
- success = dlg.Run ();
- });
+ return dlg.Run ();
+ }).Result;
if (!success || !File.Exists (dlg.SelectedFile + ".pub"))
throw new VersionControlException (GettextCatalog.GetString ("Invalid credentials were supplied. Aborting operation."));
@@ -147,10 +145,10 @@ namespace MonoDevelop.VersionControl.Git
};
if (KeyHasPassphrase (dlg.SelectedFile)) {
- DispatchService.GuiSyncDispatch (delegate {
+ result = Runtime.RunInMainThread (delegate {
using (var credDlg = new CredentialsDialog (url, types, cred))
- result = MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
- });
+ return MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
+ }).Result;
}
if (result)
@@ -169,10 +167,10 @@ namespace MonoDevelop.VersionControl.Git
return cred;
}
- DispatchService.GuiSyncDispatch (delegate {
+ result = Runtime.RunInMainThread (delegate {
using (var credDlg = new CredentialsDialog (url, types, cred))
- result = MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
- });
+ return MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
+ }).Result;
if (result) {
if ((types & SupportedCredentialTypes.UsernamePassword) != 0) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
index 6047489ae6..57c430abcb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
@@ -806,7 +806,7 @@ namespace MonoDevelop.VersionControl.Git
static ConflictResult ResolveConflict (string file)
{
ConflictResult res = ConflictResult.Abort;
- DispatchService.GuiSyncDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
var dlg = new ConflictResolutionDialog ();
try {
dlg.Load (file);
@@ -828,7 +828,7 @@ namespace MonoDevelop.VersionControl.Git
dlg.Destroy ();
dlg.Dispose ();
}
- });
+ }).Wait ();
return res;
}
@@ -875,7 +875,7 @@ namespace MonoDevelop.VersionControl.Git
} catch {
string dlgName = null, dlgEmail = null;
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
var dlg = new UserGitConfigDialog ();
try {
if ((Gtk.ResponseType)MessageService.RunCustomDialog (dlg) == Gtk.ResponseType.Ok) {
@@ -887,7 +887,7 @@ namespace MonoDevelop.VersionControl.Git
dlg.Destroy ();
dlg.Dispose ();
}
- });
+ }).Wait ();
name = dlgName;
email = dlgEmail;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
index a52ba0cc28..216603b88b 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
@@ -165,13 +165,13 @@ namespace MonoDevelop.VersionControl.Git
{
if (status == StashApplyStatus.Conflicts) {
string msg = GettextCatalog.GetString ("Stash applied with conflicts");
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
IdeApp.Workbench.StatusBar.ShowWarning (msg);
});
}
else {
string msg = GettextCatalog.GetString ("Stash successfully applied");
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
IdeApp.Workbench.StatusBar.ShowMessage (msg);
});
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.Gui/WorkingCopyFormatDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.Gui/WorkingCopyFormatDialog.cs
index 8fd15737fc..540252ad43 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.Gui/WorkingCopyFormatDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.Gui/WorkingCopyFormatDialog.cs
@@ -61,12 +61,12 @@ namespace MonoDevelop.VersionControl.Subversion.Gui
action();
};
- if (DispatchService.IsGuiThread) {
+ if (Runtime.IsMainThread) {
// Already in GUI thread
del ();
}
else
- DispatchService.GuiDispatch (del);
+ Runtime.RunInMainThread (del);
}
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
index cda778bab9..2109824438 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
@@ -542,7 +542,7 @@ namespace MonoDevelop.VersionControl.Views
LoggingService.LogError ("Error retrieving history", ex);
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
ctx.Dispose ();
UpdateWidth ();
QueueDraw ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
index 4c85bc0729..22090f22be 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
@@ -472,7 +472,7 @@ namespace MonoDevelop.VersionControl.Views
}
List<VersionInfo> newList = new List<VersionInfo> ();
newList.AddRange (vc.GetDirectoryVersionInfo (filepath, remoteStatus, true));
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (!disposed)
LoadStatus (newList);
});
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
index a002693010..885f6da247 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
@@ -87,7 +87,7 @@ namespace MonoDevelop.VersionControl.Views
LoggingService.LogError ("Error retrieving history", ex);
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
OnUpdated (EventArgs.Empty);
});
mre.Set ();
@@ -110,7 +110,7 @@ namespace MonoDevelop.VersionControl.Views
mre.WaitOne ();
mre.Dispose ();
mre = null;
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
act ();
});
});
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
index 3ce46d405f..6481e18997 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
@@ -97,7 +97,7 @@ namespace MonoDevelop.VersionControl
}
if (projectFn != null) {
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
IdeApp.Workspace.OpenWorkspaceItem (projectFn);
});
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
index e7a53efc8d..40be3e49a7 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
@@ -380,7 +380,7 @@ namespace MonoDevelop.VersionControl
internal static void NotifyPrepareCommit (Repository repo, ChangeSet changeSet)
{
- if (!DispatchService.IsGuiThread) {
+ if (!Runtime.IsMainThread) {
Gtk.Application.Invoke (delegate {
NotifyPrepareCommit (repo, changeSet);
});
@@ -398,7 +398,7 @@ namespace MonoDevelop.VersionControl
internal static void NotifyBeforeCommit (Repository repo, ChangeSet changeSet)
{
- if (!DispatchService.IsGuiThread) {
+ if (!Runtime.IsMainThread) {
Gtk.Application.Invoke (delegate {
NotifyBeforeCommit (repo, changeSet);
});
@@ -416,7 +416,7 @@ namespace MonoDevelop.VersionControl
internal static void NotifyAfterCommit (Repository repo, ChangeSet changeSet, bool success)
{
- if (!DispatchService.IsGuiThread) {
+ if (!Runtime.IsMainThread) {
Gtk.Application.Invoke (delegate {
NotifyAfterCommit (repo, changeSet, success);
});
@@ -447,7 +447,7 @@ namespace MonoDevelop.VersionControl
public static void NotifyFileStatusChanged (FileUpdateEventArgs args)
{
- if (!DispatchService.IsGuiThread)
+ if (!Runtime.IsMainThread)
Gtk.Application.Invoke (delegate {
NotifyFileStatusChanged (args);
});
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/StatusBar.xaml.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/StatusBar.xaml.cs
index 263e492eef..dc1fabd45a 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/StatusBar.xaml.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/StatusBar.xaml.cs
@@ -59,7 +59,7 @@ namespace WindowsPlatform.MainToolbar
wc++;
}
- DispatchService.GuiDispatch (delegate {
+ Runtime.RunInMainThread (delegate {
if (ec > 0) {
BuildResultPanelVisibility = Visibility.Visible;
BuildResultCount = ec;
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/WPFToolbar.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/WPFToolbar.cs
index d7872eeda6..28c13f831d 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/WPFToolbar.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/WPFToolbar.cs
@@ -1,5 +1,6 @@
using MonoDevelop.Components.MainToolbar;
using MonoDevelop.Components.Windows;
+using MonoDevelop.Core;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -34,7 +35,7 @@ namespace WindowsPlatform.MainToolbar
if (newModel == null)
return;
- DispatchService.GuiDispatch(() => {
+ Runtime.RunInMainThread(() => {
ActiveConfiguration = newModel;
if (ConfigurationChanged != null)
@@ -48,7 +49,7 @@ namespace WindowsPlatform.MainToolbar
return;
using (var mutableModel = newModel.GetMutableModel()) {
- DispatchService.GuiDispatch(() => {
+ Runtime.RunInMainThread(() => {
ActiveRuntime = newModel;
var ea = new MonoDevelop.Components.MainToolbar.HandledEventArgs();
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs
index 598f796ce0..76970ec8c4 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs
@@ -78,11 +78,11 @@ namespace MonoDevelop.Platform.Windows
{
NetworkCredential result = null;
- DispatchService.GuiSyncDispatch (() => {
+ Runtime.RunInMainThread (() => {
var form = new PlaceholderForm (credentialType, uri, null);
if (GdkWin32.RunModalWin32Form (form, IdeApp.Workbench.RootWindow))
result = new NetworkCredential (form.Username, form.Password, form.Domain);
- });
+ }).Wait ();
// store the obtained credentials in the auth store
// but don't store for the root url since it may have other credentials
diff --git a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
index 48f4bcb6fc..2204f06693 100644
--- a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
+++ b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
@@ -966,7 +966,7 @@ namespace MonoDevelop.Xml.Editor
void refillOutlineStore ()
{
- DispatchService.AssertGuiThread ();
+ Runtime.AssertMainThread ();
Gdk.Threads.Enter ();
refreshingOutline = false;
if (outlineTreeStore == null || !outlineTreeView.IsRealized)