public async void OpenFilePicker(FileType fileType) { FileOpenPicker openPicker = new FileOpenPicker(); switch (fileType) { case FileType.all: openPicker.ViewMode = PickerViewMode.List; openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; openPicker.FileTypeFilter.Add("*"); break; case FileType.pic: openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); break; case FileType.audio: openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; openPicker.FileTypeFilter.Add(".mp3"); openPicker.FileTypeFilter.Add(".wma"); openPicker.FileTypeFilter.Add(".wav"); break; case FileType.video: openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary; openPicker.FileTypeFilter.Add(".mp4"); openPicker.FileTypeFilter.Add(".wmv"); openPicker.FileTypeFilter.Add(".avi"); break; } #if !WINDOWS_PHONE_APP this.File = await openPicker.PickSingleFileAsync(); if (this.FilePickerFinish != null) { this.FilePickerFinish(this.File, null); } #else openPicker.PickSingleFileAndContinue(); #endif }
private void AddPhoto_OnClick(object sender, RoutedEventArgs e) { var filePicker = new FileOpenPicker { SuggestedStartLocation = PickerLocationId.PicturesLibrary, ViewMode = PickerViewMode.Thumbnail }; 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 selectPhoto_click() { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); // Sets Frame to OptionsProxy PAge if (!ScenarioFrame.Navigate(typeof(WindowsApp.Views.OptionsProxy))) { throw new Exception("Failed to create scenario list"); } openPicker.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 void btnSelect_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"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
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(); }
public FeedBack() { this.InitializeComponent(); //九幽的第三方登陆 NavigationCacheMode = NavigationCacheMode.Required; JyUserInfoManager.LogincompletedEvent += JyUserInfoManager_LoginCompleted; JyFeedbackControl.FeedbackImageRequested += delegate { var fileOpenPicker = new FileOpenPicker(); fileOpenPicker.FileTypeFilter.Add(".png"); fileOpenPicker.FileTypeFilter.Add(".jpg"); fileOpenPicker.PickSingleFileAndContinue(); }; }
/***********************/ public void PickAnImage() { CoreApplicationView view = CoreApplication.GetCurrentView(); ImagePath = string.Empty; FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".mp3"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
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 select() { 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 btnPhoto_Click(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); #if WINDOWS_APP StorageFile file = await openPicker.PickSingleFileAsync(); FileOpenPicker_Continuation(file); #elif WINDOWS_PHONE_APP // Call the FileOpenPicker in Windows Phone mode openPicker.PickSingleFileAndContinue(); #endif }
/// <summary> /// Shows the file picker UI. /// </summary> /// <param name="target">The target for the file.</param> public async Task PickAsync(FilePickTargets target) { var picker = new FileOpenPicker { ViewMode = PickerViewMode.List, }; picker.FileTypeFilter.Add("*"); #if WINDOWS_PHONE_APP picker.ContinuationData.Add( "Target", target.ToString()); picker.PickSingleFileAndContinue(); #else var file = await picker.PickSingleFileAsync(); await Continue(target, file); #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 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(); }
public async void Open() { try { FileOpenPicker picker = new FileOpenPicker(); picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".rtf"); #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); await Task.Delay(0); #else read(await picker.PickSingleFileAsync()); #endif } catch { } }
public void OpenVideo() { IsOpen = false; Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), async() => { #if WP81 if (_contactEnabled) { ((App)Application.Current).ChooseFileInfo = new ChooseFileInfo(DateTime.Now); var fileOpenPicker = new FileOpenPicker(); fileOpenPicker.ViewMode = PickerViewMode.Thumbnail; fileOpenPicker.FileTypeFilter.Add(".wmv"); fileOpenPicker.FileTypeFilter.Add(".mp4"); fileOpenPicker.FileTypeFilter.Add(".avi"); fileOpenPicker.ContinuationData.Add("From", "DialogDetailsView"); fileOpenPicker.ContinuationData.Add("Type", "Video"); if (Environment.OSVersion.Version.Major >= 10) { var result = await fileOpenPicker.PickSingleFileAsync(); if (result != null) { Execute.BeginOnThreadPool(() => { _sendVideoAction.SafeInvoke(result); }); } } else { fileOpenPicker.PickSingleFileAndContinue(); } } else { _navigationService.UriFor <VideoCaptureViewModel>().Navigate(); } #else _navigationService.UriFor <VideoCaptureViewModel>().Navigate(); #endif }); }
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 AppBarBtnChoose_Click(object sender, RoutedEventArgs e) { desc.Visibility = Visibility.Collapsed; AppBarBtnSpeech.Visibility = Visibility.Collapsed; tb.Visibility = Visibility.Collapsed; //// Shortpath to get first file from Camera Roll. Useful for development. //var files = await KnownFolders.CameraRoll.GetFilesAsync(); //OnFilesOpenPicked(new ReadOnlyCollection<StorageFile>(new List<StorageFile> { files.FirstOrDefault() })); //return; // Pick photo or take new one var fop = new FileOpenPicker(); foreach (var fileType in SupportedImageFileTypes) { fop.FileTypeFilter.Add(fileType); } fop.PickSingleFileAndContinue(); }
private void OnOpenSubtitlePicker() { //재생 정지 Me.Pause(); FileOpenPicker picker = new FileOpenPicker() { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.VideosLibrary }; foreach (var suffix in CCPlayerConstant.SUBTITLE_FILE_SUFFIX) { picker.FileTypeFilter.Add(suffix); } picker.ContinuationData.Add(ContinuationManager.SOURCE_VIEW_MODEL_TYPE_FULL_NAME, this.GetType().FullName); picker.PickSingleFileAndContinue(); }
private void SelectButton_Click(object sender, RoutedEventArgs e) { CoreApplicationView view = CoreApplication.GetCurrentView(); FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".bmp"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
public void OpenDocument() { IsOpen = false; Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () => { CheckDisabledFeature(_with, Constants.FeaturePMUploadDocument, Constants.FeatureChatUploadDocument, Constants.FeatureBigChatUploadDocument, () => { #if WP81 if (_contactEnabled) { ((App)Application.Current).ChooseFileInfo = new ChooseFileInfo(DateTime.Now); var fileOpenPicker = new FileOpenPicker(); fileOpenPicker.FileTypeFilter.Add("*"); fileOpenPicker.ContinuationData.Add("From", "DialogDetailsView"); fileOpenPicker.ContinuationData.Add("Type", "Document"); fileOpenPicker.PickSingleFileAndContinue(); } else { ((App)Application.Current).ChooseFileInfo = new ChooseFileInfo(DateTime.Now); var fileOpenPicker = new FileOpenPicker(); fileOpenPicker.FileTypeFilter.Add("*"); fileOpenPicker.ContinuationData.Add("From", "SecretDialogDetailsView"); fileOpenPicker.ContinuationData.Add("Type", "Document"); fileOpenPicker.PickSingleFileAndContinue(); } #else ((App)Application.Current).ChooseFileInfo = new ChooseFileInfo(DateTime.Now); var task = new PhotoChooserTask { ShowCamera = true }; task.Completed += (o, e) => Handle(_stateService, e.ChosenPhoto, e.OriginalFileName); task.Show(); #endif }); }); }
private void PickPhotos(bool single) { var picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); picker.FileTypeFilter.Add(".gif"); picker.FileTypeFilter.Add(".bmp"); if (single) { picker.ContinuationData[Continuation_Key_Operation] = Continuation_HomePage_PickPhotoSingle; picker.PickSingleFileAndContinue(); } else { picker.ContinuationData[Continuation_Key_Operation] = Continuation_HomePage_PickPhotoMulti; picker.PickMultipleFilesAndContinue(); } }
private async void LoadImage() { view = CoreApplication.GetCurrentView(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.ViewMode = PickerViewMode.Thumbnail; // Dateitypen filtern openPicker.FileTypeFilter.Clear(); openPicker.FileTypeFilter.Add(".bmp"); openPicker.FileTypeFilter.Add(".png"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".jpg"); // Filepicker starten openPicker.PickSingleFileAndContinue(); view.Activated += viewActivated; }
/// <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. /// This parameter is typically used to configure the page.</param> private void Camera_Click(object sender, RoutedEventArgs e) { try { 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(); } catch { Debug.WriteLine("enable to open file picker"); Frame.Navigate(typeof(Assistant)); } }
private void addAudio_Click(object sender, EventArgs e) { FileOpenPicker fileOpenPicker = new FileOpenPicker(); List <string> .Enumerator enumerator = VKConstants.SupportedAudioExtensions.GetEnumerator(); try { while (enumerator.MoveNext()) { string current = enumerator.Current; fileOpenPicker.FileTypeFilter.Add(current); } } finally { enumerator.Dispose(); } ((IDictionary <string, object>)fileOpenPicker.ContinuationData)["Operation"] = "AudioFromPhone"; fileOpenPicker.PickSingleFileAndContinue(); }
private async void OpenFile_Click(object sender, RoutedEventArgs e) #endif { // Select a file var picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".mp4"); picker.FileTypeFilter.Add(".wmv"); picker.SuggestedStartLocation = PickerLocationId.VideosLibrary; picker.ViewMode = PickerViewMode.Thumbnail; #if WINDOWS_PHONE_APP picker.PickSingleFileAndContinue(); #else var file = await picker.PickSingleFileAsync(); if (file != null) { await OpenFileAsync(file); } #endif }
public async override void Execute(object parameter) { 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) { string mru = StorageApplicationPermissions.FutureAccessList.Add(file); string mrl = "winrt://" + mru; Locator.MediaPlaybackViewModel.OpenSubtitle(mrl); } 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 ProfileResimGuncelle_Click(object sender, RoutedEventArgs e) { try { await Mesaj.Soru("Profil Resminizi Güncellemek İstiyor Musunuz?", async (sndr) => { view = CoreApplication.GetCurrentView(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); #if WINDOWS_PHONE_APP view.Activated += SoruDetay_Activated; DeviceType = 1; openPicker.PickSingleFileAndContinue(); #else DeviceType = 2; file = await openPicker.PickSingleFileAsync(); #endif if (DeviceType == 2 && file != null) { var data = await FileHelper.ReadFile(file); var result = await App.APIService.ResimGuncelle(data, file.Name); if (result != null) { await Mesaj.MesajGoster("Dosya seçilirken hata oluştu"); } } else if (DeviceType == 2) { await Mesaj.MesajGoster("Dosya seçilirken hata oluştu"); } }); } catch (Exception ex) { await App.APIService.Log("Profil Resim Güncelleme Hatası. Detaylar: " + ex.Message); } }
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 MainPage() { //在需要检查更新的页面的构造函数里实例化更新控件 showUpdateInofControl = new JYUpdateSDK.View.ShowUpdateInfoControl(); this.InitializeComponent(); //九幽的第三方登陆 NavigationCacheMode = NavigationCacheMode.Required; JyUserInfoManager.LogincompletedEvent += JyUserInfoManager_LoginCompleted; JyFeedbackControl.FeedbackImageRequested += delegate { var fileOpenPicker = new FileOpenPicker(); fileOpenPicker.FileTypeFilter.Add(".png"); fileOpenPicker.FileTypeFilter.Add(".jpg"); fileOpenPicker.PickSingleFileAndContinue(); }; }
private void OpenFiles( OpenFileInteraction interaction ) { Contract.Requires( interaction != null ); var saveButton = interaction.DefaultCommand; var dialog = new FileOpenPicker(); dialog.ContinuationData.AddRange( interaction.ContinuationData ); dialog.FileTypeFilter.AddRange( interaction.FileTypeFilter.FixUpExtensions() ); dialog.SuggestedStartLocation = SuggestedStartLocation; dialog.ViewMode = ViewMode; if ( !string.IsNullOrEmpty( SettingsIdentifier ) ) dialog.SettingsIdentifier = SettingsIdentifier; if ( saveButton != null ) dialog.CommitButtonText = saveButton.Name; if ( interaction.Multiselect ) dialog.PickMultipleFilesAndContinue(); else dialog.PickSingleFileAndContinue(); }
private void Load_Click(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker() { SuggestedStartLocation = PickerLocationId.PicturesLibrary, FileTypeFilter = { ".jpg", ".jpeg", ".png" }, }; picker.PickSingleFileAndContinue(); }