Пример #1
0
 ActionLink CreateLink()
 {
     ActionLink link = new ActionLink ();
     link.SourceButton = new DashboardButton ();
     link.SourceTags = new List<Tag> { new Tag ("tag1") };
     link.DestinationButton = new DashboardButton ();
     link.DestinationTags = new List<Tag> { new Tag ("tag2") };
     link.Action = LinkAction.Toggle;
     link.TeamAction = TeamLinkAction.Invert;
     link.KeepGenericTags = false;
     link.KeepPlayerTags = false;
     return link;
 }
Пример #2
0
        public ActionLinkObject(LinkAnchorObject source,
		                         LinkAnchorObject destination,
		                         ActionLink link)
        {
            Link = link;
            Source = source;
            Destination = destination;
            if (destination == null) {
                stop = source.Out;
            } else {
                stop = destination.In;
            }
            line = new Line ();
            line.Start = source.Out;
            line.Stop = stop;
        }
Пример #3
0
        public void TestSerialization()
        {
            ActionLink link = new ActionLink ();

            Utils.CheckSerialization (link);

            link = CreateLink ();

            ActionLink link2 = Utils.SerializeDeserialize (link);
            Assert.AreEqual (link.SourceTags, link2.SourceTags);
            Assert.AreEqual (link.DestinationTags, link2.DestinationTags);
            Assert.AreEqual (link.Action, link2.Action);
            Assert.AreEqual (link.TeamAction, link2.TeamAction);
            Assert.AreEqual (link.KeepGenericTags, link2.KeepGenericTags);
            Assert.AreEqual (link.KeepPlayerTags, link2.KeepPlayerTags);
        }
Пример #4
0
 public void TestEquality()
 {
     ActionLink link = CreateLink ();
     ActionLink link2 = new ActionLink ();
     Assert.IsTrue (link != link2);
     Assert.AreNotEqual (link, link2);
     link2.SourceButton = link.SourceButton;
     Assert.AreNotEqual (link, link2);
     link2.DestinationButton = link.DestinationButton;
     Assert.AreNotEqual (link, link2);
     link2.SourceTags = new List<Tag> { new Tag ("tag1") };
     Assert.AreNotEqual (link, link2);
     link2.DestinationTags = new List<Tag> { new Tag ("tag2") };
     Assert.IsTrue (link == link2);
     Assert.IsTrue (link.Equals (link2));
 }
Пример #5
0
        public override bool Equals(object obj)
        {
            ActionLink link = obj as ActionLink;

            if (link == null)
            {
                return(false);
            }

            if (link.SourceButton != SourceButton ||
                link.DestinationButton != DestinationButton)
            {
                return(false);
            }
            if (!link.SourceTags.SequenceEqualSafe(SourceTags) ||
                !link.DestinationTags.SequenceEqualSafe(DestinationTags))
            {
                return(false);
            }
            return(true);
        }
Пример #6
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);
     }
 }
Пример #7
0
 void RemoveLink(ActionLink link, bool force = false)
 {
     string msg = string.Format ("{0} {1} ?",
                      Catalog.GetString ("Do you want to delete: "), link);
     if (force || Config.GUIToolkit.QuestionMessage (msg, null, this)) {
         link.SourceButton.ActionLinks.Remove (link);
         Edited = true;
         Refresh ();
     }
 }
Пример #8
0
 void HandleActionLinkCreatedEvent(ActionLink actionLink)
 {
     //			if (template.HasCircularDependencies ()) {
     //				Config.GUIToolkit.ErrorMessage (Catalog.GetString (
     //					"This linking option is not valid: infinite loop."));
     //				RemoveLink (actionLink, true);
     //			}
     HandleActionLinksSelectedEvent (new List<ActionLink> { actionLink });
 }
Пример #9
0
 public void AddActionLink(ActionLink link)
 {
     link.SourceButton = this;
     ActionLinks.Add(link);
 }
Пример #10
0
 public void AddActionLink(ActionLink link)
 {
     link.SourceButton = this;
     ActionLinks.Add (link);
 }