public static FieldLine HookLineIn(AutomationField field) { if (Globals.TempAutomationLine != null) { Globals.TempAutomationLine.Remove(); Globals.TempAutomationLine = null; } if (Globals.TempFieldLine == null) { var f = new FieldLine(); f.Right = field; Globals.TempFieldLine = f; return(f); } else { if (Globals.TempFieldLine.Right == null && Globals.TempFieldLine.Left != field) { var line = new FieldLine(Globals.TempFieldLine.Left, field); Globals.TempFieldLine.Remove(); Globals.TempFieldLine = null; return(line); } else { Globals.TempFieldLine.Remove(); Globals.TempFieldLine = null; return(HookLineIn(field)); } } }
public FieldLine(AutomationField left, AutomationField right) { Left = left; Right = right; left.LinesOut.Add(this); Right.LineIn = this; }
public void LoadFields() { fields.Clear(); sortedFields.Clear(); var type = GetType(); var infos = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); for (int i = 0; i < infos.Length; i++) { var field = infos[i]; var id = string.Format("{0}_{1}_{2}", ID, field.Name, i); var instance = new AutomationField(this, field, id); fields.Add(instance); sortedFields.Add(id, instance); } }
protected override void OnAfterSerialize() { if (string.IsNullOrEmpty(idLeft)) { Remove(); return; } var automations = Window.GetControls <Automation>(); foreach (var item in automations) { if (Left == null && item.HasField(idLeft)) { Left = item.GetField(idLeft); continue; } if (Right == null && item.HasField(idRight)) { Right = item.GetField(idRight); continue; } if (Left != null && Right != null) { break; } } if (Left == null || Right == null) { Remove(); return; } Left.LinesOut.Add(this); Right.LineIn = this; SortingOrder = ESortingOrder.Line; Color = AutomatronSettings.FieldLineColor; }