Browse Source

Avoid ArgumentNullException(Help3Service.ActiveCatalog) when pressing F1 on machine without Windows SDK 7.1 installed.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6346 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
c28b2cd09d
  1. 11
      src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs
  2. 3
      src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs

11
src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs

@ -54,21 +54,22 @@ namespace MSHelpSystem.Core
DisplayLocalHelp(helpPageUrl); DisplayLocalHelp(helpPageUrl);
} }
public static void ContextualHelp(string contextual) public static bool ContextualHelp(string contextual)
{ {
if (string.IsNullOrEmpty(contextual)) { if (string.IsNullOrEmpty(contextual)) {
throw new ArgumentNullException("contextual"); throw new ArgumentNullException("contextual");
} }
if (!Help3Environment.IsLocalHelp) { if (!Help3Environment.IsLocalHelp) {
DisplayHelpOnMSDN(contextual); DisplayHelpOnMSDN(contextual);
return; return true;
} }
if (Help3Service.ActiveCatalog == null) { if (Help3Service.ActiveCatalog == null) {
throw new ArgumentNullException("Help3Service.ActiveCatalog"); return false;
} }
string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual); string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpContextualUrl)); LoggingService.Debug(string.Format("Help 3.0: {0}", helpContextualUrl));
DisplayLocalHelp(helpContextualUrl); DisplayLocalHelp(helpContextualUrl);
return true;
} }
public static void Search(string searchWords) public static void Search(string searchWords)
@ -136,7 +137,7 @@ namespace MSHelpSystem.Core
LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", helpUrl)); LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", helpUrl));
browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl)); browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl));
browser.WorkbenchWindow.SelectWindow(); browser.WorkbenchWindow.SelectWindow();
} }
} }
static void DisplayHelpWithShellExecute(string arguments) static void DisplayHelpWithShellExecute(string arguments)
@ -206,6 +207,6 @@ namespace MSHelpSystem.Core
BrowserPane tmp = new BrowserPane(); BrowserPane tmp = new BrowserPane();
WorkbenchSingleton.Workbench.ShowView(tmp); WorkbenchSingleton.Workbench.ShowView(tmp);
return tmp; return tmp;
} }
} }
} }

3
src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs

@ -13,8 +13,7 @@ namespace MSHelpSystem
throw new ArgumentNullException("fullTypeName"); throw new ArgumentNullException("fullTypeName");
} }
LoggingService.Info(string.Format("Help 3.0: Calling \"TryShowHelp\" with {0}", fullTypeName)); LoggingService.Info(string.Format("Help 3.0: Calling \"TryShowHelp\" with {0}", fullTypeName));
DisplayHelp.ContextualHelp(fullTypeName); return DisplayHelp.ContextualHelp(fullTypeName);
return true;
} }
public override bool TryShowHelpByKeyword(string keyword) public override bool TryShowHelpByKeyword(string keyword)

Loading…
Cancel
Save