public override int GetHashCode() { int hash = 17; hash = hash * 23 + (SearchRoot?.GetHashCode() ?? 0); hash = hash * 23 + NavigationStrategyOverride.GetHashCode(); hash = hash * 23 + IgnoreClipping.GetHashCode(); hash = hash * 23 + IgnoreCone.GetHashCode(); hash = hash * 23 + (ExclusionRect?.GetHashCode() ?? 0); hash = hash * 23 + (FocusHintRectangle?.GetHashCode() ?? 0); hash = hash * 23 + IgnoreOcclusivity.GetHashCode(); hash = hash * 23 + UpdateManifoldsFromFocusHintRectangle.GetHashCode(); return(hash); }
async void IntoSearch(string keyword) { ProgressBar_Searching.Visibility = Visibility.Visible; searchType = int.Parse(((PivotItem)Pivot_search.SelectedItem).Tag.ToString()); SearchRoot searchRoot = await Task.Run(() => SearchService.SearchClound(keyword, searchType)); if (searchRoot != null && searchRoot.result != null) { switch (searchType) { case 1: { //判断是否为喜欢歌曲 if (MainPage.favoriteSongsRoot != null) { foreach (var temp in searchRoot.result.songs) { if (MainPage.favoriteSongsRoot.ids.Find(p => p.Equals(temp.Id)) != 0) { temp.isFavorite = true; } } } ListBox_searchSong.ItemsSource = searchRoot.result.songs; } break; case 10: { ListBox_searchAlbum.ItemsSource = searchRoot.result.albums; } break; case 100: { ListBox_searchArtist.ItemsSource = searchRoot.result.artists; } break; case 1000: { AdaptiveGridView_searchPlaylist.ItemsSource = searchRoot.result.playlists; } break; } } ProgressBar_Searching.Visibility = Visibility.Collapsed; }
internal static TravelDataResult SearchFunc(SearchRoot rootObj) { var resultObj = new TravelDataResult() { success = rootObj.success, elapsedMilliseconds = rootObj.elapsedMilliseconds, data = rootObj.data.items.Select(item => new TravelDataItem { TourDate = item.tour.tourDate.ToShortDateString(), HotelName = item.hotels.FirstOrDefault()?.name, RoomName = item.hotels.FirstOrDefault()?.room.name, MealType = item.hotels.FirstOrDefault()?.mealType.name, Price = item.price.value, Currency = item.price.currencyCode }).ToList() }; return(resultObj); }
private SearchResultCollection FindAll(bool findMoreThanOne) { //if it is not of valid searching type, then throw an exception if (SearchRoot == null) { Version adsVersion = GetAdsVersion(); throw new InvalidOperationException(Res.GetString(Res.DSVersion, adsVersion.ToString())); } DirectoryEntry clonedRoot = null; if (assertDefaultNamingContext == null) { clonedRoot = SearchRoot.CloneBrowsable(); } else { //SECREVIEW: If the SearchRoot was created by this object // it is safe to assert its browse permission to get // the inner IAds. DirectoryServicesPermission dsPermission = new DirectoryServicesPermission( DirectoryServicesPermissionAccess.Browse, assertDefaultNamingContext); dsPermission.Assert(); try { clonedRoot = SearchRoot.CloneBrowsable(); } finally { DirectoryServicesPermission.RevertAssert(); } } UnsafeNativeMethods.IAds adsObject = clonedRoot.AdsObject; if (!(adsObject is UnsafeNativeMethods.IDirectorySearch)) { throw new NotSupportedException(Res.GetString(Res.DSSearchUnsupported, SearchRoot.Path)); } UnsafeNativeMethods.IDirectorySearch adsSearch = (UnsafeNativeMethods.IDirectorySearch)adsObject; SetSearchPreferences(adsSearch, findMoreThanOne); string[] properties = null; if (PropertiesToLoad.Count > 0) { if (!PropertiesToLoad.Contains("ADsPath")) { // if we don't get this property, we won't be able to return a list of DirectoryEntry objects! PropertiesToLoad.Add("ADsPath"); } properties = new string[PropertiesToLoad.Count]; PropertiesToLoad.CopyTo(properties, 0); } IntPtr resultsHandle; if (properties != null) { adsSearch.ExecuteSearch(Filter, properties, properties.Length, out resultsHandle); } else { adsSearch.ExecuteSearch(Filter, null, -1, out resultsHandle); properties = new string[0]; } SearchResultCollection result = new SearchResultCollection(clonedRoot, resultsHandle, properties, Filter); return(result); }
public void Test_SearchRootNewton_ArgumentException(double number, double eps, int rPower) { Assert.Throws <ArgumentException>(() => SearchRoot.SearchRootNewton(number, eps, rPower)); }
public double Test_SearchRootNewton(double number, double eps, int rPower, int round) { return(Math.Round(SearchRoot.SearchRootNewton(number, eps, rPower), round)); }