예제 #1
0
        private async Task GetPianoSheetsAsync(bool isPortableDocumentFormatFile, StorageFolder storageFolder)
        {
            QueryOptions options = new QueryOptions();

            options.FolderDepth = FolderDepth.Deep;
            options.FileTypeFilter.Add(".jpg");
            options.FileTypeFilter.Add(".png");
            options.FileTypeFilter.Add(".gif");
            StorageFileQueryResult      query      = storageFolder.CreateFileQueryWithOptions(options);
            IReadOnlyList <StorageFile> imageFiles = await query.GetFilesAsync();

            Dictionary <string, List <StorageFile> > parentFolderPathToImages = new Dictionary <string, List <StorageFile> >();

            foreach (StorageFile file in imageFiles)
            {
                string parentFolderPath = file.Path.Replace(file.Name, "");
                if (parentFolderPathToImages.ContainsKey(parentFolderPath))
                {
                    parentFolderPathToImages[parentFolderPath].Add(file);
                }
                else
                {
                    parentFolderPathToImages.Add(parentFolderPath, new List <StorageFile> {
                        file
                    });
                }
            }
            foreach (KeyValuePair <string, List <StorageFile> > kvp in parentFolderPathToImages)
            {
                kvp.Value.Sort((file1, file2) => file1.Name.CompareTo(file2.Name));
                string   name = kvp.Key;
                string[] parentFolderPathSplited = kvp.Key.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });
                if (parentFolderPathSplited.Length > 1)
                {
                    name = parentFolderPathSplited[parentFolderPathSplited.Length - 2];
                }
                string fileType = String.Format("Images 📄×{0}", kvp.Value.Count);
                if (isPortableDocumentFormatFile)
                {
                    fileType = String.Format("PDF Document 📄×{0}", kvp.Value.Count);
                }
                ImageProperties properties = await kvp.Value.First().Properties.GetImagePropertiesAsync();

                PianoSheetInfo pianoSheetInfo = new PianoSheetInfo(kvp.Value.First(), kvp.Value, name, fileType, properties);
                PianoSheets.Add(pianoSheetInfo);
            }
        }
예제 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationView.GetForCurrentView().TitleBar.ButtonBackgroundColor = Colors.Black;
            ApplicationView.GetForCurrentView().TitleBar.ButtonForegroundColor = Colors.White;
            if (this.Frame.CanGoBack)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
            else
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            }
            displayRequest.RequestActive();
            pianoSheetInfo = e.Parameter as PianoSheetInfo;
            viewPhase      = 0;
            await RenderView();

            base.OnNavigatedTo(e);
        }
예제 #3
0
 private void OnSheetClick(object sender, ItemClickEventArgs e)
 {
     persistedItem = e.ClickedItem as PianoSheetInfo;
     this.Frame.Navigate(typeof(ViewPage), persistedItem);
 }