private async Task SearchDevices() { if (!SearchSectionCurrentLoading[ServiceBroker.SearchFilters.Device]) if (DevicesMore) try { LoadingCounter++; var Result = await Broker.SearchDevice(AppBase.Current.SearchTerm , SearchSectionCurrentPage[ServiceBroker.SearchFilters.Device]); this.DevicesItemsLabel = string.Format("{0} ({1})", International.Translation.Devices, Result.totalResults); DevicesMore = Result.moreResults; foreach (var item in Result.results) { var newItem = new SearchResultItem { Name = item.title, Summary = item.summary, ImageUrl = item.image != null ? item.image.standard : "", UniqueId = item.url }; if (!Devices.Any(o => o.UniqueId == newItem.UniqueId)) Devices.Add(newItem); else throw new ArgumentException("item repetido"); } SearchSectionCurrentPage[ServiceBroker.SearchFilters.Device] += 1; if (Result.totalResults == 0) DevicesDescription = International.Translation.NoDevicesFound; else DevicesDescription = string.Empty; LoadingCounter--; } catch (Exception) { LoadingCounter--; //throw ex; // _uxService.ShowAlert(International.Translation.ErrorSearchDevices).RunSynchronously(); } }
private async Task SearchGuides() { if (!SearchSectionCurrentLoading[ServiceBroker.SearchFilters.Guide]) if (GuidesMore) try { LoadingCounter++; SearchSectionCurrentLoading[ServiceBroker.SearchFilters.Guide] = true; var Result = await Broker.SearchGuides(AppBase.Current.SearchTerm, SearchSectionCurrentPage[ServiceBroker.SearchFilters.Guide]); this.GuidesItemLabel = string.Format("{0} ({1})", International.Translation.Guides, Result.totalResults); this.GuidesMore = Result.moreResults; if (Result != null) { foreach (var item in Result.results) { var newItem = new SearchResultItem { Name = item.title.Trim().Replace(""", "''"), Summary = item.type.ToUpper(), ImageUrl = item.image != null ? item.image.standard : "", UniqueId = item.guideid.ToString() }; if (!Guides.Contains(newItem)) Guides.Add(newItem); } SearchSectionCurrentPage[ServiceBroker.SearchFilters.Guide] += 1; SearchSectionCurrentLoading[ServiceBroker.SearchFilters.Guide] = false; SearchSectionResult[ServiceBroker.SearchFilters.Guide] = (RESTModels.Search.Guide.Common)Result; if (Result.totalResults == 0) GuidesDescription = International.Translation.NoGuidesFound; else GuidesDescription = string.Empty; } LoadingCounter--; } catch (Exception ex) { LoadingCounter--; // _uxService.ShowAlert(International.Translation.ErrorSearchDevices).RunSynchronously(); } }