Browse Source

removed a few more ArgumentNullExceptions

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6359 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Mathias Simmack 16 years ago
parent
commit
1599809fde
  1. 11
      src/AddIns/Misc/HelpViewer/Source/Controls/SearchPadControl.xaml.cs
  2. 38
      src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs

11
src/AddIns/Misc/HelpViewer/Source/Controls/SearchPadControl.xaml.cs

@ -34,13 +34,12 @@ namespace MSHelpSystem.Controls @@ -34,13 +34,12 @@ namespace MSHelpSystem.Controls
void DoSearchClicked(object sender, RoutedEventArgs e)
{
string term = searchCB.Text;
if (string.IsNullOrEmpty(term)) {
throw new ArgumentNullException("term");
if (!string.IsNullOrEmpty(term)) {
searchCB.Text = "";
if (searchTerms.IndexOf(term) < 0) searchTerms.Insert(0,term);
else searchTerms.Move(searchTerms.IndexOf(term), 0);
DisplayHelp.Search(term);
}
searchCB.Text = "";
if (searchTerms.IndexOf(term) < 0) searchTerms.Insert(0,term);
else searchTerms.Move(searchTerms.IndexOf(term), 0);
DisplayHelp.Search(term);
}
}
}

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

@ -17,53 +17,55 @@ namespace MSHelpSystem.Core @@ -17,53 +17,55 @@ namespace MSHelpSystem.Core
{
}
public static void Catalog()
public static bool Catalog()
{
if (!Help3Environment.IsLocalHelp) {
MessageBox.Show(StringParser.Parse("${res:AddIns.HelpViewer.OfflineFeatureRequestMsg}"),
StringParser.Parse("${res:AddIns.HelpViewer.MicrosoftHelpViewerTitle}"),
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
return false;
}
if (Help3Service.ActiveCatalog == null) {
throw new ArgumentNullException("Help3Service.ActiveCatalog");
return false;
}
string helpCatalogUrl = string.Format(@"ms-xhelp://?method=page&id=-1&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpCatalogUrl));
DisplayLocalHelp(helpCatalogUrl);
return true;
}
public static void Page(string pageId)
public static bool Page(string pageId)
{
if (string.IsNullOrEmpty(pageId)) {
throw new ArgumentNullException("pageId");
return false;
}
if (!Help3Environment.IsLocalHelp) {
MessageBox.Show(StringParser.Parse("${res:AddIns.HelpViewer.OfflineFeatureRequestMsg}"),
StringParser.Parse("${res:AddIns.HelpViewer.MicrosoftHelpViewerTitle}"),
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
return false;
}
if (Help3Service.ActiveCatalog == null) {
throw new ArgumentNullException("Help3Service.ActiveCatalog");
return false;
}
string helpPageUrl = string.Format(@"ms-xhelp://?method=page&id={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, pageId);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpPageUrl));
DisplayLocalHelp(helpPageUrl);
return true;
}
public static bool ContextualHelp(string contextual)
{
if (string.IsNullOrEmpty(contextual)) {
throw new ArgumentNullException("contextual");
return false;
}
if (!Help3Environment.IsLocalHelp) {
DisplayHelpOnMSDN(contextual);
return true;
}
if (Help3Service.ActiveCatalog == null) {
if (Help3Service.ActiveCatalog == null) {
return false;
}
string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual);
@ -72,41 +74,43 @@ namespace MSHelpSystem.Core @@ -72,41 +74,43 @@ namespace MSHelpSystem.Core
return true;
}
public static void Search(string searchWords)
public static bool Search(string searchWords)
{
if (string.IsNullOrEmpty(searchWords)) {
throw new ArgumentNullException("searchWords");
return false;
}
if (!Help3Environment.IsLocalHelp) {
DisplaySearchOnMSDN(searchWords);
return;
return true;
}
if (Help3Service.ActiveCatalog == null) {
throw new ArgumentNullException("Help3Service.ActiveCatalog");
return false;
}
string helpSearchUrl = string.Format(@"ms-xhelp://?method=search&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, searchWords.Replace(" ", "+"));
LoggingService.Debug(string.Format("Help 3.0: {0}", helpSearchUrl));
DisplayLocalHelp(helpSearchUrl);
return true;
}
public static void Keywords(string keywords)
public static bool Keywords(string keywords)
{
if (string.IsNullOrEmpty(keywords)) {
throw new ArgumentNullException("keywords");
return false;
}
if (!Help3Environment.IsLocalHelp) {
MessageBox.Show(StringParser.Parse("${res:AddIns.HelpViewer.OfflineFeatureRequestMsg}"),
StringParser.Parse("${res:AddIns.HelpViewer.MicrosoftHelpViewerTitle}"),
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
return false;
}
if (Help3Service.ActiveCatalog == null) {
throw new ArgumentNullException("Help3Service.ActiveCatalog");
return false;
}
string helpKeywordsUrl = string.Format(@"ms-xhelp://?method=keywords&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, keywords.Replace(" ", "+"));
LoggingService.Debug(string.Format("Help 3.0: {0}", helpKeywordsUrl));
DisplayLocalHelp(helpKeywordsUrl);
return true;
}

Loading…
Cancel
Save