private bool IsLogicCompatible(ElemBase origin, ElemBase adding) { if (origin.GetType() == typeof(ElemEnd)) { return(false); } return(true); }
private void InsertTaskAfterElement(ElemBase origin, ElemBase adding) { adding.Task.VisualElement = adding; if (origin == null && adding.GetType() == typeof(ElemStart)) { FunctionalElements.Add(adding.Task); VisualElements.Add(adding); return; } FunctionalElements.Insert(FunctionalElements.IndexOf(origin.Task) + 1, adding.Task); VisualElements.Insert(VisualElements.IndexOf(origin) + 1, adding); }
private bool TryAddNewElement(ElemBase origin, ElemBase adding) { if (origin != null && adding.GetType() != typeof(ElemStart)) { if (!IsParameterCompatible(origin, adding)) { return(false); } if (!IsLogicCompatible(origin, adding)) { return(false); } } InsertTaskAfterElement(origin, adding); if (origin != null) { origin.NextElementReaction(adding); } adding.Task.AfterTaskAddition(); adding.AfterElementAddition(); return(true); }