Пример #1
0
        private async void IllustrationRefreshButton_Click(object sender, RoutedEventArgs e)
        {
            var lvm = ((FrameworkElement)sender).DataContext as LineViewModel;

            if (lvm.IsImageCached)             // LocalUri
            {
                var container = ContentListView.ContainerFromIndex(lvm.No - 1) as SelectorItem;
                if (container != null)
                {
                    var iv = container.ContentTemplateRoot as Grid;
                    HideImageRefreshButton();
                    await RefreshCruptedImageItem(iv);
                }
            }
        }
Пример #2
0
 void ViewModel_CommentsListLoaded(object sender, IEnumerable <int> e)
 {
     foreach (int idx in e)
     {
         var container = ContentListView.ContainerFromIndex(idx - 1) as SelectorItem;
         if (container != null)
         {
             var iv = container.ContentTemplateRoot as Grid;
             if (iv == null)
             {
                 continue;
             }
             var commentIndicator = iv.FindName("CommentIndicator") as Rectangle;
             commentIndicator.Opacity = 1;
         }
     }
 }
Пример #3
0
        //void VolumeListView_SizeChanged(object sender, SizeChangedEventArgs e)
        //{
        //	if (VolumeListView.Visibility == Windows.UI.Xaml.Visibility.Visible && e.NewSize.Height > 10 && ContentListView.Items.Count > 0)
        //	{
        //		var target = VolumeListView.GetValue(ListViewBaseScrollToItemRequestProperty);
        //		VolumeListView.SelectedItem = target;
        //		VolumeListView.UpdateLayout();
        //		VolumeListView.ScrollIntoView(target, ScrollIntoViewAlignment.Leading);
        //		VolumeListView.ClearValue(ListViewBaseScrollToItemRequestProperty);
        //		VolumeListView.SizeChanged -= VolumeListView_SizeChanged;
        //	}
        //}

        private async void ContentListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (IsIndexPanelOpen)
            {
                IsIndexPanelOpen = false;
                return;
            }

            var line = (LineViewModel)e.ClickedItem;


            var container   = ContentListView.ContainerFromIndex(line.No - 1) as SelectorItem;
            var iv          = container.ContentTemplateRoot as Grid;
            var textContent = iv.FindName("TextContent") as TextBlock;

            if (line.IsImage && textContent.Text == ImageTapToLoadPlaceholder)
            {
                textContent.Text = ImageLoadingTextPlaceholder;
                LoadItemIllustation(iv, line);
                return;
            }

            if (!(line.IsImage || ViewModel.EnableComments))
            {
                return;
            }

            ((FrameworkElement)CommentsFlyout.Content).DataContext = line;
            if (ViewModel.EnableComments)
            {
                CommentsTool.Visibility = Visibility.Visible;
                if (AppGlobal.IsSignedIn)
                {
                    CommentsInputTool.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
                else
                {
                    CommentsInputTool.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }
            }
            else
            {
                CommentsTool.Visibility = Visibility.Collapsed;
            }

            if (line.IsImage && line.IsImageCached)
            {
                var imageContent = iv.FindName("ImageContent") as Image;
                var bitmap       = imageContent.Source as BitmapImage;
                if (bitmap.UriSource.AbsoluteUri.StartsWith("ms-appdata"))
                {
                    ShowImageRefreshButton();
                }
                else
                {
                    HideImageRefreshButton();
                }
            }
            else
            {
                HideImageRefreshButton();
            }

            CommentsFlyout.ShowAt((FrameworkElement)container);

            if (line.HasComments && !line.IsLoading)
            {
                await line.LoadCommentsAsync();
            }
        }