void client_SearchCompleted(object sender, SearchCompletedEventArgs e) { if (e.Cancelled) { return; } flowLayoutPanel1.Controls.Clear(); if (e.Error != null) { TextBox txtError = new TextBox(); txtError.Multiline = true; txtError.Dock = DockStyle.Fill; txtError.Text = e.Error.ToString(); flowLayoutPanel1.Controls.Add(txtError); } var response = e.Result; if (response.Image != null && response.Image.Results.Count() > 0) { foreach (var imageUrl in response.Image.Results.Select(ir => ir.MediaUrl)) { WebClient client = new WebClient(); client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync(new Uri(imageUrl)); } } }
private void OnSearchCompleted(object sender, SearchCompletedEventArgs e) { if (e.Error != null) { throw e.Error; } SearchResults = e.Result; OnPropertyChanged("SearchResults"); }
void bing_SearchCompleted(object sender, SearchCompletedEventArgs e) { if (e.Result.Web.Results != null) { foreach (WebResult wr in e.Result.Web.Results) { results.Add(wr); } } }
/// <summary>Sets the UI when the search for updates has completed.</summary> /// <param name="sender">The object that called the event.</param> /// <param name="e">The <c>SevenUpdate.SearchCompletedEventArgs</c> instance containing the event data.</param> void SearchCompleted(object sender, SearchCompletedEventArgs e) { if (!this.Dispatcher.CheckAccess()) { this.Dispatcher.BeginInvoke(this.SearchCompleted, e); } else { this.SearchCompleted(e); } }
private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs args) { this.itemCollection.Clear(); SearchResultCollection results = args.Response.ResultSets.First().Results; if (results.Count > 0) { foreach (SearchResultBase result in results) { MapItem item = new MapItem() { Title = result.Name, Location = result.LocationData.Locations[0] }; this.itemCollection.Add(item); } this.radMap.SetView(args.Response.ResultSets[0].SearchRegion.GeocodeLocation.BestView); } this.itemCollection.Clear(); SearchResponse response = args.Response; if (response != null) { if (response.Error == null) { if (response.ResultSets.Count > 0) { this.AddResultsToItemsCollection(response); if (response.ResultSets[0].SearchRegion != null) { // Set map viewport to the best view returned in the search result. this.SetBestView(response); // Show map shape around bounding area this.ShowBoundingArea(response); this.SearchRegionToItemsCollection(response); } } } else { // Show error info. MessageBox.Show( response.Error.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void OnSearchCompleted(object sender, SearchCompletedEventArgs e) { if (viewModel.Groups == null) { listView.ItemsSource = new string [1]; } else { listView.ItemsSource = viewModel.Groups; } }
private void Search_IterationCompleted(object sender, SearchCompletedEventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append($"Ply: {e.Ply}\t"); sb.Append($"Val: {e.Score}\t"); foreach (Move move in e.PrincipalVariation) { sb.Append(" "); sb.Append(move); } Invoke(new UpdatePvDelegate(AddPv), sb.ToString()); }
private void doneSearching(object sender, SearchCompletedEventArgs e) { if (e.Result.Errors != null) { SearchLoading.Text = "Error fetching data..."; return; } miniMap.Children.Clear(); if (e.Result.Phonebook == null) { SearchLoading.Text = "No results nearby..."; return; } ObservableCollection <StationItemViewModel> resultsModel = new ObservableCollection <StationItemViewModel>(); PhonebookResult[] r = e.Result.Phonebook.Results; SolidColorBrush pinBrush = new SolidColorBrush(Color.FromArgb(255, 85, 44, 105)); // Add the pushpins for (int i = 0; i < r.Length; i++) { Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate(r[i].Latitude, r[i].Longitude); pin.Background = pinBrush; pin.Content = i + 1; pin.Height = 60; pin.Width = 30; miniMap.Children.Add(pin); // Add it to our results model StationItemViewModel station = new StationItemViewModel(); station.Title = r[i].Title; station.Address = r[i].Address + ", " + r[i].City + ", " + r[i].StateOrProvince; station.PhoneNumber = r[i].PhoneNumber; station.ItemNumber = i + 1; station.Coordinates = pin.Location; station.Distance = distanceApart(_currentLocation, pin.Location).ToString(); resultsModel.Add(station); } SearchResults.ItemsSource = resultsModel; SearchLoading.Visibility = Visibility.Collapsed; SearchResults.Visibility = Visibility.Visible; }
void HandleSearchCompleted(object sender, SearchCompletedEventArgs e) { // Only update the UI if these are the results for the last search if (e.SearchText == lastSearchText && e.SearchProperty == lastSearchProperty) { activity.Value.Stop(); if (lastTableView != null) { var data = (PeopleGroupsDataSource)lastTableView.DataSource; data.Groups = searchViewModel.Groups; lastTableView.ReloadData(); } } }
void flickrClient_SearchCompleted(object sender, SearchCompletedEventArgs e) { try { for (int x = 0; x < e.Results.Count; x++) { int cx = x; Pictures.Dispatcher.BeginInvoke(() => { Canvas c = new Canvas(); c.Width = 580; c.Height = 580; PanelFrame img = new PanelFrame(); img.Image.Source = new BitmapImage(e.Results[cx].ImageUri); img.ImageUrl = e.Results[cx].ImageUri.ToString(); img.Image.ImageOpened += delegate(object s, RoutedEventArgs args) { BitmapImage bi = img.Image.Source as BitmapImage; c.Dispatcher.BeginInvoke(() => { //c.Width = bi.PixelWidth * (580D / bi.PixelHeight); //img.Width = c.Width; //img.Image.Width = c.Width; }); }; c.Children.Add(img); c.SetValue(MIRIA.UIKit.ScrollView.HookableProperty, true); c.Tag = img.ImageUrl; if (Pictures.Children.Count > 21) Pictures2.Children.Add(c); else Pictures.Children.Add(c); }); // _resultssofar++; if (_resultssofar == _resultstoget) break; } } catch (Exception ex) { } if (_resultssofar < _resultstoget) { _flickrsearch.Page++; _flickrclient.SearchAsync(_flickrsearch); } }
/// <summary>Runs when the search for updates has completed for an auto update.</summary> /// <param name="sender">The object that called the event.</param> /// <param name="e">The <c>SearchCompletedEventArgs</c> instance containing the event data.</param> static void SearchCompleted(object sender, SearchCompletedEventArgs e) { IsInstalling = false; Applications = e.Applications as Collection <Sui>; if (Applications == null) { return; } if (Applications.Count > 0) { if (Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate.sui" || Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate-dev.sui") { Sui sevenUpdate = Applications[0]; Applications.Clear(); Applications.Add(sevenUpdate); e.OptionalCount = 0; e.ImportantCount = 1; } Utilities.Serialize(Applications, Path.Combine(AllUserStore, "updates.sui")); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(AllUserStore, "updates.sui") + "\" /c /e /g Users:F"); if (Settings.AutoOption == AutoUpdateOption.Notify) { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.SearchComplete); } else { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.DownloadStarted); Download.DownloadUpdates(Applications, "SevenUpdate", Path.Combine(AllUserStore, "downloads")); // Task.Factory.StartNew(() => Download.DownloadUpdates(Applications, "SevenUpdate", // Path.Combine(AllUserStore, "downloads"))); IsInstalling = true; } } else { ShutdownApp(); } }
private void SearchCompleted(object sender, SearchCompletedEventArgs e) { ClientManager.RequestCount--; if (null == e.Error) { _data.Clear(); foreach (var track in e.Result) { _data.Add(track); } refreshPanel.IsRefreshing = false; } else { Debug.WriteLine("Search failed"); NavigationService.GoBack(); } }
private void ShowResults(SearchCompletedEventArgs e) { if (e.Error == null) { lstResult.Height = 400; lstResult.Items.Clear(); spResult.Visibility = Visibility.Visible; SearchResultSet searchResultSet = e.Result; foreach (SearchResult sr in searchResultSet.SearchResults.Values) { lstResult.Items.Add(new ResultView(sr)); } tbStatus.Text = string.Format("Total {0} archivos encontrados ({1} segundos)", searchResultSet.SearchResults.Count, searchResultSet.SearchSeconds); } else { tbStatus.Text = string.Format("Ocurrió un error inesperado: {0}", e.Error.Message); } }
/// <summary>Search completed</summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> void SearchCompleted(object sender, SearchCompletedEventArgs e) { if (this.InvokeRequired) { this.Invoke(new SearchThreadCompletedDelegate(SearchCompleted), new Object[] { sender, e }); // invoke this method using our UI thread delegate } else { if (e.SeatOpened) { this.DialogResult = DialogResult.OK; this.Close(); } else { this.DialogResult = DialogResult.Cancel; this.Close(); } } }
/// <summary> /// The search completed. Either successfully, cancelled by the user, or due to an exception /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void searchResults_SearchCompleted(object sender, SearchCompletedEventArgs e) { //remove the filematching eventhandler if specified, see buttStartSearch_Click searchResults.SearchFileMatches -= FileMatchEventHandler; buttStopSearch.Enabled = false; buttStartSearch.Enabled = true; //reset the progress indicator SearchProgressBar.Visible = false; SearchProgressBar.Value = 0; //the search was cancelled by the user if (e.Cancelled) { toolStripStatusLabel1.Text = "The search operation was cancelled by the user."; return; } else { toolStripStatusLabel1.Text = string.Empty; } m_searchCompleted = true; //an error/exception occurred during the search, inform the user if (e.Error != null) { string errString = "An Error occurred: " + e.Error.Message; MessageBox.Show(errString, "Search error", MessageBoxButtons.OK, MessageBoxIcon.Information); toolStripStatusLabel1.Text = errString; } //all went ok, the search is complete else { toolStripStatusSizeAndCount.Text = "Found " + searchResults.Items.Count + " objects. "; } searchResults.AutomaticRefresh = true; }
private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs e) { this.visualizationLayer.Clear(); double[] bbox = e.Locations[0].BBox; var location = e.Locations[0]; Telerik.WinControls.UI.Map.PointG point = new Telerik.WinControls.UI.Map.PointG(location.Point.Coordinates[0], location.Point.Coordinates[1]); MapPin pin = new MapPin(point); pin.Size = new System.Drawing.Size(20, 40); pin.BackColor = System.Drawing.Color.Red; pin.ToolTipText = location.Address.FormattedAddress; this.map.MapElement.Layers[0].Add(pin); var zoomPoint = new Telerik.WinControls.UI.Map.PointG(e.Locations[0].Point.Coordinates[0], e.Locations[0].Point.Coordinates[1]); if (this.map.Visible) { this.map.Zoom(9, true); this.map.BringIntoView(zoomPoint); } }
private void Search_SearchCompleted(object sender, SearchCompletedEventArgs e) { Invoke(new SearchDoneDelegate(SearchComplete)); }
/// <summary>Runs when the search for updates has completed for an auto update.</summary> /// <param name="sender">The object that called the event.</param> /// <param name="e">The <c>SearchCompletedEventArgs</c> instance containing the event data.</param> static void SearchCompleted(object sender, SearchCompletedEventArgs e) { IsInstalling = false; Applications = e.Applications as Collection<Sui>; if (Applications == null) { return; } if (Applications.Count > 0) { if (Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate.sui" || Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate-dev.sui") { Sui sevenUpdate = Applications[0]; Applications.Clear(); Applications.Add(sevenUpdate); e.OptionalCount = 0; e.ImportantCount = 1; } Utilities.Serialize(Applications, Path.Combine(AllUserStore, "updates.sui")); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(AllUserStore, "updates.sui") + "\" /c /e /g Users:F"); if (Settings.AutoOption == AutoUpdateOption.Notify) { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.SearchComplete); } else { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.DownloadStarted); Download.DownloadUpdates(Applications, "SevenUpdate", Path.Combine(AllUserStore, "downloads")); // Task.Factory.StartNew(() => Download.DownloadUpdates(Applications, "SevenUpdate", // Path.Combine(AllUserStore, "downloads"))); IsInstalling = true; } } else { ShutdownApp(); } }
/// <summary>Updates the UI the search for updates has completed.</summary> /// <param name="e">The SearchComplete data.</param> void SearchCompleted(SearchCompletedEventArgs e) { if (Core.Instance.UpdateAction == UpdateAction.ErrorOccurred) { return; } Core.Applications = e.Applications as Collection <Sui>; if (Core.Applications == null) { Core.Instance.UpdateAction = UpdateAction.NoUpdates; return; } if (Core.Applications.Count > 0) { if (Core.Settings.IncludeRecommended) { e.ImportantCount += e.RecommendedCount; } else { e.OptionalCount += e.RecommendedCount; } string suiUrl = null; if (App.IsDev) { suiUrl = Core.SevenUpdateUrl + @"-dev.sui"; } if (App.IsBeta) { suiUrl = Core.SevenUpdateUrl + @"-beta.sui"; } if (!App.IsDev && !App.IsBeta) { suiUrl = Core.SevenUpdateUrl + @".sui"; } if (Core.Applications[0].AppInfo.SuiUrl == suiUrl) { Sui sevenUpdate = Core.Applications[0]; Core.Applications.Clear(); Core.Applications.Add(sevenUpdate); e.OptionalCount = 0; e.ImportantCount = 1; } try { Utilities.Serialize(Core.Applications, Path.Combine(App.AllUserStore, "updates.sui")); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(App.AllUserStore, "updates.sui") + "\" /c /e /g Users:F"); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(App.AllUserStore, "updates.sui") + "\" /c /e /r " + Environment.UserName); } catch (Exception ex) { if (!(ex is UnauthorizedAccessException || ex is IOException)) { Utilities.ReportError(ex, ErrorType.GeneralError); throw; } } if (e.ImportantCount > 0 || e.OptionalCount > 0) { string uiString; Core.Instance.UpdateAction = UpdateAction.UpdatesFound; if (e.ImportantCount > 0 && e.OptionalCount > 0) { this.line.Y1 = 50; } if (e.ImportantCount > 0) { uiString = e.ImportantCount == 1 ? Properties.Resources.ImportantUpdateAvailable : Properties.Resources.ImportantUpdatesAvailable; this.tbViewImportantUpdates.Text = string.Format( CultureInfo.CurrentCulture, uiString, e.ImportantCount); this.tbViewImportantUpdates.Visibility = Visibility.Visible; } else { this.tbViewImportantUpdates.Visibility = Visibility.Collapsed; } if (e.OptionalCount > 0) { if (e.ImportantCount == 0) { this.tbHeading.Text = Properties.Resources.NoImportantUpdates; } uiString = e.OptionalCount == 1 ? Properties.Resources.OptionalUpdateAvailable : Properties.Resources.OptionalUpdatesAvailable; this.tbViewOptionalUpdates.Text = string.Format( CultureInfo.CurrentCulture, uiString, e.OptionalCount); this.tbViewOptionalUpdates.Visibility = Visibility.Visible; } else { this.tbViewOptionalUpdates.Visibility = Visibility.Collapsed; } } } else { Core.Instance.UpdateAction = UpdateAction.NoUpdates; } }
private void searchProvider_SearchCompleted(object sender, SearchCompletedEventArgs e) { this.informationLayer.Items.Clear(); SearchResultCollection results = e.Response.ResultSets.First().Results; if (results.Count > 0) { foreach (SearchResultBase result in results) { MapItem item = new MapItem(); item.Caption = result.Name; item.Location = result.LocationData.Locations.First(); item.BaseZoomLevel = 9; item.ZoomRange = new ZoomRange(5, 12); this.informationLayer.Items.Add(item); } } else { SearchRegion region = e.Response.ResultSets.First().SearchRegion; if (region != null) { this.radMap.SetView(region.GeocodeLocation.BestView); if (region.GeocodeLocation.Address != null && region.GeocodeLocation.Locations.Count > 0) { foreach (Location location in region.GeocodeLocation.Locations) { MapItem item = new MapItem(); item.Caption = region.GeocodeLocation.Address.FormattedAddress; item.Location = location; item.BaseZoomLevel = 5; item.ZoomRange = new ZoomRange(5, 12); this.informationLayer.Items.Add(item); } } } } SearchRegionCollection alternateRegions = e.Response.ResultSets.First().AlternateSearchRegions; if (alternateRegions.Count > 0) { foreach (SearchRegion region in alternateRegions) { if (region.GeocodeLocation.Address != null && region.GeocodeLocation.Locations.Count > 0) { foreach (Location location in region.GeocodeLocation.Locations) { MapItem item = new MapItem(); item.Caption = region.GeocodeLocation.Address.FormattedAddress; item.Location = location; item.BaseZoomLevel = 5; item.ZoomRange = new ZoomRange(5, 12); this.SuggestionsListBox.Items.Add(item); } } } } }
void _service_SearchCompleted(object sender, SearchCompletedEventArgs e) { ((JobsView)elementHost1.Child).SetJobs(e.JobSearchResults); }
void WebSearchCompleted(object sender, SearchCompletedEventArgs e) { progressBing.IsIndeterminate = false; progressBing.Visibility = Visibility.Collapsed; searchPivot.SelectedIndex = 1; SearchResponse response = e.Result; ImageResponse imageResponse = e.Result.Image; SearchResultList searchResult = new SearchResultList(); if (response.Web.Results.Count() > 0) { foreach (WebResult result in response.Web.Results) { searchResult.Add(new SearchResult { Title = result.Title, URL = result.Url, Description = result.Description }); } } webSearchResult.ItemsSource = searchResult; imagesSearchResult.Items.Clear(); foreach (ImageResult bingImage in response.Image.Results) { Image image = new Image(); image.Source = new BitmapImage(new Uri(bingImage.Thumbnail.Url)); image.Width = bingImage.Thumbnail.Width; image.Height = bingImage.Thumbnail.Height; imagesSearchResult.Items.Add(image); } }
private void Searcher_SearchCompleted(object sender, SearchCompletedEventArgs e) { mainFormView.SearchCompleted(e.IsCanceled); programStatus = ProgramStatus.ReadyToSearch; }
private void OnSearchCompleted(object sender, SearchCompletedEventArgs e) { if (e.Error != null) throw e.Error; SearchResults = e.Result; OnPropertyChanged("SearchResults"); }
void searchProvider_SearchCompleted(object sender, SearchCompletedEventArgs e) { SearchResponse response = e.Response; RadAniMap.Items.Clear(); if (response != null && response.ResultSets.Count > 0) { if (response.ResultSets[0].Results.Count > 0) { Entities.AdresList1=new ObservableCollection<Adres>(); foreach (SearchResultBase result in response.ResultSets[0].Results) { Adres item=new Adres() { ADR_ADRES=result.Name, ADR_LOCATION=result.LocationData.Locations[0] }; Entities.AdresList1.Add(item); } for (int i = 0; i < response.ResultSets[0].Results.Count; i++) { SearchResultBase result = response.ResultSets[0].Results[0]; Adres item = new Adres() { ADR_ADRES = result.Name, ADR_LOCATION = result.LocationData.Locations[0] }; Entities.AdresList1.Add(item); } } if (response.ResultSets[0].SearchRegion != null && response.ResultSets[0].SearchRegion.GeocodeLocation != null) { // Set map viewport to the best view returned in the search result. this.RadAniMap.SetView(response.ResultSets[0].SearchRegion.GeocodeLocation.BestView); // Show map shape around bounding area if (response.ResultSets[0].SearchRegion.BoundingArea != null) { MapShape boundingArea = response.ResultSets[0].SearchRegion.BoundingArea; boundingArea.Stroke = new SolidColorBrush(Colors.Red); boundingArea.StrokeThickness = 1; layerKare.Items.Add(boundingArea); } if (response.ResultSets[0].SearchRegion.GeocodeLocation.Address != null && response.ResultSets[0].SearchRegion.GeocodeLocation.Locations.Count > 0) { Entities.AdresList1 = new ObservableCollection<Adres>(); foreach (Location location in response.ResultSets[0].SearchRegion.GeocodeLocation.Locations) { Adres item = new Adres() { ADR_ADRES=response.ResultSets[0].SearchRegion.GeocodeLocation.Address.FormattedAddress, ADR_LOCATION=location, }; layerKare.Items.Add(location); Entities.AdresList1.Add(item); } RadAniMap.Items.Add(layerKare); } } } }
private void Client_SearchCompleted(object sender, SearchCompletedEventArgs e) { SearchRequestCompletedEventArgs args = null; try { if (e.Result.ResponseSummary.StatusCode == SearchService.ResponseStatusCode.Success) { IDictionary<string, SearchResultBase> searchResults = new Dictionary<string, SearchResultBase>(); IList<Location> locations = new List<Location>(); MapItemsControl searchResultMapLayer = CreateMapItemsControl(); if ((e.Result != null) && (e.Result.ResultSets.Count > 0)) { foreach (SearchResultBase result in e.Result.ResultSets[0].Results) { searchResults.Add(result.Id, result); if (result.LocationData.Locations.Count > 0) { Location location = new Location(result.LocationData.Locations[0]); Pushpin pin = CreatePushPin(result.Id, location); ToolTipService.SetToolTip(pin, result.Name); searchResultMapLayer.Items.Add(pin); } } args = new SearchRequestCompletedEventArgs(); args.SearchResults = searchResults; args.SearchResultLayer = searchResultMapLayer; args.Locations = locations; args.BindingArea = e.Result.ResultSets[0].SearchRegion.BoundingArea as LocationRect; } } } catch (Exception) { } OnSearchRequestCompleted(args); }
/// <summary> /// Displays the search results. /// </summary> /// <param name="sender">The search client.</param> /// <param name="e">Search Completed Event Args.</param> private void Client_SearchCompleted(object sender, SearchCompletedEventArgs e) { if (this.searchingContentPresenter != null) { this.searchingContentPresenter.Visibility = Visibility.Collapsed; } if (e.Error == null && e.Result != null) { switch (this.LiveSearchType) { case SourceType.Image: if (e.Result.Image != null) { this.ItemsSource = e.Result.Image.Results; if (e.Result.Image.Results == null && this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.InstantAnswer: if (e.Result.InstantAnswer != null) { this.ItemsSource = e.Result.InstantAnswer.Results; } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.News: if (e.Result.News != null) { this.ItemsSource = e.Result.News.Results; } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.Phonebook: if (e.Result.Phonebook != null) { this.ItemsSource = e.Result.Phonebook.Results; } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.RelatedSearch: if (e.Result.RelatedSearch != null) { this.ItemsSource = e.Result.RelatedSearch.Results; } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.Spell: if (e.Result.Spell != null) { this.ItemsSource = e.Result.Spell.Results; } else if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } break; case SourceType.Web: if (e.Result.Web != null) { this.ItemsSource = e.Result.Web.Results; if (e.Result.Web.Results == null && this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } } break; } } else { if (e.Error != null) { StringBuilder errorMessage = new StringBuilder(); errorMessage.AppendLine("An error occured:"); errorMessage.AppendLine(" " + e.Error.Message); errorMessage.AppendLine(" " + e.Error.StackTrace); this.SearchErrorContent = errorMessage.ToString(); if (this.searchErrorContentPresenter != null) { this.searchErrorContentPresenter.Visibility = Visibility.Visible; } } else { if (this.noResultsContentPresenter != null) { this.noResultsContentPresenter.Visibility = Visibility.Visible; } } } }
private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs args) { SearchResponse response = args.Response; if (response != null && response.ResultSets.Count > 0) { if (response.ResultSets[0].Results.Count > 0) { this.itemCollection.Clear(); foreach (SearchResultBase result in response.ResultSets[0].Results) { MyMapItem item = new MyMapItem() { Title = result.Name, Location = result.LocationData.Locations[0] }; this.itemCollection.Add(item); } } if (response.ResultSets[0].SearchRegion != null) { // Set map viewport to the best view returned in the search result. this.RadMap1.SetView(response.ResultSets[0].SearchRegion.GeocodeLocation.BestView); this.RadMap1.ZoomLevel = 15; if (response.ResultSets[0].SearchRegion.GeocodeLocation.Address != null && response.ResultSets[0].SearchRegion.GeocodeLocation.Locations.Count > 0) { foreach (Location location in response.ResultSets[0].SearchRegion.GeocodeLocation.Locations) { MyMapItem item = new MyMapItem() { Title = response.ResultSets[0].SearchRegion.GeocodeLocation.Address.FormattedAddress, Location = location }; this.itemCollection.Add(item); } } } } }
/// <summary>Updates the UI the search for updates has completed.</summary> /// <param name="e">The SearchComplete data.</param> void SearchCompleted(SearchCompletedEventArgs e) { if (Core.Instance.UpdateAction == UpdateAction.ErrorOccurred) { return; } Core.Applications = e.Applications as Collection<Sui>; if (Core.Applications == null) { Core.Instance.UpdateAction = UpdateAction.NoUpdates; return; } if (Core.Applications.Count > 0) { if (Core.Settings.IncludeRecommended) { e.ImportantCount += e.RecommendedCount; } else { e.OptionalCount += e.RecommendedCount; } string suiUrl = null; if (App.IsDev) { suiUrl = Core.SevenUpdateUrl + @"-dev.sui"; } if (App.IsBeta) { suiUrl = Core.SevenUpdateUrl + @"-beta.sui"; } if (!App.IsDev && !App.IsBeta) { suiUrl = Core.SevenUpdateUrl + @".sui"; } if (Core.Applications[0].AppInfo.SuiUrl == suiUrl) { Sui sevenUpdate = Core.Applications[0]; Core.Applications.Clear(); Core.Applications.Add(sevenUpdate); e.OptionalCount = 0; e.ImportantCount = 1; } try { Utilities.Serialize(Core.Applications, Path.Combine(App.AllUserStore, "updates.sui")); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(App.AllUserStore, "updates.sui") + "\" /c /e /g Users:F"); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(App.AllUserStore, "updates.sui") + "\" /c /e /r " + Environment.UserName); } catch (Exception ex) { if (!(ex is UnauthorizedAccessException || ex is IOException)) { Utilities.ReportError(ex, ErrorType.GeneralError); throw; } } if (e.ImportantCount > 0 || e.OptionalCount > 0) { string uiString; Core.Instance.UpdateAction = UpdateAction.UpdatesFound; if (e.ImportantCount > 0 && e.OptionalCount > 0) { this.line.Y1 = 50; } if (e.ImportantCount > 0) { uiString = e.ImportantCount == 1 ? Properties.Resources.ImportantUpdateAvailable : Properties.Resources.ImportantUpdatesAvailable; this.tbViewImportantUpdates.Text = string.Format( CultureInfo.CurrentCulture, uiString, e.ImportantCount); this.tbViewImportantUpdates.Visibility = Visibility.Visible; } else { this.tbViewImportantUpdates.Visibility = Visibility.Collapsed; } if (e.OptionalCount > 0) { if (e.ImportantCount == 0) { this.tbHeading.Text = Properties.Resources.NoImportantUpdates; } uiString = e.OptionalCount == 1 ? Properties.Resources.OptionalUpdateAvailable : Properties.Resources.OptionalUpdatesAvailable; this.tbViewOptionalUpdates.Text = string.Format( CultureInfo.CurrentCulture, uiString, e.OptionalCount); this.tbViewOptionalUpdates.Visibility = Visibility.Visible; } else { this.tbViewOptionalUpdates.Visibility = Visibility.Collapsed; } } } else { Core.Instance.UpdateAction = UpdateAction.NoUpdates; } }
private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs args) { SearchResponse response = args.Response; if (response != null && response.ResultSets.Count > 0) { if (response.ResultSets[0].Results.Count > 0) { this.itemCollection.Clear(); foreach (BusinessSearchResult result in response.ResultSets[0].Results) { MyMapItem item = new MyMapItem() { Title = result.Name, Location = result.LocationData.Locations[0], Description = result.Address.AddressLine }; this.itemCollection.Add(item); } } if (response.ResultSets[0].SearchRegion != null && response.ResultSets[0].SearchRegion.GeocodeLocation != null) { // Set map viewport to the best view returned in the search result. this.RadMap1.SetView(response.ResultSets[0].SearchRegion.GeocodeLocation.BestView); //set the zoomlevel so that you collapse any clusters at previous zoom level this.RadMap1.ZoomLevel = response.ResultSets[0].SearchRegion.GeocodeLocation.BestView.ZoomLevel - 1; // Show map shape around bounding area if (response.ResultSets[0].SearchRegion.BoundingArea != null) { MapShape boundingArea = response.ResultSets[0].SearchRegion.BoundingArea; boundingArea.Stroke = new SolidColorBrush(Colors.White); boundingArea.StrokeThickness = 1; this.informationLayer2.Items.Add(boundingArea); } } } }
private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs args) { SearchResponse response = args.Response; if (response != null && response.ResultSets.Count > 0) { if (response.ResultSets[0].Results.Count > 0) { this.itemCollection.Clear(); foreach (SearchResultBase result in response.ResultSets[0].Results) { MyMapItem item = new MyMapItem() { Title = result.Name, Location = result.LocationData.Locations[0] }; this.itemCollection.Add(item); } } if (response.ResultSets[0].SearchRegion != null && response.ResultSets[0].SearchRegion.GeocodeLocation != null) { // Set map viewport to the best view returned in the search result. this.RadMap1.SetView(response.ResultSets[0].SearchRegion.GeocodeLocation.BestView); // Show map shape around bounding area if (response.ResultSets[0].SearchRegion.BoundingArea != null) { MapShape boundingArea = response.ResultSets[0].SearchRegion.BoundingArea; boundingArea.Stroke = new SolidColorBrush(Colors.Red); boundingArea.StrokeThickness = 1; this.informationLayer2.Items.Add(boundingArea); } if (response.ResultSets[0].SearchRegion.GeocodeLocation.Address != null && response.ResultSets[0].SearchRegion.GeocodeLocation.Locations.Count > 0) { foreach (Location location in response.ResultSets[0].SearchRegion.GeocodeLocation.Locations) { MyMapItem item = new MyMapItem() { Title = response.ResultSets[0].SearchRegion.GeocodeLocation.Address.FormattedAddress, Location = location }; this.itemCollection.Add(item); } } } } }
void ws_SearchCompleted(object sender, SearchCompletedEventArgs e) { this.resultParam = e; this.eventComplete.Set(); }
private void SearchProvider_SearchCompleted(object sender, SearchCompletedEventArgs e) { this.SearchProvider.SearchCompleted -= this.SearchProvider_SearchCompleted; if (e.Response.Error != null) { this.BestView = new LocationRect(new Location(0, 0), new Location(0, 0)); this.PinPoints.Clear(); throw new Exception("There was a problem with Bing Maps API search. Please view InnerException details.", e.Response.Error); } if (e.Response.ResultSets == null || e.Response.ResultSets.Count == 0) { return; } var resultSet = e.Response.ResultSets.First(); GeocodeResult geocodeLocation = null; if (resultSet.SearchRegion != null) { // just one result geocodeLocation = resultSet.SearchRegion.GeocodeLocation; } else { // wrong address, suggestions go in AlternateSearchRegions if (resultSet.AlternateSearchRegions.Count != 0) { geocodeLocation = resultSet.AlternateSearchRegions[0].GeocodeLocation; } else { // no real results return; } } this.BestView = geocodeLocation.BestView; this.PinPoints.Clear(); this.PinPoints.Add(geocodeLocation); }
void client_SearchCompleted(object sender, SearchCompletedEventArgs e) { dataGrid1.ItemsSource = e.Result; }