private void DownloadImage(string url) { url = HttpUtility.UrlDecode(url); GlobalVariables.ListUrl.Add(url); var download = new ImageDownload(url); var cacheImage = download.FindInCacheOrLocal(); if (cacheImage != null) { var cImage = new ClickImage(); cImage.SetImage(cacheImage); cImage.Tap += delegate(object o, GestureEventArgs args) { var uri = new Uri("/ImageDetailPortraitPage.xaml?url=" + url, UriKind.Relative); NavigationService.Navigate(uri); }; if (leftHeight > rightHeight) { RightColumn.Children.Add(cImage); rightHeight += CalculateImageActualHeight(cacheImage.PixelWidth, cacheImage.PixelHeight); } else { LeftColumn.Children.Add(cImage); leftHeight += CalculateImageActualHeight(cacheImage.PixelWidth, cacheImage.PixelHeight); } return; } download.DownloadCompleted += (image) => { var cImage = new ClickImage(); cImage.SetImage(image); cImage.Tap += delegate(object o, GestureEventArgs args) { var uri = new Uri("/ImageDetailPortraitPage.xaml?url=" + url, UriKind.Relative); NavigationService.Navigate(uri); }; if (leftHeight >rightHeight) { RightColumn.Children.Add(cImage); rightHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } else { LeftColumn.Children.Add(cImage); leftHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } }; download.DownloadFailed += (o, s) => Debug.WriteLine(s); App.ImageWorker.AddDownload(download); }
private void DownloadImage(string url) { url = HttpUtility.UrlDecode(url); GlobalVariables.ListUrl.Add(url); var download = new ImageDownload(url); var cacheImage = download.FindInCacheOrLocal(); if (cacheImage != null) { var cImage = new ClickImage(); cImage.SetImage(cacheImage); cImage.Tap += delegate(object o, GestureEventArgs args) { var uri = new Uri("/ImageDetailPortraitPage.xaml?url=" + url, UriKind.Relative); NavigationService.Navigate(uri); }; if (leftHeight > rightHeight) { RightColumn.Children.Add(cImage); rightHeight += CalculateImageActualHeight(cacheImage.PixelWidth, cacheImage.PixelHeight); } else { LeftColumn.Children.Add(cImage); leftHeight += CalculateImageActualHeight(cacheImage.PixelWidth, cacheImage.PixelHeight); } return; } download.DownloadCompleted += (image) => { var cImage = new ClickImage(); cImage.SetImage(image); cImage.Tap += delegate(object o, GestureEventArgs args) { var uri = new Uri("/ImageDetailPortraitPage.xaml?url=" + url, UriKind.Relative); NavigationService.Navigate(uri); }; if (leftHeight > rightHeight) { RightColumn.Children.Add(cImage); rightHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } else { LeftColumn.Children.Add(cImage); leftHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } }; download.DownloadFailed += (o, s) => Debug.WriteLine(s); App.ImageWorker.AddDownload(download); }
private void AddImage(BitmapImage image, string path) { var cImage = new ClickImage(); cImage.SetImage(image); cImage.Tap += delegate(object o, GestureEventArgs args) { var uri = new Uri("/ImageDetailPortraitPage.xaml?path=" + path, UriKind.Relative); NavigationService.Navigate(uri); }; if (leftHeight > rightHeight) { RightColumn.Children.Add(cImage); rightHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } else { LeftColumn.Children.Add(cImage); leftHeight += CalculateImageActualHeight(image.PixelWidth, image.PixelHeight); } GlobalVariables.ListPath.Add(path); }