/// <summary> /// Initiates a search, with a search string. /// </summary> /// <param name="search">The search string.</param> public void Search(string search) { if (this.searchingContentPresenter != null) { this.searchingContentPresenter.Visibility = Visibility.Collapsed; } if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Collapsed; } if (this.searchErrorContentPresenter != null) { this.searchErrorContentPresenter.Visibility = Visibility.Collapsed; } if (this.noSearchContentPresenter != null) { this.noSearchContentPresenter.Visibility = Visibility.Collapsed; } this.ItemsSource = null; if (!string.IsNullOrEmpty(this.AppId) && !string.IsNullOrEmpty(search)) { if (this.searchingContentPresenter != null) { this.searchingContentPresenter.Visibility = Visibility.Visible; } this.lastSearch = search; LiveSearchPortTypeClient client = new LiveSearchPortTypeClient(new BasicHttpBinding(), new EndpointAddress(this.EndpointAddress)); client.SearchCompleted += new EventHandler <SearchCompletedEventArgs>(this.Client_SearchCompleted); SearchRequest request = new SearchRequest(); request.AppId = this.AppId; request.Query = search; request.Sources = new SourceType[] { this.LiveSearchType }; request.Version = "2.0"; this.SetPageRequest(ref request); client.SearchAsync(request); } else if (string.IsNullOrEmpty(search)) { if (this.noSearchContentPresenter != null) { this.noSearchContentPresenter.Visibility = Visibility.Visible; } } }
/// <summary> /// Initiates a search, with a search string. /// </summary> /// <param name="search">The search string.</param> public void Search(string search) { if (this.searchingContentPresenter != null) { this.searchingContentPresenter.Visibility = Visibility.Collapsed; } if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Collapsed; } if (this.searchErrorContentPresenter != null) { this.searchErrorContentPresenter.Visibility = Visibility.Collapsed; } if (this.noSearchContentPresenter != null) { this.noSearchContentPresenter.Visibility = Visibility.Collapsed; } this.ItemsSource = null; if (!string.IsNullOrEmpty(this.AppId) && !string.IsNullOrEmpty(search)) { if (this.searchingContentPresenter != null) { this.searchingContentPresenter.Visibility = Visibility.Visible; } this.lastSearch = search; LiveSearchPortTypeClient client = new LiveSearchPortTypeClient(new BasicHttpBinding(), new EndpointAddress(this.EndpointAddress)); client.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(this.Client_SearchCompleted); SearchRequest request = new SearchRequest(); request.AppId = this.AppId; request.Query = search; request.Sources = new SourceType[] { this.LiveSearchType }; request.Version = "2.0"; this.SetPageRequest(ref request); client.SearchAsync(request); } else if (string.IsNullOrEmpty(search)) { if (this.noSearchContentPresenter != null) { this.noSearchContentPresenter.Visibility = Visibility.Visible; } } }