Example #1
0
        //public ObservableCollection<ImageItem> Source = new ObservableCollection<ImageItem>();

        public async Task Init()
        {
            var queryOptions = new QueryOptions(CommonFileQuery.OrderByDate,
                new string[] { ".jpg", ".png", ".jpeg", ".bmp" })
            {
                FolderDepth = FolderDepth.Deep,
                IndexerOption = IndexerOption.OnlyUseIndexer,
                UserSearchFilter = "System.Kind:=System.Kind#Picture"
            };
            queryOptions.SetThumbnailPrefetch(ThumbnailMode.SingleItem, 256, ThumbnailOptions.UseCurrentScale);
            var _fileQueryResult = KnownFolders.PicturesLibrary.CreateFileQueryWithOptions(queryOptions);
            var files = await _fileQueryResult.GetFilesAsync();
            Debug.WriteLine("Count " + files.Count);
            var list = new List<ImageItem>();
            foreach (var f in files)
            {
                list.Add(new ImageItem()
                {
                    LocalPath = f.Path
                });
            }

            Source = new RangeCollection(list);
            Source.Init();
        }