Browse Source

IShutdownService.PreventShutdown(): display the message as-is (don't pass it through StringParser)

pull/297/head
Daniel Grunwald 12 years ago
parent
commit
f719b07342
  1. 2
      src/Main/Base/Project/Parser/ProjectContentContainer.cs
  2. 32
      src/Main/Base/Project/Workbench/IShutdownService.cs
  3. 2
      src/Main/SharpDevelop/Workbench/WpfWorkbench.cs

2
src/Main/Base/Project/Parser/ProjectContentContainer.cs

@ -205,7 +205,7 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -205,7 +205,7 @@ namespace ICSharpCode.SharpDevelop.Parser
} catch (IOException ex) {
LoggingService.Warn(ex);
// Can happen if two SD instances are trying to access the file at the same time.
// We'll just let one of them win, and instance that got the exception won't write to the cache at all.
// We'll just let one of them win, and the instance that got the exception won't write to the cache at all.
// Similarly, we also ignore the other kinds of IO exceptions.
} catch (UnauthorizedAccessException ex) {
LoggingService.Warn(ex);

32
src/Main/Base/Project/Workbench/IShutdownService.cs

@ -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);
}
}

2
src/Main/SharpDevelop/Workbench/WpfWorkbench.cs

@ -579,7 +579,7 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -579,7 +579,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
var shutdownService = (ShutdownService)SD.ShutdownService;
if (shutdownService.CurrentReasonPreventingShutdown != null) {
MessageService.ShowMessage(StringParser.Parse(shutdownService.CurrentReasonPreventingShutdown));
MessageService.ShowMessage(shutdownService.CurrentReasonPreventingShutdown);
e.Cancel = true;
return;
}

Loading…
Cancel
Save