Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private async void LoadImage_Async(Uri url)
- {
- // -- 1. загрузка и визуализация изображения - - - - - - - - - - - - - - - -
- BitmapImage bi = new BitmapImage();
- bi.BeginInit();
- bi.CacheOption = BitmapCacheOption.OnLoad;
- bi.UriSource = url;
- bi.EndInit();
- while (bi.IsDownloading) // жду пока скачается
- {
- Debug.WriteLine($"bi Downloading: {bi.IsDownloading}");
- await Task.Delay(100);
- }
- PreviewImage.Source = bi; // UI-элемент типа Image для визуализации изображения
- // -- 2. загрузка и вывод метаданных изображения - - - - - - - - - - - - - - - -
- BitmapSource bs = BitmapFrame.Create(url, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
- while (bs.IsDownloading) // жду пока скачается
- {
- Debug.WriteLine($" bs Downloading: {bs.IsDownloading}");
- await Task.Delay(100);
- }
- BitmapMetadata md = (BitmapMetadata)bs.Metadata;
- MetadataInfo.Text = md?.Comment; // UI-элемент типа TextBox для вывода метаданных изображения
- }
Advertisement
Add Comment
Please, Sign In to add comment