Пример #1
0
 private int GetTagIndForRelativePosition(int x, int y)
 {
     if (this._photoTags != null)
     {
         for (int index = 0; index < this._photoTags.Count; ++index)
         {
             PhotoVideoTag photoTag = this._photoTags[index];
             if ((double)x >= photoTag.x && (double)x <= photoTag.x2 && ((double)y >= photoTag.y && (double)y <= photoTag.y2))
             {
                 return(index);
             }
         }
     }
     return(-1);
 }
Пример #2
0
        private void GenerateTextForTags()
        {
            ((PresentationFrameworkCollection <Block>) this.textTags.Blocks).Clear();
            this._tagHyperlinks.Clear();
            this._photoTags.Clear();
            this._photoTags.AddRange((IEnumerable <PhotoVideoTag>) this.PhotoVM.PhotoTags);
            ((UIElement)this.textTags).Visibility = (this._photoTags.Count > 0 ? Visibility.Visible : Visibility.Collapsed);
            if (this._photoTags.Count <= 0)
            {
                return;
            }
            Paragraph paragraph = new Paragraph();
            Run       run1      = new Run();
            string    str1      = PhotoResources.PhotoUC_OnThisPhoto + " ";

            run1.Text = (str1);
            SolidColorBrush solidColorBrush = Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush;

            ((TextElement)run1).Foreground = ((Brush)solidColorBrush);
            Run run2 = run1;

            ((PresentationFrameworkCollection <Inline>)paragraph.Inlines).Add((Inline)run2);
            for (int index = 0; index < this._photoTags.Count; ++index)
            {
                Hyperlink hyperlink = HyperlinkHelper.GenerateHyperlink(this._photoTags[index].tagged_name ?? "", index.ToString(), (Action <Hyperlink, string>)((h, t) =>
                {
                    int state = (int)HyperlinkHelper.GetState(h);
                    int ind   = int.Parse(t);
                    PhotoVideoTag photoTag = this._photoTags[int.Parse(t)];
                    this.SelectTaggedUser(ind);
                }), (Brush)null, HyperlinkState.Normal);
                HyperlinkHelper.SetState(hyperlink, HyperlinkState.Accent, (Brush)null);
                this._tagHyperlinks.Add(hyperlink);
                ((PresentationFrameworkCollection <Inline>)paragraph.Inlines).Add((Inline)hyperlink);
                if (index < this.PhotoVM.PhotoTags.Count - 1)
                {
                    Run    run3 = new Run();
                    string str2 = ", ";
                    run3.Text = (str2);
                    Run run4 = run3;
                    ((PresentationFrameworkCollection <Inline>)paragraph.Inlines).Add((Inline)run4);
                }
            }
            ((PresentationFrameworkCollection <Block>) this.textTags.Blocks).Add((Block)paragraph);
        }
Пример #3
0
        private void SelectTaggedUser(int ind)
        {
            PhotoVideoTag photoTag = this._photoTags[ind];

            if (this._selectedTagInd == ind)
            {
                if (photoTag.uid == 0L)
                {
                    return;
                }
                Navigator.Current.NavigateToUserProfile(photoTag.uid, photoTag.tagged_name, "", false);
            }
            else
            {
                for (int index = 0; index < this._tagHyperlinks.Count; ++index)
                {
                    Hyperlink tagHyperlink = this._tagHyperlinks[index];
                    if (index == ind)
                    {
                        if (photoTag.uid != 0L)
                        {
                            HyperlinkHelper.SetState(tagHyperlink, HyperlinkState.Normal, null);
                        }
                    }
                    else
                    {
                        HyperlinkHelper.SetState(tagHyperlink, HyperlinkState.Accent, null);
                    }
                }
                WriteableBitmap opacityMask     = this.GenerateOpacityMask(((FrameworkElement)this.image).ActualWidth, ((FrameworkElement)this.image).ActualHeight, photoTag.x, photoTag.x2, photoTag.y, photoTag.y2);
                Image           image           = this.image;
                ImageBrush      imageBrush      = new ImageBrush();
                WriteableBitmap writeableBitmap = opacityMask;
                imageBrush.ImageSource = ((ImageSource)writeableBitmap);
                int num = 1;
                ((TileBrush)imageBrush).Stretch = ((Stretch)num);
                ((UIElement)image).OpacityMask  = ((Brush)imageBrush);
                this._selectedTagInd            = ind;
            }
        }