public void Phase0(LineViewModel line) { var iv = LayoutRoot; ImageContent.Opacity = 0; ImageContent.Height = double.NaN; CommentIndicator.Opacity = 0; ProgressBar.Opacity = 0; TextContent.Opacity = 1; if (ImageContent.Source != null) { var bitmap = ImageContent.Source as BitmapImage; bitmap.DownloadProgress -= Image_DownloadProgress; ImageContent.ClearValue(Image.SourceProperty); } if (line.IsImage) { if (!AppGlobal.ShouldAutoLoadImage) { TextContent.Text = ImageTapToLoadPlaceholder; } else { TextContent.Text = ImageLoadingTextPlaceholder; } double aspect = line.ImageWidth <= 0? .0 : (double)line.ImageHeight / (double)line.ImageWidth; double ih = iv.Width * aspect; if (ih > 1.0) { ImageContent.Height = ih; ImagePlaceHolder.Height = ih; } else { ImagePlaceHolder.Height = double.NaN; } ProgressBar.Visibility = Visibility.Visible; ImageContent.Visibility = Visibility.Visible; ImagePlaceHolder.Visibility = Visibility.Visible; TextContent.TextAlignment = TextAlignment.Center; } else { TextContent.Text = " " + line.Content; //textContent.Height = double.NaN; TextContent.TextAlignment = TextAlignment.Left; ImagePlaceHolder.Visibility = Visibility.Collapsed; ImageContent.Visibility = Visibility.Collapsed; ImageContent.DataContext = null; } }
public void ClearContent() { ProgressBar.Value = 0; if (ImageContent.Source != null) { var bitmap = ImageContent.Source as BitmapImage; bitmap.DownloadProgress -= Image_DownloadProgress; } ImageContent.DataContext = null; ImageContent.ClearValue(Image.SourceProperty); ImageContent.Visibility = Windows.UI.Xaml.Visibility.Collapsed; ImageContent.Height = 0; TextContent.ClearValue(TextBlock.TextProperty); }