示例#1
0
        private void DrawingBoard_Click(object sender, MouseEventArgs e)
        {
            // If a method isn't selected, do nothing
            if (lstMethods.SelectedItems.Count <= 0)
            {
                return;
            }

            // Otherwise, generate a new Node to and add it to our code base
            Node f = null;

            switch (CurrentMode[cmbSelectionPicker.Text])
            {
            case METHODS:
                f = new FunctionNode(mAvailableMethods[lstMethods.SelectedIndices[0]]);
                break;

            case CONSTANTS:
                f = new ConstantNode(ConstantNode.ConstConverter[lstMethods.SelectedItems[0].Text]);
                break;

            case OPERATORS:
                f = new OperatorNode(OperatorNode.Operators[lstMethods.SelectedIndices[0]]);
                break;

            default:
                throw new InvalidOperationException("You somehow got something besides Meth/Const/Op in the cmb box.");
                break;
            }

            f.Location = e.Location;
            mCommands.Add(f);
            spltMainContainer.Panel2.Controls.Add(f);
        }
示例#2
0
        private void DrawingBoard_Click(object sender, MouseEventArgs e)
        {
            // If a method isn't selected, do nothing
            if (lstMethods.SelectedItems.Count <= 0)
            {
                return;
            }

            // Otherwise, generate a new Node to and add it to our code base
            Node f = null;

            switch (CurrentMode[cmbSelectionPicker.Text])
            {
                case METHODS:
                    f = new FunctionNode(mAvailableMethods[lstMethods.SelectedIndices[0]]);
                    break;

                case CONSTANTS:
                    f = new ConstantNode(ConstantNode.ConstConverter[lstMethods.SelectedItems[0].Text]);
                    break;

                case OPERATORS:
                    f = new OperatorNode(OperatorNode.Operators[lstMethods.SelectedIndices[0]]);
                    break;

                default:
                    throw new InvalidOperationException("You somehow got something besides Meth/Const/Op in the cmb box.");
                    break;
            }

            f.Location = e.Location;
            mCommands.Add(f);
            spltMainContainer.Panel2.Controls.Add(f);
        }