本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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
}
示例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();
}
示例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
}
示例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
}
示例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;
}
示例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();
}
示例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
}
示例12: SaveImage
private void SaveImage(FileSavePicker savePicker)
{
savePicker.PickSaveFileAndContinue();
}
示例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;
}
示例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();
}
示例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();
}