async Task <IClipboardData> GetFirstSupportedDataAsync(IClipboardDataPackage package)
        {
            var validItems = await asyncFilter.FilterAsync(package.Contents, CanPerformAsync)
                             .ConfigureAwait(false);

            return(validItems.FirstOrDefault());
        }
Пример #2
0
        public async Task <bool> CanPerformAsync(
            IClipboardDataPackage package)
        {
            var supportedData = await asyncFilter.FilterAsync(package.Contents, CanPerformAsync);

            return(supportedData.Any());
        }
Пример #3
0
        async Task <IReadOnlyCollection <IClipboardData> > GetSupportedData(
            IClipboardDataPackage package)
        {
            var supportedData = await asyncFilter.FilterAsync(package.Contents, CanPerformAsync);

            return(supportedData);
        }
Пример #4
0
 public async Task <IEnumerable <string> > ExtractLinksFromTextAsync(string text)
 {
     return(await Task.Run(async() =>
     {
         var words = GetWords(text);
         return await asyncFilter.FilterAsync(words, IsValidLinkAsync);
     }));
 }
        async Task <IEnumerable <IAction> > GetSupportedActionsFromDataAsync(IClipboardDataPackage data)
        {
            using (performanceHandleFactory.StartMeasuringPerformance())
            {
                var allowedActions = await asyncFilter.FilterAsync(allActions, action => action.CanPerformAsync(data)).ConfigureAwait(false);

                return(allowedActions.OrderBy(x => x.Order));
            }
        }
        async Task <IEnumerable <IActionViewModel> > GetSupportedActionsFromDataAsync(
            IClipboardDataControlPackage data)
        {
            var allowedActions = await asyncFilter
                                 .FilterAsync(
                allActions,
                action => action.CanPerformAsync(data.Data));

            var viewModelMappingTasks = allowedActions
                                        .Select(x => GetActionViewModelFromActionAndPackageAsync(data, x));
            var viewModels = await Task.WhenAll(viewModelMappingTasks);

            return(viewModels.OrderBy(x => x.Action.Order));
        }
Пример #7
0
        async Task <IClipboardData> GetFirstSupportedItem(IClipboardDataPackage data)
        {
            var supportedData = await asyncFilter.FilterAsync(data.Contents, CanPerformAsync);

            return(supportedData.FirstOrDefault());
        }