Example #1
0
        private void ConditionTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (ConditionTree.SelectedNode == null)
            {
                PassCmdBox.Items.Clear();
                TargetStateBox.Text = "";
                activeCondition     = null;
            }
            else
            {
                activeNode            = ConditionTree.SelectedNode;
                activeCommand         = null;
                CmdProperties.Enabled = false;
                int[] nodePath = activeNode.Name.Substring(4).Split('-').Select(k => Int32.Parse(k)).ToArray();
                activeCondition = activeState.Conditions[nodePath[0]];

                for (int i = 1; i < nodePath.Length; i++)
                {
                    try
                    {
                        activeCondition = activeCondition.Subconditions[nodePath[i]];
                    } catch (Exception ex)
                    {
                        MessageBox.Show("ERROR on node path " + ConditionTree.SelectedNode.Name.Substring(4));
                        Editor.ByteProvider = new DynamicByteProvider(new byte[] { });
                        TargetStateBox.Text = "";
                        activeCondition     = null;
                        return;
                    }
                }

                TargetStateBox.Text = activeCondition.TargetState.ToString();

                activeCommand  = null;
                activeEditType = EditType.Evaluator;
                RefreshEditor();
                RefreshTitle();

                foreach (var command in activeCondition.PassCommands)
                {
                    PassCmdBox.Items.Add(command.CommandID);
                }

                PassCmdBox.SelectedItem  = null;
                EntryCmdBox.SelectedItem = null;
                ExitCmdBox.SelectedItem  = null;
                WhileCmdBox.SelectedItem = null;
            }
        }
Example #2
0
 private void SelectCommand(ListBox commandBox, ESD.CommandCall command)
 {
     activeEditType = EditType.Null;
     ListBox[] boxes = { EntryCmdBox, ExitCmdBox, WhileCmdBox, PassCmdBox };
     foreach (var box in boxes.Where(b => b != commandBox))
     {
         box.SelectedItem = null;
     }
     Editor.ByteProvider = new DynamicByteProvider(new byte[] { });
     activeCommand       = command;
     activeEditType      = EditType.CommandArg;
     if (commandBox != PassCmdBox)
     {
         ConditionTree.SelectedNode = null;
         activeCondition            = null;
     }
     RefreshEditor();
     RefreshTitle();
 }
Example #3
0
 /// <summary>
 /// Dissembles a CommandCall object into a line of "EzLanguage" plain text.
 /// </summary>
 public static Statement DissembleCommandCall(EzSembleContext context, ESD.CommandCall c)
 {
     return(new Statement {
         Name = context.GetCommandInfo(c.CommandBank, c.CommandID).Name, Args = c.Arguments.Select(a => DissembleExpression(context, a)).ToList()
     });
 }