|
|
|
@ -16,17 +16,20 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -16,17 +16,20 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
/// Attemps to close the IDE.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// This method will:
|
|
|
|
|
/// - Check if <see cref="PreventShutdown"/> was called and abort the shutdown if it was.
|
|
|
|
|
/// - Prompt the user to save the open files. The user has the option to cancel the shutdown at that point.
|
|
|
|
|
/// - Closes the solution.
|
|
|
|
|
/// - Signals the <see cref="ShutdownToken"/>.
|
|
|
|
|
/// - Disposes pads
|
|
|
|
|
/// - Wait for background tasks (<see cref="AddBackgroundTask"/>) to finish.
|
|
|
|
|
/// - Disposes services
|
|
|
|
|
/// - Saves the PropertyService
|
|
|
|
|
///
|
|
|
|
|
/// <para>This method:</para>
|
|
|
|
|
/// <list type="items">
|
|
|
|
|
/// <item>Checks if <see cref="PreventShutdown"/> was called and abort the shutdown if it was.</item>
|
|
|
|
|
/// <item>Prompts the user to save the open files. The user has the option to cancel the shutdown at that point.</item>
|
|
|
|
|
/// <item>Closes the solution.</item>
|
|
|
|
|
/// <item>Signals the <see cref="ShutdownToken"/>.</item>
|
|
|
|
|
/// <item>Disposes pads</item>
|
|
|
|
|
/// <item>Waits for background tasks (<see cref="AddBackgroundTask"/>) to finish.</item>
|
|
|
|
|
/// <item>Disposes services</item>
|
|
|
|
|
/// <item>Saves the PropertyService</item>
|
|
|
|
|
/// </list>
|
|
|
|
|
/// <para>
|
|
|
|
|
/// This method must be called on the main thread.
|
|
|
|
|
/// </para>
|
|
|
|
|
/// </remarks>
|
|
|
|
|
bool Shutdown(); |
|
|
|
|
|
|
|
|
@ -34,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -34,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
/// Prevents shutdown with the following reason.
|
|
|
|
|
/// Dispose the returned value to allow shutdown again.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reason">The reason. This parameter will be passed through the StringParser when the reason is displayed to the user.</param>
|
|
|
|
|
/// <param name="reason">The reason, will be displayed to the user.</param>
|
|
|
|
|
/// <exception cref="InvalidOperationException">Shutdown is already in progress</exception>
|
|
|
|
|
/// <remarks>This method is thread-safe.</remarks>
|
|
|
|
|
IDisposable PreventShutdown(string reason); |
|
|
|
@ -42,9 +45,9 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -42,9 +45,9 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the current reason that prevents shutdown.
|
|
|
|
|
/// If there isn't any reason, returns null.
|
|
|
|
|
/// If there are multiple reasons, this returns one of them.
|
|
|
|
|
/// If there are multiple reasons, only one of them is returned.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>This method is thread-safe.</remarks>
|
|
|
|
|
/// <remarks>This property is thread-safe.</remarks>
|
|
|
|
|
string CurrentReasonPreventingShutdown { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -52,6 +55,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -52,6 +55,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
///
|
|
|
|
|
/// This cancellation token may be used to stop background calculations.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>This property is thread-safe.</remarks>
|
|
|
|
|
CancellationToken ShutdownToken { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -61,6 +65,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -61,6 +65,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
/// for a limited time after SharpDevelop is closed (e.g. saving state in caches
|
|
|
|
|
/// - work that should better run even though we're shutting down, but shouldn't take too long either)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>This property is thread-safe.</remarks>
|
|
|
|
|
CancellationToken DelayedShutdownToken { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -69,6 +74,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
@@ -69,6 +74,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
|
|
|
|
|
/// Use this method for tasks that asynchronously write state to disk and should not be
|
|
|
|
|
/// interrupted by SharpDevelop closing down.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>This method is thread-safe.</remarks>
|
|
|
|
|
void AddBackgroundTask(Task task); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|