void ShowImgDetail()
        {
            chk.Text = site.IsShowRes ? img.Dimension : img.Desc;
            string type = "N/A", aniformat = "gif webm mpeg  mpg mp4 avi";

            if (img.OriginalUrl.Length > 6)
            {
                type = BooruProcessor.FormattedImgUrl("", img.OriginalUrl.Substring(img.OriginalUrl.LastIndexOf('.') + 1)).ToUpper();
            }
            else
            {
                //url不可能这么短
                LayoutRoot.IsEnabled = false;
                chk.Text             = "原始地址无效";
                preview_ImageFailed(null, null);
                return;
            }
            score.Text = img.Score.ToString();
            txtDesc.Inlines.Add(img.Id + " " + img.Desc + "\r\n" + img.Author);
            txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(type);
            //txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(" " + img.FileSize);
            txtDesc.ToolTip = img.Id + " " + img.Desc + "\r\n" + img.Author + "\r\n" + type + "  " + img.FileSize + "  " + img.Date;
            //txtDesc.Inlines.Add(new LineBreak());
            //txtDesc.Inlines.Add("评分: " + img.Score);
            //txtDesc.Inlines.Add(new LineBreak());
            //txtDesc.Inlines.Add("时间: " + img.Date);
            isDetailSucc = true;

            //ANI ico
            selani.Opacity = aniformat.Contains(type, StringComparison.CurrentCultureIgnoreCase) ? .5 : 0;
        }
        void ShowImgDetail()
        {
            chk.Text = site.IsShowRes ? Image.Dimension : Image.Desc;
            string type = "N/A", aniformat = "gif webm mpeg  mpg mp4 avi ugoira";

            if (Image.OriginalUrl.Length > 6)
            {
                type = BooruProcessor.FormattedImgUrl(string.Empty, Image.OriginalUrl.Substring(Image.OriginalUrl.LastIndexOf('.') + 1)).ToUpper();
            }
            else
            {
                //url不可能这么短
                LayoutRoot.IsEnabled = false;
                chk.Text             = "原始地址无效";
                preview_ImageFailed(null, null);
                return;
            }
            score.Text = Image.Score.ToString();
            txtDesc.Inlines.Add(Image.Id + " " + Image.Desc.Replace(Environment.NewLine, string.Empty));
            txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(type + " " + Image.Author);
            //txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(" " + Image.FileSize);
            txtDesc.ToolTip = $"{Image.Id} {Image.Desc}\r\n{(string.IsNullOrWhiteSpace(Image.Author) ? string.Empty : "[投稿者] " + Image.Author)} \r\n{type} {Image.FileSize} {Image.Date}";
            //txtDesc.Inlines.Add(new LineBreak());
            //txtDesc.Inlines.Add("评分: " + img.Score);
            //txtDesc.Inlines.Add(new LineBreak());
            //txtDesc.Inlines.Add("时间: " + img.Date);
            isDetailSucc = true;

            //ANI ico
            selani.Opacity = aniformat.Contains(type, StringComparison.CurrentCultureIgnoreCase) || Image.PixivUgoira ? .5 : 0;
        }
Example #3
0
        void ShowImgDetail()
        {
            chk.Text = site.IsShowRes ? Image.Dimension : Image.Desc;
            string type = "N/A", aniformat = "gif webm mpeg  mpg mp4 avi ugoira";

            if (Image.OriginalUrl.Length > 6)
            {
                type = BooruProcessor.FormattedImgUrl(string.Empty, Image.OriginalUrl.Substring(Image.OriginalUrl.LastIndexOf('.') + 1)).ToUpper();
            }
            else
            {
                //url不可能这么短
                LayoutRoot.IsEnabled = false;
                chk.Text             = "原始地址无效";
                preview_ImageFailed(null, null);
                return;
            }
            score.Text = Image.Score.ToString();
            txtDesc.Inlines.Add(Image.Id + " " + Image.Desc.Replace(Environment.NewLine, string.Empty));
            txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(type + " " + Image.Author);
            //txtDesc.Inlines.Add(new LineBreak());
            txtDesc.Inlines.Add(" " + Image.FileSize);
            txtDesc.ToolTip = $"{Image.Id} {Image.Desc}{Environment.NewLine}"
                              + $"{(string.IsNullOrWhiteSpace(Image.Author) ? string.Empty : $"[投稿者] {Image.Author}")}{Environment.NewLine}"
Example #4
0
        /// <summary>
        /// 切换预览图操作
        /// </summary>
        /// <param name="id">预览ID</param>
        private void SwitchPreview(int id)
        {
            if (selectedId != id)
            {
                if (selectedId != 0 && imgs.ContainsKey(selectedId))
                {
                    (btns.Children[imgs[selectedId]] as ToggleButton).IsChecked = false;

                    //(imgGrid.Children[imgs[selectedId]] as Image).Opacity = 0;
                    //(imgGrid.Children[imgs[selectedId]] as Image).BeginStoryboard(FindResource("imgClose") as Storyboard);
                    ScrollViewer tempPreview             = (imgGrid.Children[imgs[selectedId]] as ScrollViewer);
                    Storyboard   sb                      = new Storyboard();
                    DoubleAnimationUsingKeyFrames frames = new DoubleAnimationUsingKeyFrames();
                    Storyboard.SetTargetProperty(frames, new PropertyPath(UIElement.OpacityProperty));
                    frames.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(80))));
                    sb.Children.Add(frames);
                    sb.Completed += new EventHandler(delegate(object s, EventArgs ea) { tempPreview.Visibility = Visibility.Hidden; });
                    sb.Begin(tempPreview);
                }
                selectedId = id;
                (btns.Children[imgs[selectedId]] as ToggleButton).IsChecked = true;
                ScrollViewer tempPreview1 = (imgGrid.Children[imgs[selectedId]] as ScrollViewer);
                tempPreview1.Visibility = Visibility.Visible;
                tempPreview1.BeginStoryboard(FindResource("imgShow") as Storyboard);
                ChangePreBtnText();

                ///////////////////////////////////////////////
                ////////////////////////////////////////////

                desc.Text = "";
                if (descs[selectedId].OriginalUrl == descs[selectedId].SampleUrl)
                {
                    desc.Inlines.Add("原图与预览图相同");
                    desc.Inlines.Add(new LineBreak());
                }
                desc.Inlines.Add("描述: " + descs[selectedId].Id + " " + descs[selectedId].Desc);
                desc.Inlines.Add(new LineBreak());
                desc.Inlines.Add("作者: " + descs[selectedId].Author);
                desc.Inlines.Add(new LineBreak());
                try
                {
                    string fileType = descs[selectedId].OriginalUrl.Substring(descs[selectedId].OriginalUrl.LastIndexOf('.') + 1);
                    desc.Inlines.Add("类型: " + BooruProcessor.FormattedImgUrl("", fileType.ToUpper()));
                }
                catch { }
                desc.Inlines.Add(" 大小: " + descs[selectedId].FileSize);
                desc.Inlines.Add(" 尺寸: " + descs[selectedId].Dimension);
                //desc.Inlines.Add(new LineBreak());
                desc.Inlines.Add(" 评分: " + descs[selectedId].Score);
                desc.Inlines.Add(new LineBreak());
                desc.Inlines.Add("时间: " + descs[selectedId].Date);
                if (descs[selectedId].Source.Length > 0)
                {
                    desc.Inlines.Add(new LineBreak());
                    desc.Inlines.Add("来源: " + descs[selectedId].Source);
                }
            }
        }