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


C# FileSavePicker.PickSaveFileAndContinue方法代碼示例

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


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

示例1: TrySaveAudio

        private void TrySaveAudio(string audioFileName)
        {
            var picker = new FileSavePicker();
            picker.ContinuationData.Add("OriginalFileName", audioFileName);
            picker.FileTypeChoices["Audio files"] = new List<string> { ".wav" };
            picker.SuggestedFileName = Path.GetFileNameWithoutExtension(audioFileName);
            picker.DefaultFileExtension = ".wav";
            picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

            picker.PickSaveFileAndContinue();
        }
開發者ID:khmylov,項目名稱:talk-windows-phone-sharing,代碼行數:11,代碼來源:MainPage.xaml.cs

示例2: SaveFileButton_Click

        private void SaveFileButton_Click(object sender, RoutedEventArgs e)
        {
            // Clear previous returned file name, if it exists, between iterations of this scenario
            OutputTextBlock.Text = "";

            FileSavePicker savePicker = new FileSavePicker();
            savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = "New Document";

            savePicker.PickSaveFileAndContinue();
        }
開發者ID:badreddine-dlaila,項目名稱:Windows-8.1-Universal-App,代碼行數:14,代碼來源:Scenario4_SaveFile.xaml.cs

示例3: ExportMenuFlyoutItem_Click

        private async void ExportMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            var timetable = (TimetableDescription)((FrameworkElement)sender).DataContext;
            if (timetable.FileName == App.Timetable.FileName)
                await TimetableIO.SaveTimetable(App.Timetable);

            var picker = new FileSavePicker();

            string invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));
            string invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars);

            picker.SuggestedFileName = System.Text.RegularExpressions.Regex.Replace(timetable.Name, invalidRegStr, "_");
            picker.FileTypeChoices.Add("XML", new List<string>() { ".xml" });

            picker.ContinuationData.Add("FileName", timetable.FileName);
            picker.PickSaveFileAndContinue();
        }
開發者ID:JulianMH,項目名稱:ModernTimetable,代碼行數:17,代碼來源:SelectTimetablePage.xaml.cs

示例4: BackupButton_Click

        private void BackupButton_Click(object sender, RoutedEventArgs e)
        {
            if (App.Locator.Download.ActiveDownloads.Count > 0)
            {
                CurtainPrompt.ShowError("Can't do a backup while there are active downloads.");
                return;
            }

            var savePicker = new FileSavePicker { SuggestedStartLocation = PickerLocationId.DocumentsLibrary };

            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("Audiotica Backup", new List<string> { ".autcp" });

            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = string.Format("{0}-WP81", DateTime.Now.ToString("MM-dd-yy_H.mm"));

            savePicker.PickSaveFileAndContinue();
        }
開發者ID:jayharry28,項目名稱:Audiotica,代碼行數:18,代碼來源:CollectionSettingsPage.xaml.cs

示例5: SaveToFileButton

        private async void SaveToFileButton(object sender, RoutedEventArgs e)
        {
            FileSavePicker savePicker = new FileSavePicker()
            {
                SuggestedFileName = string.Format("TextDocument-{0}", DateTime.Now.ToString("dd-MMM-yyyy")),
                FileTypeChoices =
                {
                    { "Plain text", new List<string>{ ".txt" }},
                    { "Web Page", new List<string>{ ".html", ".htm" }}
                },
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
                CommitButtonText = "Save my text document"
            };

#if WINDOWS_APP
            StorageFile saveFile = await savePicker.PickSaveFileAsync();
            await SaveTextFile(saveFile);
#elif WINDOWS_PHONE_APP
            savePicker.PickSaveFileAndContinue();
#endif
        }
開發者ID:luiseduardohdbackup,項目名稱:Windows-Universal,代碼行數:21,代碼來源:MainPage.xaml.cs

示例6: saveFile

 public void saveFile(string fileName, byte[] fileContents)
 {
     FileSavePicker picker = new FileSavePicker();
     picker.SuggestedStartLocation = PickerLocationId.Downloads;
     string extension, name;
     extension = name = "";
     for (int i = fileName.Length - 1; i >= 0; i--)
     {
         if (fileName[i] == '.')
         {
             extension = fileName.Substring(i);
             name = fileName.Substring(0, i);
             break;
         }
     }
     if (extension == ".") extension += "noex";
     if (extension == "") extension = ".noex";
     if (name == "") name = fileName;
     picker.FileTypeChoices.Add("Downloaded file", new List<string>() { extension });
     picker.SuggestedFileName = name;
     fileContentsToWrite = fileContents;
     picker.PickSaveFileAndContinue();
 }
開發者ID:nidzo732,項目名稱:FileTransfer,代碼行數:23,代碼來源:MainPage.xaml.cs

示例7: OnSaveClick

		private async void OnSaveClick(object sender, RoutedEventArgs e)
		{
			var picker = new FileSavePicker();
			picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
			picker.DefaultFileExtension = ".png";
			picker.FileTypeChoices.Add(new KeyValuePair<string, IList<string>>("Bitmap image", new[] { ".bmp" }.ToList()));
			picker.FileTypeChoices.Add(new KeyValuePair<string, IList<string>>("Png image", new[] { ".png" }.ToList()));
			picker.FileTypeChoices.Add(new KeyValuePair<string, IList<string>>("Jpeg image", new[] { ".jpg", ".jpe", ".jpeg" }.ToList()));
			picker.FileTypeChoices.Add(new KeyValuePair<string, IList<string>>("Gif image", new[] { ".gif" }.ToList()));

#if WINDOWS_PHONE_APP
			picker.ContinuationData["operation"] = MainPageOperation.Save.ToString();
			picker.PickSaveFileAndContinue();
#else
			var file = await picker.PickSaveFileAsync();
			if (file != null)
			{
				this.OnSave(file);
			}
#endif
		}
開發者ID:lallous,項目名稱:SvgForXaml,代碼行數:21,代碼來源:MainPage.xaml.cs

示例8: SaveAsync

        public async Task SaveAsync(IStorageFile file)
        {
            var picker = new FileSavePicker
            {
                SuggestedFileName = file.Name,
            };

            var extension = Path.GetExtension(file.Name);
            if (string.IsNullOrEmpty(extension))
                extension = ".unknown";

            picker.FileTypeChoices.Add("Attachment File",
                new List<string> {extension});


#if WINDOWS_PHONE_APP
            picker.ContinuationData.Add("Source", file.Path);
            picker.PickSaveFileAndContinue();
#else
            var target = await picker.PickSaveFileAsync();
            await Continue(FilePickTargets.Attachments, file, target);
#endif
        }
開發者ID:Confuset,項目名稱:7Pass-Remake,代碼行數:23,代碼來源:FilePickerService.cs

示例9: SaveFileAsync

		private Task<StorageFile> SaveFileAsync(IRandomAccessStream stream)
		{
			// See http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn614994.aspx
			// For ContinuationManager complete implementation.
			// A smaller version of this is also available in the sample and in the App.xaml.cs.
			var tcs = new TaskCompletionSource<StorageFile>();
			EventHandler<FileSavePickerContinuationEventArgs> fileSavedHandler = null;
			fileSavedHandler = (s, e) =>
			{
				ContinuationManager.Current.FilePickerSaved -= fileSavedHandler;
				var file = e.File;
				if (file == null)
					tcs.TrySetCanceled();
				else
					tcs.TrySetResult(file);
			};

			ContinuationManager.Current.FilePickerSaved += fileSavedHandler;

			FileSavePicker filePicker = new FileSavePicker();
			filePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
			filePicker.FileTypeChoices.Add("ZIP", new List<string>() { ".zip" });
			filePicker.DefaultFileExtension = ".zip";
			filePicker.SuggestedFileName = "Output";
			filePicker.PickSaveFileAndContinue();
			return tcs.Task;
		}
開發者ID:jmiller121,項目名稱:arcgis-runtime-samples-dotnet,代碼行數:27,代碼來源:ExtractData.xaml.cs

示例10: exportButton_Click

        private void exportButton_Click(object sender, RoutedEventArgs e)
        {
            exportDatabase = true;

            FileSavePicker picker = new FileSavePicker();
            picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            picker.ContinuationData["Operation"] = "ExportDatabase";
            picker.FileTypeChoices.Add("TextFile", new List<string>() { ".txt" });

            String time = DateTime.Now.ToString();
            time = time.Replace(' ', '_');
            time = time.Replace(":", "");
            time = time.Replace(".", "");

            String fileName = "NihongoSenpaiExport_" + time;

            picker.SuggestedFileName = fileName;
            picker.PickSaveFileAndContinue();
        }
開發者ID:deadkitty,項目名稱:Mobile-Computing,代碼行數:19,代碼來源:MainPage.xaml.cs

示例11: SaveAs_Click

        private async void SaveAs_Click(object sender, RoutedEventArgs e)
#endif
        {
            FileSavePicker picker = new FileSavePicker();
            picker.FileTypeChoices.Add("JPEG image", new string[] { ".jpg" });
            picker.FileTypeChoices.Add("PNG image", new string[] { ".png" });
            picker.FileTypeChoices.Add("BMP image", new string[] { ".bmp" });
            picker.DefaultFileExtension = ".png";
            picker.SuggestedFileName = "Output file";
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

// On Windows Phone, after the picker is launched the app is closed.
#if WINDOWS_PHONE_APP
            picker.PickSaveFileAndContinue();
#else
            var file = await picker.PickSaveFileAsync();
            if (file != null)
            {
                await LoadSaveFileAsync(file);
            }
#endif
        }
開發者ID:ckc,項目名稱:WinApp,代碼行數:22,代碼來源:Scenario2_ImageTransforms.xaml.cs

示例12: SaveImage

 private void SaveImage(FileSavePicker savePicker)
 {
     savePicker.PickSaveFileAndContinue();
 }
開發者ID:ruiapmoraes,項目名稱:lumia-imaging-quickstart,代碼行數:4,代碼來源:MainPage.WindowsPhone.cs

示例13: StartSavePhotoFile

        private void StartSavePhotoFile()
        {
            var filenameFormat = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("PhotoSaveFilenameFormat");
            var filename = String.Format(filenameFormat, DateTime.Now.ToString("yyyyMMddHHmmss"));

            var picker = new FileSavePicker();
            picker.SuggestedFileName = filename;
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            picker.FileTypeChoices.Add(".jpg", new List<string>() { ".jpg" });
            picker.ContinuationData["Operation"] = "SavePhotoFile";
            picker.PickSaveFileAndContinue();

            App.ContinuationEventArgsChanged += App_ContinuationEventArgsChanged;
        }
開發者ID:roachhd,項目名稱:filter-explorer,代碼行數:14,代碼來源:PhotoPageViewModel.cs

示例14: AppBarBtnSave_Click

        ///////////////////////////////////////////////////////////////////////////
        // Use the FileSavePicker to save the photo with the selected file name

        private void AppBarBtnSave_Click(object sender, RoutedEventArgs e)
        {
            var fsp = new FileSavePicker
            {
                DefaultFileExtension = ".jpg",
                SuggestedFileName = "editedPhoto.jpg",
                SuggestedStartLocation = PickerLocationId.PicturesLibrary,
            };
            fsp.FileTypeChoices.Add("JPEG", new List<string> { ".jpg" });
            fsp.PickSaveFileAndContinue();
        }
開發者ID:lorenzofar,項目名稱:SLI,代碼行數:14,代碼來源:Interpret.xaml.cs

示例15: SaveTweaksButton_Click

 private void SaveTweaksButton_Click(object sender, EventArgs e)
 {
     var savePicker = new FileSavePicker()
     {
         DefaultFileExtension = ".xml",
         SuggestedFileName = "Tweaks.xml",
     };
     savePicker.FileTypeChoices.Add("XML file", new List<string>() { ".xml" });
     savePicker.PickSaveFileAndContinue();
 }
開發者ID:kwanice,項目名稱:Tweaks,代碼行數:10,代碼來源:MainPage.xaml.cs


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