private async Task <StorageFile> SaveBitmapToStorage(WriteableBitmap bitmap)
        {
            var myPictures = await StorageLibrary.GetLibraryAsync(Windows.Storage.KnownLibraryId.Pictures);

            StorageFile file = await myPictures.SaveFolder.CreateFileAsync("_photo.jpg", CreationCollisionOption.ReplaceExisting);

            using (var captureStream = new InMemoryRandomAccessStream())
            {
                using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    await bitmap.ToStreamAsJpeg(captureStream);

                    var decoder = await BitmapDecoder.CreateAsync(captureStream);

                    var encoder = await BitmapEncoder.CreateForTranscodingAsync(fileStream, decoder);

                    var properties = new BitmapPropertySet {
                        { "System.Photo.Orientation", new BitmapTypedValue(PhotoOrientation.Normal, PropertyType.UInt16) }
                    };

                    await encoder.BitmapProperties.SetPropertiesAsync(properties);

                    await encoder.FlushAsync();
                }
            }

            return(file);
        }
Exemplo n.º 2
0
        public static async Task GetVideos(VideoRepository videoRepo)
        {
#if WINDOWS_APP
            StorageLibrary videoLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);

            foreach (StorageFolder storageFolder in videoLibrary.Folders)
#else
            StorageFolder storageFolder = KnownFolders.VideosLibrary;
#endif
            {
                try
                {
                    IReadOnlyList <StorageFile> files = await GetMediaFromFolder(storageFolder);
                    await AddVideo(videoRepo, files, false);
                }
                catch
                {
                    LogHelper.Log("An error occured while indexing a video folder");
                }
            }
            if (Locator.VideoLibraryVM.Videos.Count > 0)
            {
                await DispatchHelper.InvokeAsync(() => Locator.VideoLibraryVM.HasNoMedia = false);
            }
            else
            {
                await DispatchHelper.InvokeAsync(() => Locator.VideoLibraryVM.HasNoMedia = true);
            }
            await App.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                Locator.VideoLibraryVM.LoadingState = LoadingState.Loaded;
            });
        }
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                if (string.IsNullOrEmpty(_previewer.MediaCapture.MediaCaptureSettings.AudioDeviceId))
                {
                    rootPage.NotifyUser("No audio device available. Cannot capture.", NotifyType.ErrorMessage);
                }
                else
                {
                    button.Visibility         = Visibility.Collapsed;
                    PreviewControl.Visibility = Visibility.Visible;
                    CheckIfStreamsAreIdentical();
                    PopulateComboBoxes();
                    VideoButton.IsEnabled = true;
                }
            }

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
Exemplo n.º 4
0
        public async Task <bool> SaveFile(string fileName, byte[] data)
        {
            try
            {
                StorageFolder savePath;
                var           myMusic = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

                var root = myMusic.SaveFolder;
                var list = await root.GetFoldersAsync();

                if (list.Where(x => x.Name == FolderName).FirstOrDefault() != null)
                {
                    savePath = await root.GetFolderAsync(FolderName);
                }
                else
                {
                    savePath = await root.CreateFolderAsync(FolderName);
                }
                var file = await savePath.CreateFileAsync(fileName);

                var fileStream = await file.OpenStreamForWriteAsync();

                fileStream.Write(data, 0, data.Length);
                fileStream.Flush();
                fileStream.Close();
                return(true);
            }
            catch (Exception ex) { }
            return(false);
        }
Exemplo n.º 5
0
    async private void RunExportPOIs()
    {
        // get folder for export
        var pictureLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

        string folderName = pictureLibrary.SaveFolder.Path;
        //Debug.Log(String.Format("folderName creation success, folderName: {0}", folderName));

        //assemble POI list
        List <POI> POIs = new List <POI>();

        foreach (Transform child in transform)
        {
            POIs.Add(new POI(child.gameObject.transform.position, child.name));
        }
        // String to hold the output for the voxel grid files
        StringBuilder exportOut = new StringBuilder();

        // path for export
        string fileName   = "POI_" + DateTime.Now.ToString("yyyy-MM-dd HH_mm") + ".csv";
        string pathString = System.IO.Path.Combine(folderName, fileName);

        // Add the POI's to the .csv
        exportOut.Append("Label,X,Y,Z\n");
        foreach (POI p in POIs)
        {
            exportOut.AppendFormat("{0},{1},{2},{3}\n", p.label, p.point.x, p.point.y, p.point.z);
        }

        CreateCSV(pathString, exportOut);
    }
        private async void ButtonDownload_OnClick(object sender, RoutedEventArgs e)
        {
            if (isSaving)
            {
                return;
            }
            isSaving = true;

            try
            {
                string         title    = GetPictureTitle();
                StorageLibrary pictures = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

                StorageFolder folder = await pictures.SaveFolder.CreateFolderAsync("Wallpaper Patterns", CreationCollisionOption.OpenIfExists);

                StorageFile file = await folder.CreateFileAsync(title, CreationCollisionOption.ReplaceExisting);

                using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    await SaveImageToStream(stream);
                }

                string text = string.Format("Downloaded pattern {0} to Pictures gallery", title);
                Notify(text);
            }
            finally
            {
                isSaving = false;
            }
        }
        //设置下载路径到默认的“图片相册”
        private async void setDefaultDownloadFolder()
        {
            var pictureLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            //downloadFolder= pictureLibrary.SaveFolder;
            DownloadFolder = pictureLibrary.SaveFolder;
        }
Exemplo n.º 8
0
        public async Task <IEnumerable <IStorageFolder> > GetLocationsAsync()
        {
            var locationTokens = await GetLocationTokensAsync();

            var locations = new List <IStorageFolder>();

            foreach (var lt in locationTokens)
            {
                var location = await GetFolderFromFalAsync(lt.Token);

                if (location != null)
                {
                    locations.Add(location);
                }
            }

            // TODO fix this shit
            if (!locations.Any())
            {
                var music = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);
                await AddLocationAsync(music.SaveFolder);

                var pictures = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);
                await AddLocationAsync(pictures.SaveFolder);

                var videos = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);
                await AddLocationAsync(videos.SaveFolder);

                return(await GetLocationsAsync());
            }

            return(locations);
        }
Exemplo n.º 9
0
    async void getFolderPath()
    {
        StorageLibrary myPictures = await Windows.Storage.StorageLibrary.GetLibraryAsync(Windows.Storage.KnownLibraryId.Pictures);

        picturesFolder    = myPictures.SaveFolder;
        pictureFolderPath = picturesFolder.Path;
    }
        public async static Task <uint> PLibI(KnownLibraryId id)
        {
            uint count = 0;

            try
            {
                var Library = await StorageLibrary.GetLibraryAsync(id);

                // Bind the FoldersListView to the list of folders that make up the library
                var lfolders = Library.Folders;
                foreach (var folder in lfolders)
                {
                    if (folder != null)
                    {
                        var pth = folder.Path;
                        await Task.Run(() => count += FCount(pth, "\\*"));
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"PLibI Exception {ex.Message}");
            }

            return(count);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                button.Visibility         = Visibility.Collapsed;
                PreviewControl.Visibility = Visibility.Visible;
                CheckIfStreamsAreIdentical();
                PopulateComboBox(MediaStreamType.VideoPreview, PreviewSettings);
                PopulateComboBox(MediaStreamType.Photo, PhotoSettings, false);
                PhotoButton.IsEnabled = true;
            }

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
Exemplo n.º 12
0
    async private void RunExportVoxelGrid()
    {
        //Folder where the export should be placed
        var pictureLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

        string folderName = pictureLibrary.SaveFolder.Path;

        Debug.Log(String.Format("folderName creation success, folderName: {0}", folderName));

        //List to hold the values of the voxel grid
        List <Voxel <T> > exportList = Voxels();
        //String to hold the output for the voxel grid files
        StringBuilder exportOut = new StringBuilder();

        //path for Voxel Grid Export
        string fileName   = "VoxGrid " + DateTime.Now.ToString("yyyy-MM-dd HH_mm") + ".csv";
        string pathString = System.IO.Path.Combine(folderName, fileName);


        //Add the VoxelGrid Sensor values to the .csv
        exportOut.Append("Sensor Value,X,Y,Z\n");
        foreach (var vox in exportList)
        {
            if (!vox.nullVox)
            {
                exportOut.AppendFormat("{0},{1},{2},{3}\n", vox.value, vox.point.x, vox.point.y, vox.point.z);
            }
        }

        CreateCSV(pathString, exportOut);
    }
        public static async Task <StorageFolder> GetDataSaveFolder()
        {
            StorageFolder folder;

            try
            {
                var picturefolder = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures).AsTask().ConfigureAwait(false);

                var pictureLibraryFolder = picturefolder.SaveFolder;

                try
                {
                    folder = await pictureLibraryFolder.GetFolderAsync("Adventure Works");
                }
                catch (Exception ex)
                {
                    folder = await pictureLibraryFolder.CreateFolderAsync("Adventure Works");
                }
            }
            catch (Exception ex)
            {
                folder = ApplicationData.Current.LocalFolder;
            }

            return(folder);
        }
Exemplo n.º 14
0
        private async void ok_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (joinimage_list.Count > 0)
            {
                var imageResult = GetDrawing(false);
                if (imageResult != null)
                {
                    var folder = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

                    StorageFile saveFile = await folder.SaveFolder.CreateFileAsync("imageJoin.png", CreationCollisionOption.GenerateUniqueName);

                    using (var fileStream = await saveFile.OpenAsync(FileAccessMode.ReadWrite))
                    {
                        await imageResult.SaveAsync(fileStream, CanvasBitmapFileFormat.Png, 1f);

                        var msgDialog = new Windows.UI.Popups.MessageDialog("拼图已保存")
                        {
                            Title = "提示"
                        };
                        msgDialog.Commands.Add(new Windows.UI.Popups.UICommand("确定", uiCommand => { }));
                        await msgDialog.ShowAsync();
                    }
                }
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Attempts to lock the page orientation, hide the StatusBar (on Phone) and registers event handlers for hardware buttons and orientation sensors
        /// </summary>
        /// <returns></returns>
        private async Task SetupUiAsync()
        {
            // Attempt to lock page to landscape orientation to prevent the CaptureElement from rotating, as this gives a better experience
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;

            // Hide the status bar
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }

            // Populate orientation variables with the current state
            _displayOrientation = _displayInformation.CurrentOrientation;
            if (_orientationSensor != null)
            {
                _deviceOrientation = _orientationSensor.GetCurrentOrientation();
            }

            RegisterEventHandlers();

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
Exemplo n.º 16
0
    public static async Task GetFileAsync()
    {
        var(authResult, message) = await Authentication.AquireTokenAsync();

        var httpClient = new HttpClient();
        HttpResponseMessage response;
        var request = new HttpRequestMessage(HttpMethod.Get, MainPage.fileurl);

        request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", authResult.AccessToken);
        response = await httpClient.SendAsync(request);

        byte[] fileBytes = await response.Content.ReadAsByteArrayAsync();

        StorageLibrary videoLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);

        string saveFolder   = videoLibrary.SaveFolder.Path;
        string saveFileName = App.Date + "-" + App.StartTime + "-" + App.IBX + "-" + App.Generator + ".xlsx";

        saveLocation = saveFolder + "\\" + saveFileName;
        using (MemoryStream stream = new MemoryStream())
        {
            stream.Write(fileBytes, 0, (int)fileBytes.Length);
            using (spreadsheetDoc = SpreadsheetDocument.Open(stream, true))
            {
                await Task.Run(() =>
                {
                    File.WriteAllBytes(saveLocation, stream.ToArray());
                    return(TaskStatus.RanToCompletion);
                });
            }
        }
    }
Exemplo n.º 17
0
    public async static Task UpdateCell(string docName, string text,
                                        uint rowIndex, string columnName)
    {
        StorageLibrary videoLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);

        string saveFolder   = videoLibrary.SaveFolder.Path;
        string saveFileName = App.Date + "-" + App.StartTime + "-" + App.IBX + "-" + App.Generator + ".xlsx";

        saveLocation = saveFolder + "\\" + saveFileName;
        await Task.Run(() =>
        {
            using (spreadsheetDoc = SpreadsheetDocument.Open(saveLocation, true))
            {
                WorksheetPart worksheetPart =
                    GetWorksheetPartByName(spreadsheetDoc, "GenRun");
                if (worksheetPart != null)
                {
                    Cell cell = GetCell(worksheetPart.Worksheet,
                                        columnName, rowIndex);
                    cell.CellValue = new CellValue(text);
                    cell.DataType  =
                        new EnumValue <CellValues>(CellValues.String);
                    worksheetPart.Worksheet.Save();
                }
            }
            return(TaskStatus.RanToCompletion);
        });
    }
Exemplo n.º 18
0
        private async void baocun_tupian(StorageFile file)
        {
            //获取文件夹
            var myPictures = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            //获取保存到的文件夹
            IObservableVector <StorageFolder> myPictureFolders = myPictures.Folders;
            StorageFolder wenjianjia = null;

            foreach (var item in myPictureFolders)
            {
                if (item.Name == daima.huancun.shezhi_Quanju.baocun_wenjianjia)
                {
                    wenjianjia = item;
                    break;
                }
            }
            if (wenjianjia == null)
            {
                daima.huancun.shezhi_Quanju.baocun_wenjianjia = "Pictures";
                await daima.huancun.shezhi_Quanju.BaocunAsync();

                return;
            }
            //复制文件
            await file.CopyAsync(wenjianjia, tupian_liebiao[gridview1.SelectedIndex].Biaoti, NameCollisionOption.ReplaceExisting);
        }
Exemplo n.º 19
0
        public async Task TakePhotoAsync()
        {
            var stream = new InMemoryRandomAccessStream();

            imeSlike = "Slika" + redniBroj.ToString() + ".jpg";
            redniBroj++;
            Debug.WriteLine("Taking photo...");
            await _mediaCapture.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);

            //var ovajfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            //_captureFolder = await ovajfolder.GetFolderAsync("Slike");
            //_captureFolder = ovajfolder;
            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
            //_captureFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Slike\\");
            try
            {
                var file = await _captureFolder.CreateFileAsync(imeSlike, CreationCollisionOption.GenerateUniqueName);

                Debug.WriteLine("Photo taken! Saving to " + file.Path);
                mjesto = file.Path;
                await ReencodeAndSavePhotoAsync(stream, file, PhotoOrientation.Normal);

                Debug.WriteLine("Photo saved!");
            }
            catch (Exception ex)
            {
                // File I/O errors are reported as exceptions
                Debug.WriteLine("Exception when taking a photo: " + ex.ToString());
            }
        }
Exemplo n.º 20
0
        private async void BackGround_Title()
        {
            try
            {
                await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommand.xml")));

                var status = await BackgroundExecutionManager.RequestAccessAsync();

                foreach (var cur in BackgroundTaskRegistration.AllTasks)
                {
                    if (cur.Value.Name == "TitleTask")
                    {
                        return;
                    }
                }
                var builder = new BackgroundTaskBuilder();
                builder.Name           = "TitleTask";
                builder.TaskEntryPoint = "mediaservice.TitleUpdateTask";
                builder.SetTrigger(StorageLibraryContentChangedTrigger.Create(await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music)));
                builder.AddCondition(new SystemCondition(SystemConditionType.InternetAvailable));
                var task = builder.Register();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var myPictures = await StorageLibrary.GetLibraryAsync(Windows.Storage.KnownLibraryId.Pictures);

            var file = await myPictures.SaveFolder.CreateFileAsync("xaml-islands.jpg", CreationCollisionOption.GenerateUniqueName);

            using (var captureStream = new InMemoryRandomAccessStream())
            {
                await _mediaCapture.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), captureStream);

                using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    var decoder = await BitmapDecoder.CreateAsync(captureStream);

                    var encoder = await BitmapEncoder.CreateForTranscodingAsync(fileStream, decoder);

                    var properties = new BitmapPropertySet {
                        { "System.Photo.Orientation", new BitmapTypedValue(PhotoOrientation.Normal, PropertyType.UInt16) }
                    };
                    await encoder.BitmapProperties.SetPropertiesAsync(properties);

                    await encoder.FlushAsync();

                    imgCollection.Add(file.Path);
                }
            }
        }
        async Task SetupUIAsync()
        {
            // Lock page to landscape to prevent the CaptureElement rotating
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
        /// <summary>
        /// Inits asnyc properties of the view model.
        /// </summary>
        private async void InitAsync()
        {
            // Init TiltController async.
            await tiltController.InitAsync();

            // Get lib folder async.
            storageFolder = (await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures)).SaveFolder;
        }
        public override async void Execute(object parameter)
        {
            var lib = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

            await lib.RequestRemoveFolderAsync(parameter as StorageFolder);

            await Locator.SettingsVM.GetMusicLibraryFolders();
        }
        internal async Task <IEnumerable> InternalGetSnapshotAsync()
        {
            var root = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            var snapshot = await Task.WhenAll(root.Folders.ToArray().Select(async x => await InternalGetSnapshotAsync(x)));

            return(snapshot);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 从音乐库读取歌曲
        /// </summary>
        /// <returns>音乐库中的目录</returns>
        public async Task <List <StorageFolder> > InitialSongList()
        {
            var myMusic = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

            var musicFolders = myMusic.Folders.ToList();

            return(musicFolders);
        }
Exemplo n.º 27
0
        private async void ImageGalleryPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            var data = await ImageLoaderService.GetImageGalleryDataAsync((await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures)).SaveFolder);

            if (data != null)
            {
                imageGridView.ItemsSource = data;
            }
        }
Exemplo n.º 28
0
        /// <summary>
        ///     Set default path to the MusicLibrary
        /// </summary>
        private async void SetDefaultPath()
        {
            musicLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Music);

            pathToMusic = musicLibrary.SaveFolder.Path;
            Debug.WriteLine("PATH TO MUSIC " + pathToMusic);

            GetFilesInFolder();
        }
Exemplo n.º 29
0
        public override async void Execute(object parameter)
        {
#if WINDOWS_APP
            var lib = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);

            lib.RequestRemoveFolderAsync(parameter as StorageFolder);
            Locator.SettingsVM.GetLibrariesFolders();
#endif
        }
Exemplo n.º 30
0
        /// <summary>
        /// Attempts to lock the page orientation, hide the StatusBar (on Phone) and registers event handlers for hardware buttons and orientation sensors
        /// </summary>
        /// <returns></returns>
        private async Task SetupUiAsync()
        {
            // Attempt to lock page to landscape orientation to prevent the CaptureElement from rotating, as this gives a better experience
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
Exemplo n.º 31
0
        /// <summary>
        /// Obtains the list of folders that make up the Pictures library and binds the FoldersListView
        /// to this list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ListFoldersButton_Click(object sender, RoutedEventArgs e)
        {
            ListFoldersButton.IsEnabled = false;
            picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Bind the FoldersListView to the list of folders that make up the library
            FoldersListView.ItemsSource = picturesLibrary.Folders;

            // Register for the DefinitionChanged event to be notified if other apps modify the library
            picturesLibrary.DefinitionChanged += async (StorageLibrary innerSender, object innerEvent) =>
                {
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        UpdateHeaderText();
                    });
                };
            UpdateHeaderText();
        }
        /// <summary>
        /// Gets the Pictures library and sets up the FoldersComboBox to list its folders.
        /// </summary>
        private async void GetPicturesLibrary()
        {
            picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Bind the ComboBox to the list of folders currently in the library
            FoldersComboBox.ItemsSource = picturesLibrary.Folders;

            // Update the states of our controls when the list of folders changes
            picturesLibrary.DefinitionChanged += async (StorageLibrary sender, object e) =>
                {
                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        UpdateControls();
                    });
                };

            UpdateControls();
        }
 public StorageLibraryEvents(StorageLibrary This)
 {
     this.This = This;
 }