本文整理汇总了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;
}
示例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 { }
}
示例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);
}
}
}
示例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
}
示例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();
}
示例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();
}
示例7: sendFile
private async Task sendFile(string peer)
{
selectedPeer = peer;
FileOpenPicker picker = new FileOpenPicker();
picker.SuggestedStartLocation = PickerLocationId.Downloads;
picker.FileTypeFilter.Add("*");
picker.PickSingleFileAndContinue();
}
示例8: UploadFile
protected async void UploadFile()
{
FileOpenPicker filePicker = new FileOpenPicker();
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
filePicker.PickSingleFileAndContinue();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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
}