示例#1
0
        /// <summary>
        /// Edit method.
        /// </summary>
        public override void Edit()
        {
            // While the new item cannot be initialized - let the user pick another one or cancel the addition.
            bool enough = false;

            while (!enough)
            {
                VirtualNewForm form = VirtualNewForm.GetActionsInstance();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    var action = (BaseScriptAction)form.Value;
                    if (action.Initialize())
                    {
                        parent.Remove(this);
                        parent.Add(action);
                        parent.Add(this);
                        enough = true;
                    }
                }
                else
                {
                    enough = true;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Subaction removal method.
        /// </summary>
        /// <param name="path">Set of indexes for subaction identification.</param>
        public override void Remove(List <int> path)
        {
            if (path.Count >= 2)
            {
                int root = path[0];
                path.RemoveAt(0);

                switch (root)
                {
                case 0:
                    conditions.Remove(path);
                    break;

                case 1:
                    true_branch.Remove(path);
                    break;

                case 2:
                    false_branch.Remove(path);
                    break;
                }
            }
        }
示例#3
0
        /// <summary>
        /// Edit method.
        /// </summary>
        public override void Edit()
        {
            bool enough = false;

            while (!enough)
            {
                VirtualNewForm form = VirtualNewForm.GetConditionsInstance();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    var action = (BaseScriptCondition)form.Value;
                    if (action.Initialize())
                    {
                        parent.Remove(this);
                        parent.Add(action);
                        parent.Add(this);
                        enough = true;
                    }
                }
                else
                {
                    enough = true;
                }
            }
        }