Esempio n. 1
0
        private async void addButton_Click(object sender, RoutedEventArgs e)
        {
            StorageLibrary musicLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

            StorageFolder result = await musicLibrary.RequestAddFolderAsync();

            if (result != null)
            {
                LoadFolders();
                Collection.LoadCollectionChanges();
            }
        }
Esempio n. 2
0
        async void knowLibrary()
        {
            StorageLibrary pic = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            IObservableVector <StorageFolder> myPictureFolders = pic.Folders;
            //将现有文件添加到文件库中
            StorageFolder newFolder = await pic.RequestAddFolderAsync();

            //文件夹中移除子文件夹
            //bool result = await picture.RequestRemoveFolderAsync();
            pic.DefinitionChanged += MyPictures_DefinitionChanged;
        }
Esempio n. 3
0
        /// <summary>
        /// Displays the folder Picker to request that the user select a folder that will be added to the
        /// Pictures library.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void AddFolderButton_Click(object sender, RoutedEventArgs e)
        {
            StorageLibrary picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            StorageFolder folderAdded = await picturesLibrary.RequestAddFolderAsync();

            if (folderAdded != null)
            {
                OutputTextBlock.Text = folderAdded.DisplayName + " was added to the Pictures library.";
            }
            else
            {
                OutputTextBlock.Text = "Operation canceled.";
            }
        }
Esempio n. 4
0
        public async void OnSelectLibrary()
        {
            StorageLibrary storageLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

            StorageFolder libraryRoot = await storageLibrary.RequestAddFolderAsync();

            var paths = storageLibrary.Folders.Select(f => f.Path);

            if (libraryRoot != null)
            {
                LibraryService.SetupLibrary(libraryRoot);

                SelectorVisibility.Value    = Visibility.Collapsed;
                ProgressRingVisiblity.Value = Visibility.Visible;

                await LibraryService.LoadLibrary();
            }
        }