Skip to content

Instantly share code, notes, and snippets.

@framinosona
Created September 16, 2016 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save framinosona/3f28dacf0db01bf596aea87af87d1a1b to your computer and use it in GitHub Desktop.
Save framinosona/3f28dacf0db01bf596aea87af87d1a1b to your computer and use it in GitHub Desktop.
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
Debug.WriteLine("Debut");
var file = await SaveAsync(new Uri("Ton ZIP"));
Debug.WriteLine($"Downloaded : {file.Path}");
}
public static async Task<StorageFile> SaveAsync(
Uri fileUri)
{
var fileSavePicker = new FileSavePicker();
fileSavePicker.DefaultFileExtension = ".zip";
fileSavePicker.FileTypeChoices.Add(".zip Archive", new List<string> { ".zip" });
fileSavePicker.SuggestedFileName = "Archive.zip";
var outputFile = await fileSavePicker.PickSaveFileAsync();
var downloader = new BackgroundDownloader();
var download = downloader.CreateDownload(
fileUri,
outputFile);
var res = await download.StartAsync();
return outputFile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment