Esempio n. 1
0
        private async void MenuFlyoutItem_Download(object sender, RoutedEventArgs e)
        {
            if (ViewModel.SelectedItem == null)
            {
                return;
            }
            var item = ViewModel.SelectedItem;
            var file = await CreateFile(await GetLibraryFolder(), item.FileName);

            await DownloadRequest(file, item.IsJpeg
                                  ?(Download) new DownloadJpeg { Path = item.FilePath }
                                  : new DownloadRaw {
                Path = item.FilePath, FileSize = item.FileSize
            });

#if __IOS__
            await Injection.SaveToLibrary(file.Path, "HbLink");

            await file.DeleteAsync();
#endif
#if __ANDROID__
            Injection.ScanFile(Context, file.Path);
#endif
            new MessageDialog("download completed").ShowAsync();
        }