Example #1
0
        private async void FileOpenPage_Loaded(object sender, RoutedEventArgs e)
        {
            var stickerExtensions = await StickerDataSource.GetStickersAsync();

            if (!_pickerUi.AllowedFileTypes.Contains("*"))
            {
                var filteredList = stickerExtensions.ToList();

                foreach (var extension in filteredList)
                {
                    var filteredStickers = (from sticker in extension.Stickers
                                            where _pickerUi.AllowedFileTypes.Contains(sticker.File.FileType.ToLowerInvariant())
                                            select sticker).ToList();

                    extension.Stickers = filteredStickers;
                }

                stickerExtensions = filteredList;
            }

            var resources = ResourceLoader.GetForCurrentView();

            _pickerUi.Title = resources.GetString("ExtensionDisplayName");

            FileGridView.SelectionMode = _pickerUi.SelectionMode == FileSelectionMode.Single
                ? ListViewSelectionMode.Single
                : ListViewSelectionMode.Multiple;

            FileGridView.IsMultiSelectCheckBoxEnabled = _pickerUi.SelectionMode == FileSelectionMode.Multiple;

            ExtensionsViewSource.Source = stickerExtensions;
        }
        /// <summary>
        ///     Attach the data requested event handler and load the stickers
        /// </summary>
        /// <param name="e">the navigation event arguments</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var stickers = await StickerDataSource.GetStickersAsync();

            FilesSource.Source = stickers;

            _navigationHelper.OnNavigatedTo(e);
        }