예제 #1
0
        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));
                }
            }
        }
예제 #2
0
        public FieldLine(AutomationField left, AutomationField right)
        {
            Left  = left;
            Right = right;

            left.LinesOut.Add(this);
            Right.LineIn = this;
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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;
        }