public async Task <string> PickDeployFolder() { // prepare folder picker FolderPicker folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; folderPicker.FileTypeFilter.Add("*"); // open picker StorageFolder folder = await folderPicker.PickSingleFolderAsync(); // any folder picked if (folder != null) { // save it to access list for future use Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace(DeployFolderToken, folder); // return folder path return(folder.Path); } // user canceled picker return(String.Empty); }
/// <summary> /// /// </summary> /// <returns>the user-selected folder, if any, or null otherwise</returns> private async Task <StorageFolder> LetUserSelectFolder() { // file pickers do not work in snapped mode if (EnsureUnsnapped()) { var picker = new FolderPicker(); picker.SuggestedStartLocation = PickerLocationId.ComputerFolder; picker.FileTypeFilter.Add(".mp3"); var folder = await picker.PickSingleFolderAsync(); if (folder != null) { StoreFolderLocalLibrary.Save(folder); } return(folder); } else { return(null); } }
private async void PlayExecute() { var folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.ComputerFolder }; folderPicker.FileTypeFilter.Add(".mp3"); var folder = await folderPicker.PickSingleFolderAsync(); var files = new List <string>(); await GetAllFile(folder, files); // ShowMessage(Files.Count.ToString()); Frame root = Window.Current.Content as Frame; root?.Navigate(typeof(SecondPage), files); }
private async void ProcessImagesClicked(object sender, RoutedEventArgs e) { try { FolderPicker folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { await ProcessImagesAsync(folder); } this.currentRootFolder = folder; } catch (Exception ex) { await Util.GenericApiCallExceptionHandler(ex, "Error picking the target folder."); } }
public async void BrowseFolderWithShownPokemon() { FolderPicker folderPicker = new FolderPicker() { SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; folderPicker.FileTypeFilter.Add(".txt"); IStorageFolder hpf = await folderPicker.PickSingleFolderAsync(); if (hpf == null) { showErrorDialog("You have to choose folder with no blank pokemon pictures. "); shownPath = defaultPath; } else { shownPath = hpf.Path; } OnPropertyChanged("ShownPath"); }
private static async void ExportFolderButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { var folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.Downloads }; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder); // Set TextBox text and StorageFolder variable and make primary button clickable ExportFolder = folder; ExportFolderTextBox.Text = folder.Path; ExportDataContentDialog.IsPrimaryButtonEnabled = true; } }
public async void BrowseFolderWithHiddenPokemon() { FolderPicker folderPicker = new FolderPicker() { SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; folderPicker.FileTypeFilter.Add(".txt"); IStorageFolder hpf = await folderPicker.PickSingleFolderAsync(); if (hpf == null) { if (String.IsNullOrEmpty(hiddenPath)) { showErrorDialog("You have to choose folders with blank pokemon pictures. "); } return; } hiddenPath = hpf.Path; OnPropertyChanged("HiddenPath"); }
private async void AddSource() { var picker = new FolderPicker(); picker.FileTypeFilter.Add("*"); picker.ViewMode = PickerViewMode.List; var folder = await picker.PickSingleFolderAsync(); if (folder == null) { return; } var source = new Source { Path = folder.Path, Token = StorageApplicationPermissions.FutureAccessList.Add(folder) }; new SourceService(new SourceRepository()).Add(source); GetAllSources(); }
private async void btnArtistsFolder_Click(object sender, RoutedEventArgs e) { FolderPicker p = new FolderPicker(); p.ViewMode = PickerViewMode.List; p.SuggestedStartLocation = PickerLocationId.MusicLibrary; p.FileTypeFilter.Add(".wma"); p.FileTypeFilter.Add(".mp3"); StorageFolder f = null; try { f = await p.PickSingleFolderAsync(); } catch (Exception) { } if (f == null) return; ViewModel.MainViewModel.Instance.RootFolder = f; }
private async void Audio_Click(object sender, RoutedEventArgs e) { FolderPicker folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.ComputerFolder }; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { Windows.Storage.AccessCache.StorageApplicationPermissions. FutureAccessList.AddOrReplace("Audio", folder); this.Audio.Text = folder.Path; } else { this.Audio.Text = Json.Json_audioteca; } }
private async void PickFolderButton_Click(object sender, RoutedEventArgs e) { FolderPicker picker = new FolderPicker(); picker.FileTypeFilter.Add("*"); var folder = await picker.PickSingleFolderAsync(); if (folder == null) { return; } string token = StorageApplicationPermissions.MostRecentlyUsedList.Add(folder); lock (rootFolderSyncRoot) { rootFolder = folder; rootPath = folder.Path; rootFolderBlock.Text = rootPath; ApplicationData.Current.LocalSettings.Values[RootFolderSetting] = token; } }
private async void Button_GameDir_Click(object sender, RoutedEventArgs e) { try { var folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.Desktop; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { LaunchOption opt = OptionsView.ListView.SelectedItem as LaunchOption; opt.gameDir = folder.Path; } } catch (Exception exp) { await __msgDialog.Show(CoreManager.GetStringFromResource("/LaunchOptions/GameDirSelectError"), exp.Message + "\r\n" + exp.StackTrace); } }
private async void btn_CustomDoanPath_Click(object sender, RoutedEventArgs e) { FolderPicker fp = new FolderPicker(); fp.FileTypeFilter.Add(".mp4"); var f = await fp.PickSingleFolderAsync(); if (f == null) { return; } string mruToken = StorageApplicationPermissions.MostRecentlyUsedList.Add(f, f.Path); SettingHelper.Set_DownPath(f.Path); txt_CustomDownPath.Text = f.Path; //读取文件夹 // string mruFirstToken = StorageApplicationPermissions.MostRecentlyUsedList.Entries.First(x=>x.Metadata==f.Path).Token; //StorageFolder retrievedFile = await StorageApplicationPermissions.MostRecentlyUsedList.GetFolderAsync(mruFirstToken); //Utils.ShowMessageToast(mruToken, 3000); }
private async void btnAddPage_Click(object sender, RoutedEventArgs e) { var folderPicker = new FolderPicker(); folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { if (AppSettings.PagesOnStartupList != null) { AppSettings.PagesOnStartupList = AppSettings.PagesOnStartupList.Append(folder.Path).ToArray(); } else { AppSettings.PagesOnStartupList = new string[] { folder.Path }; } CreateAndAddPageItem(folder.Path); } }
private async void ReadROM_Click(object sender, RoutedEventArgs e) { try { var folderPicker = new FolderPicker() { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.DocumentsLibrary, }; folderPicker.FileTypeFilter.Add("*"); var targetFolder = await folderPicker.PickSingleFolderAsync().AsTask(); ROMSaveRequested?.Invoke(this, new ROMSaveRequestedArgs(targetFolder)); } catch (Exception) { Debug.WriteLine("Failed to pick file!"); } }
public async void OpenFolderPicker() { FolderPicker folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; folderPicker.FileTypeFilter.Add("*"); #if !WINDOWS_PHONE_APP this.Folder = await folderPicker.PickSingleFolderAsync(); if (this.Folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", this.Folder); if (this.FilePickerFinish != null) { this.FilePickerFinish(this.Folder, null); } } #else folderPicker.PickFolderAndContinue(); #endif }
private async void AddFolderToMonitor() { FolderPicker picker = new FolderPicker(); picker.SuggestedStartLocation = PickerLocationId.ComputerFolder; picker.FileTypeFilter.Add(".sln"); var searchFolder = await picker.PickSingleFolderAsync(); if (searchFolder != null) { string uniqueNameForFutureAccessList = $"VsSO_{Guid.NewGuid().ToString()}"; StorageApplicationPermissions.FutureAccessList.AddOrReplace(uniqueNameForFutureAccessList, searchFolder); if (localSettings == null) { localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; } if (localSettings.Values["FutureAccessList_PathIdentifiers"] != null && !string.IsNullOrEmpty(localSettings.Values["FutureAccessList_PathIdentifiers"].ToString())) { List <string> listOfUniquePathFinders = localSettings.Values["FutureAccessList_PathIdentifiers"].ToString().Split(',').ToList(); if (!listOfUniquePathFinders.Any(s => s.Equals(uniqueNameForFutureAccessList))) { listOfUniquePathFinders.Add(uniqueNameForFutureAccessList); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < listOfUniquePathFinders.Count; i++) { builder.Append(listOfUniquePathFinders[i]); if (i < listOfUniquePathFinders.Count - 1) { builder.Append(','); } } localSettings.Values["FutureAccessList_PathIdentifiers"] = builder.ToString(); } else { localSettings.Values["FutureAccessList_PathIdentifiers"] = uniqueNameForFutureAccessList; } } }
private async void BtnImportSite_ClickAsync(object sender, RoutedEventArgs e) { FolderPicker folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, ViewMode = PickerViewMode.List }; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { // Load from storage folder Site site = await Site.LoadFromFolderAsync(folder); if (_viewModel.GetSiteId(site) >= 0) { // Site exists in the list, ask if it needs to be replaced. ContentDialog dialog = new ContentDialog { Title = "Do you want to overwrite?", Content = "Site " + site.Name + " found in sites repository. Do you want to overwrite it?", PrimaryButtonText = "Yes", SecondaryButtonText = "No", DefaultButton = ContentDialogButton.Secondary }; ContentDialogResult result = await dialog.ShowAsync(); if (result != ContentDialogResult.Primary) { return; } } PageBusy(string.Format("Importing site {0}...", site.Name)); await _viewModel.AddSiteAsync(site); PageReady(); } }
private async void BtSerialize_ClickAsync(object sender, RoutedEventArgs e) { myListView.Items.Clear(); var folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); try { if (folder != null) { myProgressBar.IsIndeterminate = true; await Task.Yield(); var list = await GetLisFilesAsync(folder, folder.Name); StorageFile storageFile = await folder.CreateFileAsync(folder.Name + ".bin", CreationCollisionOption.GenerateUniqueName); var stream = await storageFile.OpenStreamForWriteAsync(); ZipLib.Serialize.SerializeToBinaryFile(stream, list); } }catch (Exception ex) { var msgDialog = new MessageDialog("Oops!"); await msgDialog.ShowAsync(); Debug.WriteLine("Main Page. 'BtSerialize_ClickAsync' " + ex.Message); } finally { myProgressBar.IsIndeterminate = false; } }
async void OnClick_ChooseFolder(object sender, RoutedEventArgs e) { var folderPicker = new FolderPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.Desktop }; folderPicker.FileTypeFilter.Add(".txt"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { string folderContent = string.Empty; Windows.Storage.AccessCache.StorageApplicationPermissions. FutureAccessList.AddOrReplace("PickedFolderToken", folder); var files = await folder.GetFilesAsync(); foreach (var file in files) { var stream = await file.OpenAsync(FileAccessMode.Read); using (StreamReader reader = new StreamReader(stream.AsStream())) { if (folderContent == string.Empty) { folderContent = reader.ReadToEnd(); } else { folderContent = string.Concat(folderContent, reader.ReadToEnd()); } } } FileContent = folderContent; } }
public static async Task <StorageFolder> GetSaveFolder(string content, string title) { string token = "default"; StorageFolder folder = null; try { if (StorageApplicationPermissions.FutureAccessList.ContainsItem(token)) { folder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(token); return(folder); } } catch { } MessageDialog dlg = new MessageDialog(content, title); await dlg.ShowAsync(); FolderPicker picker = new FolderPicker(); picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add("*"); folder = await picker.PickSingleFolderAsync(); if (folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace(token, folder); } else { folder = ApplicationData.Current.LocalFolder; } return(folder); }
private async void OpenFolder_OnClick(object sender, RoutedEventArgs e) { var picker = new FolderPicker { CommitButtonText = "Select", ViewMode = PickerViewMode.List }; picker.FileTypeFilter.Add(".idx"); picker.FileTypeFilter.Add(".dz"); picker.FileTypeFilter.Add(".ifo"); picker.SettingsIdentifier = "FolderPicker"; var folder = await picker.PickSingleFolderAsync(); StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder); var abstractFolder = new PCLStorage.WinRTFolder(folder); using (var dict = new StarDict(abstractFolder, @"dictd_www.freedict.de_eng-nld")) { await dict.Init(); } }
public async void SearchForSolutions() { var configurationStored = await Serializer.LoadConfiguration <ObservableCollection <Solution> >(); if (configurationStored != null) { solutions = configurationStored; solutionsGrid.ItemsSource = solutions; } else { StorageFolder searchFolder; if (StorageApplicationPermissions.FutureAccessList.ContainsItem("VsSolutionOrganizerBaseSearchPath")) { searchFolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync("VsSolutionOrganizerBaseSearchPath"); } else { FolderPicker picker = new FolderPicker(); picker.SuggestedStartLocation = PickerLocationId.ComputerFolder; picker.FileTypeFilter.Add(".sln"); searchFolder = await picker.PickSingleFolderAsync(); if (searchFolder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("VsSolutionOrganizerBaseSearchPath", searchFolder); } } if (searchFolder != null) { foreach (var solutionFolder in await searchFolder.GetFoldersAsync()) { solutions.Add(new Solution { id = Guid.NewGuid().ToString(), name = solutionFolder.Name, stauts = StatusOfSolution.InDevelop, tags = new List <string>() }); } } } }
private async void decrpt_Click(object sender, RoutedEventArgs e) { try { FileOpenPicker filePicker = new FileOpenPicker(); filePicker.FileTypeFilter.Add("*"); StorageFile temp = await filePicker.PickSingleFileAsync(); StorageFile decrpt = await helper.Decrypt(temp); //helper.popup("File is Decrpted and please select the folder to place the Decrpted file ", "File Decrpted"); FolderPicker folderPicker = new FolderPicker(); folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); StorageFile local = await folder.CreateFileAsync(temp.Name, CreationCollisionOption.GenerateUniqueName); await decrpt.CopyAndReplaceAsync(local); await decrpt.DeleteAsync(); } catch { } }
public async void OpenSingleFolder() { if (EnsureUnsnapped()) { log("INFO", "OpenSingleFolder..."); selection.Clear(); isBusy = true; try { FolderPicker folderPicker = new FolderPicker(); folderPicker.ViewMode = CurrentViewMode; folderPicker.SuggestedStartLocation = CurrentLocation; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { selection.Add(folder.Path); LastOpenFolder = folder; StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder); } } catch (Exception ex) { log("ERROR", ex.ToString()); } log("INFO", $"OpenSingleFolder end: {selection.Count}"); } else { log("ERROR", "OpenFiles: could not unsnap!"); } isBusy = false; }
private async void Source_Click(object sender, RoutedEventArgs e) { FolderPicker folderPicker = new FolderPicker { SuggestedStartLocation = PickerLocationId.ComputerFolder }; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { //храним пути до папок var name = "Device" + EditDevice.Id; Windows.Storage.AccessCache.StorageApplicationPermissions. FutureAccessList.AddOrReplace(name, folder); Source.Text = folder.Path; } else { } }
private async void Button_Click(object sender, RoutedEventArgs e) { FolderPicker folderPicker = new FolderPicker(); folderPicker.ViewMode = PickerViewMode.List; folderPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder; folderPicker.FileTypeFilter.Add("*"); StorageFolder pickedFolder = await folderPicker.PickSingleFolderAsync(); StorageFolder outFolder = await folderPicker.PickSingleFolderAsync(); List <StorageFile> xbfList = (await pickedFolder.GetFilesAsync(CommonFileQuery.OrderByName)).Where(x => x.FileType == ".xbf").ToList(); foreach (StorageFile picked in xbfList) { StorageFolder folder = await RecreatePath(outFolder, picked.Path.Substring(pickedFolder.Path.Length).Split('\\').Skip(1).SkipLast(1)); var file = await folder.CreateFileAsync(picked.Name + ".xaml", CreationCollisionOption.ReplaceExisting); await Conventer.Convert(picked, file); } }
public async void OnBrowseClick(object sender, RoutedEventArgs e) { var picker = new FolderPicker { SuggestedStartLocation = PickerLocationId.MusicLibrary, ViewMode = PickerViewMode.List, }; foreach (var container in Playlist.SupportedContainers) { picker.FileTypeFilter.Add(container); } var folder = await picker.PickSingleFolderAsync(); _tempItems = new List <IStorageItem> { folder }; UpdateFolderFilesCount(_tempItems); if (Title.Length == 0) { Title = folder.DisplayName; } }
/// <inheritdoc/> public async Task <IStorageFolder> RequestFolderAsync(StorageDialogSettings settings) { FolderPicker dialog = new FolderPicker(); if (settings.ShownFileTypes == null || !settings.ShownFileTypes.Any()) { dialog.FileTypeFilter.Add("*"); } else { dialog.FileTypeFilter.AddRange(settings.ShownFileTypes.Select(f => $".{f}")); } if (settings.OverrideSelectText != null) { dialog.CommitButtonText = settings.OverrideSelectText; } var folder = await dialog.PickSingleFolderAsync(); return(new UwpFolder(folder)); }
private async void btSaveAs_Click(object sender, RoutedEventArgs e) { FolderPicker openPicker = new FolderPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.Desktop; openPicker.FileTypeFilter.Add("*"); StorageFolder folder = await openPicker.PickSingleFolderAsync(); if (folder != null) { StorageFile file = await folder.CreateFileAsync("salvo.txt", CreationCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(file, Gerenciador.getRelatorio()); textBox.Text = "Arquivo Salvo com Sucesso!"; textBox.Visibility = Visibility.Visible; btOk.Visibility = Visibility.Visible; controle = "Salvo"; } }
private IAsyncOperation<StorageFolder> SelectFolderAsync( SelectFolderInteraction selectFolder ) { Contract.Requires( selectFolder != null ); Contract.Ensures( Contract.Result<IAsyncOperation<StorageFolder>>() != null ); var commitButton = selectFolder.DefaultCommand; var dialog = new FolderPicker(); dialog.FileTypeFilter.AddRange( selectFolder.FileTypeFilter ); dialog.SuggestedStartLocation = SuggestedStartLocation; dialog.ViewMode = ViewMode; if ( dialog.FileTypeFilter.Count == 0 ) dialog.FileTypeFilter.Add( "*" ); if ( !string.IsNullOrEmpty( SettingsIdentifier ) ) dialog.SettingsIdentifier = SettingsIdentifier; if ( commitButton != null ) dialog.CommitButtonText = commitButton.Name; return dialog.PickSingleFolderAsync(); }
private void SelectFolder( SelectFolderInteraction selectFolder ) { Contract.Requires( selectFolder != null ); var commitButton = selectFolder.DefaultCommand; var dialog = new FolderPicker(); dialog.ContinuationData.AddRange( selectFolder.ContinuationData ); dialog.FileTypeFilter.AddRange( selectFolder.FileTypeFilter ); dialog.SuggestedStartLocation = SuggestedStartLocation; dialog.ViewMode = ViewMode; if ( dialog.FileTypeFilter.Count == 0 ) dialog.FileTypeFilter.Add( "*" ); if ( !string.IsNullOrEmpty( SettingsIdentifier ) ) dialog.SettingsIdentifier = SettingsIdentifier; if ( commitButton != null ) dialog.CommitButtonText = commitButton.Name; dialog.PickFolderAndContinue(); }