예제 #1
0
 public static ITableCategory RandomSample(this ITableCategoryCollection 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.Tables.Any(i => i.TemplatedParent == null && i.Childs.Any()) == false)
         {
             return false;
         }
         return true;
     }));
 }
 public static Task <ITableCategory> GetRandomTableCategoryAsync(this ITableCategoryCollection tableCategoryCollection, Func <ITableCategory, bool> predicate)
 {
     return(tableCategoryCollection.Dispatcher.InvokeAsync(() => tableCategoryCollection.Random(predicate)));
 }