/// <summary> /// Shows the folder picker so that the user can pick a folder. /// </summary> /// <param name="settings">The settings for the folder picker.</param> /// <returns> /// When the call to this method completes successfully, it returns a /// <see cref="StorageFolder" /> object that represents the folder that the user picked. /// </returns> public IAsyncOperation <StorageFolder> PickSingleFolderAsync(FolderPickerSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var dialog = new FolderPickerWrapper(settings); return(dialog.PickSingleFolderAsync()); }
private async void BrowseFolder() { var settings = new FolderPickerSettings { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeFilter = new List<string> { ".txt" } }; StorageFolder storageFolder = await dialogService.PickSingleFolderAsync(settings); if (storageFolder != null) { Path = storageFolder.Path; } }
private async void BrowseFolder() { var settings = new FolderPickerSettings { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeFilter = new List <string> { ".txt" } }; StorageFolder storageFolder = await dialogService.PickSingleFolderAsync(settings); if (storageFolder != null) { Path = storageFolder.Path; } }
/// <summary> /// Initializes a new instance of the <see cref="FolderPickerWrapper"/> class. /// </summary> /// <param name="settings">The settings for the folder picker.</param> internal FolderPickerWrapper(FolderPickerSettings settings) { if (settings == null) throw new ArgumentNullException(nameof(settings)); picker = new FolderPicker { CommitButtonText = settings.CommitButtonText, SettingsIdentifier = settings.SettingsIdentifier, SuggestedStartLocation = settings.SuggestedStartLocation, ViewMode = settings.ViewMode }; foreach (string fileTypeFilter in settings.FileTypeFilter) { picker.FileTypeFilter.Add(fileTypeFilter); } }
async void SaveImageMethod() { //Setup metadata. var metaData = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>( "Format", "png" ), new KeyValuePair <string, string>( "Application Name", "Reconstruction and Calibration Tool (UWP)" ), new KeyValuePair <string, string>( "Camera Manufacturer", "Centice" ), new KeyValuePair <string, string>( "Exposure Time", ExposureTime.ToString() ), new KeyValuePair <string, string>( "Laser enabled", IsLaserChecked.ToString() ), new KeyValuePair <string, string>( "Values scaled", IsScaledChecked.ToString() ), new KeyValuePair <string, string>( "Min value", MinValue ), new KeyValuePair <string, string>( "Max value", MaxValue ) }; if (SaveAmount == 1) { var saveFileSettings = new FileSavePickerSettings { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeChoices = new Dictionary <string, IList <string> > { { "PNG Images", new List <string> { ".png" } } }, DefaultFileExtension = ".png" }; StorageFile storageFile = await _dialogService.PickSaveFileAsync(saveFileSettings); if (storageFile != null) { StorageFile img = await Imaging.WriteableBitmapToStorageFile(_lastImageArray, IsScaledChecked, metaData); await img.CopyAndReplaceAsync(storageFile); } } else { //Disable Buttons. SaveImageButtonEnabled = false; GetImageButtonEnabled = false; //Get folder to save imgs. var folderPickerSettings = new FolderPickerSettings { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeFilter = new List <string> { ".png" } }; StorageFolder storageFolder = await _dialogService.PickSingleFolderAsync(folderPickerSettings); //GetImage, Save, Loop. for (uint i = 0; i < SaveAmount; i++) { try { Image = await GetImageFromCamera(); } catch (Exception) { // ignored } StorageFile img = await Imaging.WriteableBitmapToStorageFile(_lastImageArray, IsScaledChecked, metaData); string strDateTime = DateTime.Now.ToString("yyyyMMdd-HHmmss-"); await img.CopyAsync(storageFolder, strDateTime + "img" + i + ".png"); } SaveImageButtonEnabled = true; GetImageButtonEnabled = true; } }
public IAsyncOperation <StorageFolder> PickSingleFolderAsync(FolderPickerSettings settings) { throw new NotImplementedException(); }