/// <summary> /// Check if the button can link. /// </summary> /// <returns><c>true</c>, if link was caned, <c>false</c> otherwise.</returns> /// <param name="anchor">Anchor.</param> public bool CanLink(LinkAnchorView anchor) { if (anchor == null) { return(false); } else if (this == anchor) { return(false); } else if (Button == anchor.Button) { return(false); } else if (Button is TimerButtonView && anchor.Button is TimerButtonView) { return(true); } else if (Button is TagButtonView && anchor.Button is TagButtonView) { return(true); } else if (Button.ButtonVM is EventButtonVM && anchor.Button.ButtonVM is EventButtonVM) { return(true); } return(false); }
public DashboardButtonView() { SupportsLinks = true; anchor = new LinkAnchorView(this, null, new Point(0, 0)); anchor.RedrawEvent += (co, area) => { EmitRedrawEvent(anchor, area); }; }
public ActionLinkView(LinkAnchorView source, LinkAnchorView destination, ActionLinkVM 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; }
/// <summary> /// Cans the link. /// </summary> /// <returns><c>true</c>, if link was caned, <c>false</c> otherwise.</returns> /// <param name="dest">Destination.</param> public bool CanLink(LinkAnchorView dest) { /* Check if the link is possible between the 2 types of anchors */ if (!Source.CanLink(dest)) { return(false); } /* Check if this link will result into a duplicated link */ foreach (ActionLinkVM link in Source.Button.ButtonVM.ActionLinks) { if (link.DestinationButton == dest.Button.ButtonVM && link.SourceTags.ViewModels.SequenceEqualSafe(Source.Tags) && link.DestinationTags.ViewModels.SequenceEqualSafe(dest.Tags)) { return(false); } } return(true); }
void AddSubcatAnchor(TagVM tag, Point point, double width, double height) { LinkAnchorView anchor; if (subcatAnchors.ContainsValue(tag)) { anchor = subcatAnchors.GetKeyByValue(tag); anchor.RelativePosition = point; } else { anchor = new LinkAnchorView(this, new List <TagVM> { tag }, point); anchor.RedrawEvent += (co, area) => { EmitRedrawEvent(anchor, area); }; subcatAnchors.Add(anchor, tag); } anchor.Width = width; anchor.Height = height; }
void RemoveAnchor(LinkAnchorView anchor) { anchor.Dispose(); subcatAnchors.Remove(anchor); }