private async Task DownloadPdfFileAsync()
{
var filePath = Path.Combine(FileSystem .AppDataDirectory, "CifradoEnRedes_122017.pdf");
if (File.Exists(filePath))
{
return filePath;
}
var httpClient = new HttpClient();
var pdfBytes = await httpClient.GetByteArrayAsync("https://1drv.ms/b/s!AtMYJuNNyNicilx0lIqs4Za0F9UA?e=T8uc1V");
try
{
File.WriteAllBytes(filePath, pdfBytes);
return filePath;
}
catch (Exception ex)
{
await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "Ok");
}
return null;
}
private async void Btn2Click(object sender, EventArgs e)
{
App.MasterDet.IsPresented =false;
await App.MasterDet.Detail.Navigation.PushAsync(new DISPERSION());
var filePath = await DownloadPdfFileAsync();
if (filePath != null)
{
await Launcher.OpenAsync(new OpenFileRequest
{
File = new ReadOnlyFile(filePath)
});
}
}