Represents an ActionLink in the canvas.
Inheritance: CanvasObject, ICanvasSelectableObject
コード例 #1
0
 protected override void StartMove(Selection sel)
 {
     if (sel != null && sel.Drawable is LinkAnchorObject) {
         LinkAnchorObject anchor = sel.Drawable as LinkAnchorObject;
         ActionLink link = new ActionLink {
             SourceButton = anchor.Button.Button,
             SourceTags = new ObservableCollection<Tag> (anchor.Tags)
         };
         movingLink = new ActionLinkObject (anchor, null, link);
         AddObject (movingLink);
         ClearSelection ();
         UpdateSelection (new Selection (movingLink, SelectionPosition.LineStop, 0), false);
     }
 }
コード例 #2
0
        protected override void LoadTemplate()
        {
            ClearObjects ();
            buttonsDict.Clear ();

            foreach (TagButton tag in template.List.OfType<TagButton>()) {
                TagObject to = new TagObject (tag);
                to.ClickedEvent += HandleTaggerClickedEvent;
                to.Mode = Mode;
                AddButton (to);
            }

            foreach (AnalysisEventButton cat in template.List.OfType<AnalysisEventButton>()) {
                CategoryObject co = new CategoryObject (cat);
                co.ClickedEvent += HandleTaggerClickedEvent;
                co.EditButtonTagsEvent += (t) => {
                    if (EditButtonTagsEvent != null)
                        EditButtonTagsEvent (t);
                };
                co.Mode = Mode;
                AddButton (co);
            }

            foreach (PenaltyCardButton c in template.List.OfType<PenaltyCardButton>()) {
                CardObject co = new CardObject (c);
                co.ClickedEvent += HandleTaggerClickedEvent;
                co.Mode = Mode;
                AddButton (co);
            }

            foreach (ScoreButton s in template.List.OfType<ScoreButton>()) {
                ScoreObject co = new ScoreObject (s);
                co.ClickedEvent += HandleTaggerClickedEvent;
                co.Mode = Mode;
                AddButton (co);
            }

            foreach (TimerButton t in template.List.OfType<TimerButton>()) {
                TimerObject to = new TimerObject (t);
                to.ClickedEvent += HandleTaggerClickedEvent;
                to.Mode = Mode;
                if (Project != null && t.BackgroundImage == null) {
                    TeamType team = (t.Timer as TimerLongoMatch).Team;
                    if (team == TeamType.LOCAL) {
                        if (Project is ProjectLongoMatch) {
                            to.TeamImage = (Project as ProjectLongoMatch).LocalTeamTemplate.Shield;
                        }
                    } else if (team == TeamType.VISITOR) {
                        if (Project is ProjectLongoMatch) {
                            to.TeamImage = (Project as ProjectLongoMatch).VisitorTeamTemplate.Shield;
                        }
                    }
                }
                AddButton (to);
            }

            foreach (DashboardButtonObject buttonObject in buttonsDict.Values) {
                foreach (ActionLink link in buttonObject.Button.ActionLinks) {
                    LinkAnchorObject sourceAnchor, destAnchor;
                    ActionLinkObject linkObject;

                    sourceAnchor = buttonObject.GetAnchor (link.SourceTags);
                    try {
                        destAnchor = buttonsDict [link.DestinationButton].GetAnchor (link.DestinationTags);
                    } catch {
                        Log.Error ("Skipping link with invalid destination tags");
                        continue;
                    }
                    linkObject = new ActionLinkObject (sourceAnchor, destAnchor, link);
                    link.SourceButton = buttonObject.Button;
                    linkObject.Visible = ShowLinks;
                    AddObject (linkObject);
                }
            }
            Edited = false;
            HandleSizeChangedEvent ();
        }