當前位置: 首頁>>代碼示例>>C#>>正文


C# FileOpenPicker.PickSingleFileAndContinue方法代碼示例

本文整理匯總了C#中Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAndContinue方法的典型用法代碼示例。如果您正苦於以下問題:C# FileOpenPicker.PickSingleFileAndContinue方法的具體用法?C# FileOpenPicker.PickSingleFileAndContinue怎麽用?C# FileOpenPicker.PickSingleFileAndContinue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.Storage.Pickers.FileOpenPicker的用法示例。


在下文中一共展示了FileOpenPicker.PickSingleFileAndContinue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LaunchFileSelectionServiceAsync

        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;
        }
開發者ID:AnatoliyKapustin,項目名稱:Practice_DigitalCloudTechnologies,代碼行數:25,代碼來源:FileSelectionService.cs

示例2: Execute

        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 { }
        }
開發者ID:robUx4,項目名稱:vlc-winrt,代碼行數:33,代碼來源:PickVideoCommand.cs

示例3: Button_Click

        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);
                }
            }
        }
開發者ID:valaypatel,項目名稱:aerogear-windows-oauth2,代碼行數:32,代碼來源:MainPage.xaml.cs

示例4: Execute

        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
        }
開發者ID:robUx4,項目名稱:vlc-winrt,代碼行數:34,代碼來源:ChangeAlbumArtCommand.cs

示例5: Image_Tapped

 private void Image_Tapped(object sender, TappedRoutedEventArgs e)
 {
     FileOpenPicker openPicker = new FileOpenPicker();
     openPicker.FileTypeFilter.Add(".jpg");
     openPicker.ContinuationData["Operation"] = "Image";
     openPicker.PickSingleFileAndContinue();
 }
開發者ID:x01673,項目名稱:BCMeng_Project,代碼行數:7,代碼來源:NewOrEditView.xaml.cs

示例6: BtnBrowse_OnClick

 private void BtnBrowse_OnClick(object sender, RoutedEventArgs e)
 {
     var picker = new FileOpenPicker();
     picker.FileTypeFilter.Add(".gif");
     picker.ContinuationData["context"] = "addGifImage";
     picker.PickSingleFileAndContinue();
 }
開發者ID:thomaslevesque,項目名稱:XamlAnimatedGif,代碼行數:7,代碼來源:GifTestPage.xaml.cs

示例7: sendFile

 private async Task sendFile(string peer)
 {
     selectedPeer = peer;
     FileOpenPicker picker = new FileOpenPicker();
     picker.SuggestedStartLocation = PickerLocationId.Downloads;
     picker.FileTypeFilter.Add("*");
     picker.PickSingleFileAndContinue();
 }
開發者ID:nidzo732,項目名稱:FileTransfer,代碼行數:8,代碼來源:MainPage.xaml.cs

示例8: UploadFile

        protected async void UploadFile()
        {
            FileOpenPicker filePicker = new FileOpenPicker();

            filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

            filePicker.PickSingleFileAndContinue();
        }
開發者ID:flashwave,項目名稱:puush-wp,代碼行數:8,代碼來源:MainPage.xaml.cs

示例9: Button_SelectFile_Click

		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();
		}
開發者ID:crazymouse0,項目名稱:iReader,代碼行數:8,代碼來源:StartPage.xaml.cs

示例10: ShowFileOpen

        /// <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();
        }
開發者ID:COMIsLove,項目名稱:Windows-universal-samples,代碼行數:19,代碼來源:Scenario1.xaml.cs

示例11: newProjectButton_Click

 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();
 }
開發者ID:mooso,項目名稱:Composographer,代碼行數:11,代碼來源:MainPage.xaml.cs

示例12: LaunchPicker

        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();
        }
開發者ID:trilok567,項目名稱:Windows-Phone,代碼行數:12,代碼來源:LoadPhoto.xaml.cs

示例13: PickAFileButton_Click

        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();
        }
開發者ID:jm991,項目名稱:Helios,代碼行數:12,代碼來源:MainPage.xaml.cs

示例14: CreateSoundFromMediaLibrary

        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();
        }
開發者ID:Catrobat,項目名稱:CatrobatForWindows,代碼行數:13,代碼來源:SoundServiceWindowsShared.cs

示例15: PickFileForDemoClick

        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
        }
開發者ID:luiseduardohdbackup,項目名稱:Windows-Universal,代碼行數:14,代碼來源:MainPage.xaml.cs


注:本文中的Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAndContinue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。