/// <summary> /// Load image /// </summary> /// <returns></returns> private async Task loadImage() { currentImage = imageCollection[imageIndex]; if (imageCollection[imageIndex].bitMap != null) { images[pivotIndex].Source = imageCollection[imageIndex].bitMap; } else { progressBars[pivotIndex].Visibility = System.Windows.Visibility.Visible; Downloader downloader = new Downloader(imageCollection[imageIndex].largeUrl); try { byte[] byteArray = await downloader.downloadByteArray(); MemoryStream ms = new MemoryStream(byteArray); imageCollection[imageIndex].bitMap = new BitmapImage(); imageCollection[imageIndex].bitMap.CreateOptions = BitmapCreateOptions.None; imageCollection[imageIndex].bitMap.SetSource(ms); images[pivotIndex].Source = imageCollection[imageIndex].bitMap; } catch (Exception) { imageCollection[imageIndex].bitMap = null; } progressBars[pivotIndex].Visibility = System.Windows.Visibility.Collapsed; } }
public ImagePage() { InitializeComponent(); imageCollection = App.imageCollectionPassed; index = imageCollection.IndexOf(App.imagePassed); currentImage = App.imagePassed; }
public static void insertImage(MovieImage img) { lock (imageSyncLock) { if (imageList.Count >= IMAGE_MAX_SIZE) { imageList.RemoveLast(); } imageList.AddFirst(img); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj is MovieImage) { MovieImage tmp = obj as MovieImage; return(tmp.id == this.id); } return(false); }
private void imageListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (imageListBox != null && imageListBox.SelectedItem != null) { MovieImage image = (MovieImage)imageListBox.SelectedItem; if (image != null) { App.imagePassed = image; App.imageCollectionPassed = imageParser.imageCollection; NavigationService.Navigate(new Uri("/ImagePage.xaml", UriKind.Relative)); } imageListBox.SelectedItem = null; } }
public ImageCommentPage() { InitializeComponent(); searchPopup = new Popup(); image = App.commentImagePassed; if (image != null) { parser = new ImageCommentHtmlParser(image); } var commentPullDector = new WP8PullToRefreshDetector(); commentPullDector.Bind(commentSelector); commentPullDector.Compression += commentDector_Compress; commentSelector.ItemRealized += comment_ItemRealized; LayoutRoot.DataContext = Settings.instance; }
public ImagePage() { InitializeComponent(); imageCollection = App.imageCollectionPassed; imageIndex = imageCollection.IndexOf(App.imagePassed); pivotIndex = 0; currentImage = null; if (imageCollection.Count == 1) { pivotNum = 1; } else { pivotNum = 3; } panoramaItems = new PanoramaItem[pivotNum]; images = new Image[pivotNum]; progressBars = new ProgressBar[pivotNum]; grids = new Grid[pivotNum]; for (int i = 0; i < pivotNum; i++) { panoramaItems[i] = new PanoramaItem(); images[i] = new Image(); images[i].Tap += onImageTap; progressBars[i] = new ProgressBar(); progressBars[i].Foreground = new SolidColorBrush(Colors.White); progressBars[i].IsIndeterminate = true; progressBars[i].Visibility = System.Windows.Visibility.Collapsed; grids[i] = new Grid(); grids[i].Children.Add(progressBars[i]); grids[i].Children.Add(images[i]); panoramaItems[i].Content = grids[i]; panorama.Items.Add(panoramaItems[i]); } panorama.SelectionChanged += Pivot_SelectionChanged; createApplicationBar(); }
public static MovieImage getImage(string id) { MovieImage img = null; lock (imageSyncLock) { foreach (MovieImage i in imageList) { if (i.id == id) { img = i; break; } } if (img == null) { return(null); } imageList.Remove(img); imageList.AddFirst(img); } return(img); }
private void loadImage() { if (index < 0) { index = 0; return; } if (index == imageCollection.Count) { index = imageCollection.Count - 1; return; } imageLoadingBar.IsIndeterminate = true; currentImage = imageCollection[index]; if (currentImage.bitMap != null) { image.Source = currentImage.bitMap; } else { currentBitMap = new BitmapImage(new Uri(currentImage.largeUrl)); image.Source = currentBitMap; } }