public static ITypeCategory RandomSample(this ITypeCategoryCollection categories) { return(categories.Random(item => { if (item.Parent == null) { return false; } if (item.IsPrivate == true) { return false; } if (item.IsLocked == true) { return false; } if (item.Types.Any() == false) { return false; } return true; })); }
public static Task <ITypeCategory> GetRandomTypeCategoryAsync(this ITypeCategoryCollection typeCategoryCollection, Func <ITypeCategory, bool> predicate) { return(typeCategoryCollection.Dispatcher.InvokeAsync(() => typeCategoryCollection.Random(predicate))); }