public async void Execute(object parameter) { try { App.OpenFilePickerReason = OpenFilePickerReason.OnOpeningVideo; var picker = new FileOpenPicker { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.VideosLibrary }; foreach (var ext in _allowedExtensions) picker.FileTypeFilter.Add(ext); #if WINDOWS_APP StorageFile file = null; file = await picker.PickSingleFileAsync(); if (file != null) { LogHelper.Log("Opening file: " + file.Path); await Locator.MediaPlaybackViewModel.OpenFile(file); } else { LogHelper.Log("Cancelled"); } App.OpenFilePickerReason = OpenFilePickerReason.Null; #else picker.PickSingleFileAndContinue(); #endif } catch { } }
private void Image_Tapped(object sender, TappedRoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.FileTypeFilter.Add(".jpg"); openPicker.ContinuationData["Operation"] = "Image"; openPicker.PickSingleFileAndContinue(); }
public async override void Execute(object parameter) { var album = parameter as AlbumItem; if (album == null) { var args = parameter as ItemClickEventArgs; if(args != null) album = args.ClickedItem as AlbumItem; } var openPicker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); openPicker.FileTypeFilter.Add(".gif"); // Windows Phone launches the picker, then freezes the app. We need // to pick it up again on OnActivated. #if WINDOWS_PHONE_APP App.OpenFilePickerReason = OpenFilePickerReason.OnPickingAlbumArt; App.SelectedAlbumItem = album; openPicker.PickSingleFileAndContinue(); #else var file = await openPicker.PickSingleFileAsync(); if (file == null) return; var byteArray = await ConvertImage.ConvertImagetoByte(file); await App.MusicMetaService.SaveAlbumImageAsync(album, byteArray); await Locator.MusicLibraryVM._albumDatabase.Update(album); #endif }
private async void Button_Click(object sender, RoutedEventArgs e) { if (file == null) { var openPicker = new FileOpenPicker { SuggestedStartLocation = PickerLocationId.PicturesLibrary, ViewMode = PickerViewMode.Thumbnail }; openPicker.FileTypeFilter.Add(".jpg"); openPicker.PickSingleFileAndContinue(); button.Content = "Upload"; } else { var config = await GoogleConfig.Create( "517285908032-12332132132131321312.apps.googleusercontent.com", new List<string>(new string[] { "https://www.googleapis.com/auth/drive" }), "google" ); //var config = await KeycloakConfig.Create("shoot-third-party", "https://localhost:8443", "shoot-realm"); //var config = FacebookConfig.Create("1654557457742519", "9cab3cb953d3194908f44f1764b5b921", // new List<string>(new string[] { "photo_upload, publish_actions" }), "facebook"); var module = await AccountManager.AddAccount(config); if (await module.RequestAccessAndContinue()) { Upload(module); } } }
private async void button_Click(object sender, RoutedEventArgs e) { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.FileTypeFilter.Add(".jpg"); picker.PickSingleFileAndContinue(); }
public Task LaunchFileSelectionServiceAsync() { FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".dat"); Task task = null; #if WINDOWS_PHONE_APP this.completionSource = new TaskCompletionSource<int>(); picker.PickSingleFileAndContinue(); task = this.completionSource.Task; #endif #if WINDOWS_APP task = picker.PickSingleFileAsync().AsTask().ContinueWith( fileTask => { this.storageFile = fileTask.Result; }); #endif return task; }
private void BtnBrowse_OnClick(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".gif"); picker.ContinuationData["context"] = "addGifImage"; picker.PickSingleFileAndContinue(); }
private async Task sendFile(string peer) { selectedPeer = peer; FileOpenPicker picker = new FileOpenPicker(); picker.SuggestedStartLocation = PickerLocationId.Downloads; picker.FileTypeFilter.Add("*"); picker.PickSingleFileAndContinue(); }
private void Button_SelectFile_Click(object sender, EventArgs e) { FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".txt"); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; picker.PickSingleFileAndContinue(); }
protected async void UploadFile() { FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.PickSingleFileAndContinue(); }
private void newProjectButton_Click(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker() { ViewMode = PickerViewMode.Thumbnail, CommitButtonText = "Select framing image", SuggestedStartLocation = PickerLocationId.PicturesLibrary, }; picker.FileTypeFilter.Add(".jpg"); picker.PickSingleFileAndContinue(); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> #if WINDOWS_PHONE_APP private void ShowFileOpen(CompressAlgorithm? Algorithm) { var picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); picker.ContinuationData["Operation"] = "CompressFile"; picker.ContinuationData["CompressAlgorithm"] = Algorithm.ToString(); picker.PickSingleFileAndContinue(); }
private void PickAFileButton_Click(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".mp4"); openPicker.FileTypeFilter.Add(".wmv"); openPicker.FileTypeFilter.Add(".avi"); // Launch file open picker and caller app is suspended and may be terminated if required openPicker.PickSingleFileAndContinue(); }
private void LaunchPicker() { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); // Launch file open picker and caller app is suspended and may be terminated if required openPicker.PickSingleFileAndContinue(); }
public void CreateSoundFromMediaLibrary(Sprite sprite) { var openPicker = new FileOpenPicker { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.MusicLibrary }; foreach (var extension in SupportedFileTypes) openPicker.FileTypeFilter.Add(extension); openPicker.PickSingleFileAndContinue(); }
private async void PickFileForDemoClick(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker() { FileTypeFilter = { ".txt" }, SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #elif WINDOWS_APP fileToUse = await picker.PickSingleFileAsync(); #endif }
private void PickAFileButton_Click(object sender, RoutedEventArgs e) { // Clear previous returned file name, if it exists, between iterations of this scenario OutputTextBlock.Text = ""; FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); // Launch file open picker and caller app is suspended and may be terminated if required openPicker.PickSingleFileAndContinue(); }
private void PickFileButton_Click(object sender, RoutedEventArgs e) { // Clear previous returned file content, if it exists, between iterations of this scenario OutputFileName.Text = ""; OutputFileContent.Text = ""; rootPage.NotifyUser("", NotifyType.StatusMessage); Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Clear(); fileToken = string.Empty; FileOpenPicker openPicker = new FileOpenPicker(); openPicker.FileTypeFilter.Add(".txt"); openPicker.PickSingleFileAndContinue(); }
private void OpenFile() { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary; openPicker.FileTypeFilter.Add(".mp4"); openPicker.FileTypeFilter.Add(".wmv"); openPicker.PickSingleFileAndContinue(); // TODO: receive choice on app reactivation. //var file = await openPicker.PickSingleFileAsync(); //if (file != null) //{ // var fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); // player.SetSource(fileStream, file.FileType); //} }
private void AddImageClick(object sender, RoutedEventArgs e) { FileOpenPicker fileopenpicker = new FileOpenPicker(); fileopenpicker.ViewMode = PickerViewMode.Thumbnail; // Mở ở thư mục thư viện hình ảnh fileopenpicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; // Fill chỉ nhận file ảnh fileopenpicker.FileTypeFilter.Add(".jpg"); fileopenpicker.FileTypeFilter.Add(".jpeg"); fileopenpicker.FileTypeFilter.Add(".png"); //// Pick One fileopenpicker.PickSingleFileAndContinue(); }
private async void AddFileClick(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker() { FileTypeFilter = { "*" }, SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; #if WINDOWS_APP var file = await picker.PickSingleFileAsync(); StorageApplicationPermissions.FutureAccessList.Add(file); await ListPermissions(); #elif WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #endif }
private async void LoadFileButtonClick(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, CommitButtonText = "All done", SuggestedStartLocation = PickerLocationId.PicturesLibrary, FileTypeFilter = { ".jpg", ".jpeg", ".png", ".bmp" } }; #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #elif WINDOWS_APP StorageFile file = await picker.PickSingleFileAsync(); DisplayFileName(file); #endif }
private void Button_Click(object sender, RoutedEventArgs e) { ImagePath = string.Empty; FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; // Filter to include a sample subset of file types filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".bmp"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
private void SelectWallpaperButton_Click(object sender, RoutedEventArgs e) { FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; // Filter to include a sample subset of file types filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".bmp"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); CoreApplication.GetCurrentView().Activated += SettingsPage_Activated; filePicker.PickSingleFileAndContinue(); }
private void OnAddSoundTap(object sender, System.Windows.Input.GestureEventArgs e) { e.Handled = true; var ImagePath = string.Empty; FileOpenPicker filePicker = new FileOpenPicker(); filePicker.ViewMode = PickerViewMode.List; // Filter to include a sample subset of file types filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".wav"); filePicker.FileTypeFilter.Add(".mp3"); filePicker.FileTypeFilter.Add(".wma"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
private async void PickImage_Click(object sender, RoutedEventArgs e) #endif { FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); picker.FileTypeFilter.Add(".gif"); picker.CommitButtonText = "Copy"; #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #else StorageFile file = await picker.PickSingleFileAsync(); await CopyImageToLocalFolderAsync(file); #endif }
private void ButtonSendAttachmentsEmail_OnClick(object sender, RoutedEventArgs e) { // NOTE: The calling app will be suspended and re-activated once the user has selected // a photo. To handle the selection of the photo, implement the IFileOpenPickerContinuable // on the Page that launched the SelectPicture call (see DeviceTaskApp for sample code) var openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); // Launch file open picker and caller app is suspended // and may be terminated if required openPicker.PickSingleFileAndContinue(); }
private void book_Click(object sender, RoutedEventArgs e) { /*var picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".pdf"); picker.ContinuationData["Operation"] = "UpdateProfilePicture";*/ //picker.PickSingleFileAndContinue(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; openPicker.FileTypeFilter.Add(".doc"); openPicker.FileTypeFilter.Add(".docx"); openPicker.ContinuationData["Operation"] = "UpdateProfilePicture"; // Launch file open picker and caller app is suspended and may be terminated if required openPicker.PickSingleFileAndContinue(); //System.Windows.Controls.OpenFileDialog dialog = new System.Windows.Controls.OpenFileDialog(); //System.Windows.Forms dlg = new OpenFileDialog(); }
private async void OnOpenClick(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker(); picker.ViewMode = PickerViewMode.List; picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; picker.FileTypeFilter.Add(".svg"); #if WINDOWS_PHONE_APP picker.ContinuationData["operation"] = MainPageOperation.Open.ToString(); picker.PickSingleFileAndContinue(); #else var file = await picker.PickSingleFileAsync(); if (file != null) { this.PathTextBox.Text = file.Path; this.InitializeAsync(file); } #endif }
public async override void Execute(object parameter) { if (parameter is StorageFile) { OpenSubtitleFile((StorageFile)parameter); } else { String error; try { App.OpenFilePickerReason = OpenFilePickerReason.OnOpeningSubtitle; var picker = new FileOpenPicker { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.VideosLibrary }; picker.FileTypeFilter.Add(".srt"); picker.FileTypeFilter.Add(".ass"); #if WINDOWS_APP StorageFile file = await picker.PickSingleFileAsync(); if (file != null) { OpenSubtitleFile(file); } else { LogHelper.Log("Cancelled Opening subtitle"); } App.OpenFilePickerReason = OpenFilePickerReason.Null; #else picker.PickSingleFileAndContinue(); #endif return; } catch (Exception exception) { error = exception.ToString(); } var dialog = new MessageDialog(error); await dialog.ShowAsync(); } }
private async void PickImage_Click(object sender, RoutedEventArgs e) #endif { FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); picker.FileTypeFilter.Add(".gif"); picker.CommitButtonText = "Copy"; #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #else StorageFile file = await picker.PickSingleFileAsync(); await CopyImageToLocalFolderAsync(file); #endif }
public async void birinciresim_Click(object sender, RoutedEventArgs e) { try { type = 1; FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); view = CoreApplication.GetCurrentView(); #if WINDOWS_PHONE_APP view.Activated += SoruEkle_Activated; openPicker.PickSingleFileAndContinue(); #else resimfile1 = await openPicker.PickSingleFileAsync(); #endif } catch (Exception ex) { await App.APIService.Log("Birinci Resim Seçim Hatası. Detaylar: " + ex.Message); } }