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

            var line = (LineViewModel)e.ClickedItem;

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

            var container = ContentListView.ContainerFromItem(line);

            ((FrameworkElement)CommentsFlyout.Content).DataContext = line;
            CommentsFlyout.ShowAt((FrameworkElement)container);
            //CommentInputBox.Focus(Windows.UI.Xaml.FocusState.Unfocused);
            if (line.HasComments && !line.IsLoading)
            {
                await line.LoadCommentsAsync();
            }
        }
Exemple #2
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();
            }
        }