Ejemplo n.º 1
0
        public bool BreakCheck()
        {
            bool BoolOutput = false;

            for (int i = 0; i < ControlOrder.Count; i++)
            {
                StatementBase us = ControlOrder[i];

                if (us.GetType() == typeof(BreakControl))
                {
                    BoolOutput = true;
                }
                else if (us.GetType() == typeof(Loop))
                {
                    Loop Me = (Loop)us;
                    BoolOutput = Me.statementBlock1.BreakCheck();
                }
                else if (us.GetType() == typeof(Conditions))
                {
                    Conditions Me = (Conditions)us;
                    BoolOutput = Me.statementBlock1.BreakCheck();
                    BoolOutput = Me.statementBlock2.BreakCheck();
                }
                else if (us.GetType() == typeof(CaseControl))
                {
                    CaseControl Me = (CaseControl)us;
                    BoolOutput = Me.statementBlock1.BreakCheck();
                }
            }
            return(BoolOutput);
        }
Ejemplo n.º 2
0
        private void OpenAdd(Statement name)
        {
            StatementBase StatementName = null;

            if (name.GetType() == typeof(XmlVariable))
            {
                StatementName = new VariableDefine();
            }
            else if (name.GetType() == typeof(XmlImputC))
            {
                StatementName = new InputConsole();
            }
            else if (name.GetType() == typeof(XmlCondition))
            {
                StatementName = new Conditions();
            }
            else if (name.GetType() == typeof(XmlLoop))
            {
                StatementName = new Loop();
            }
            else if (name.GetType() == typeof(XmlArray))
            {
                StatementName = new ArrayDefine();
            }
            else if (name.GetType() == typeof(XmlCase))
            {
                StatementName = new CaseControl();
            }
            else if (name.GetType() == typeof(XmlOutputC))
            {
                StatementName = new OutputConsole();
            }
            else if (name.GetType() == typeof(XmlBreak))
            {
                StatementName = new BreakControl();
            }
            else if (name.GetType() == typeof(XmlCalculation))
            {
                StatementName = new Calculation();
            }
            else if (name.GetType() == typeof(XmlMold))
            {
                StatementName = new ReturnMold();
            }
            else if (name.GetType() == typeof(XmlAssignment))
            {
                StatementName = new Assignment();
            }
            InsertContlols(StatementName);
            ControlOrder[IndexNumber].ControlSetup(name);
            number++;
            if (this.Parent.Parent.Parent.GetType() == typeof(Form1))
            {
                Form1 Mparent = (Form1)Parent.Parent.Parent;
                Mparent.AddBar(1);
            }
        }
Ejemplo n.º 3
0
        public void DownStatement(StatementBase statement)
        {
            int IndexNumber = ControlOrder.IndexOf(statement) + 1;

            ControlOrder.Remove(statement);
            Button btn = ControlAddButton[IndexNumber - 1];

            ControlAddButton.Remove(btn);
            ControlOrder.Insert(IndexNumber, statement);
            ControlAddButton.Insert(IndexNumber, btn);
            Sorting();
        }
Ejemplo n.º 4
0
        public void Sorting()
        {
            int top      = 30;
            int maxWidth = 0;

            for (int i = 0; i < ControlOrder.Count; i++)
            {
                StatementBase us1 = ControlOrder[i];
                us1.Location = new Point(this.AutoScrollPosition.X, this.AutoScrollPosition.Y + top);
                top         += us1.Height;
                if (maxWidth < us1.Width)
                {
                    maxWidth = us1.Width;
                }


                Button us2 = ControlAddButton[i];
                us2.Location        = new Point(this.AutoScrollPosition.X, this.AutoScrollPosition.Y + top);
                top                += us2.Height;
                us1.button1.Enabled = true;
                us1.button2.Enabled = true;
                if (i == 0)
                {
                    us1.button1.Enabled = false;
                }
                if (i == ControlOrder.Count - 1)
                {
                    us1.button2.Enabled = false;
                }
            }
            if ((this.Anchor & AnchorStyles.Right) == 0)
            {
                this.Width = this.AutoScrollPosition.X + maxWidth;
            }
            if ((this.Anchor & AnchorStyles.Bottom) == 0)
            {
                this.Height = this.AutoScrollPosition.Y + top;
            }
            if (this.Parent is StatementBase)
            {
                ((StatementBase)this.Parent).Sorting();
            }
        }
Ejemplo n.º 5
0
        public void RemoveStatement(StatementBase statement)
        {
            int IndexNumber = ControlOrder.IndexOf(statement);

            this.Controls.Remove(statement);
            Button btn = ControlAddButton[IndexNumber];

            ControlOrder.Remove(statement);
            ControlAddButton.Remove(btn);
            this.Controls.Remove(statement);
            this.Controls.Remove(btn);
            statement.Dispose();
            btn.Dispose();
            Sorting();
            if (ControlOrder.Count == 0)
            {
                number = 0;
            }
        }
Ejemplo n.º 6
0
 private void AddLoopButton_Click(object sender, EventArgs e)
 {
     Me = new Loop();
     Confirmation(Me);
 }
Ejemplo n.º 7
0
 private void AddImputConsoleButton_Click(object sender, EventArgs e)
 {
     Me = new InputConsole();
     Confirmation(Me);
 }
Ejemplo n.º 8
0
 private void AddCalculationButton_Click(object sender, EventArgs e)
 {
     Me = new Calculation();
     Confirmation(Me);
 }
Ejemplo n.º 9
0
 private void AddConditionsButton_Click(object sender, EventArgs e)
 {
     Me = new Conditions();
     Confirmation(Me);
 }
Ejemplo n.º 10
0
 private void AddVariableDefineButton_Click(object sender, EventArgs e)
 {
     Me = new VariableDefine();
     // ((Form1)this.Owner).statementBlock.InsertContlols("VariableDefine");
     Confirmation(Me);
 }
Ejemplo n.º 11
0
 private void AddBreakButton_Click(object sender, EventArgs e)
 {
     Me = new BreakControl();
     Confirmation(Me);
 }
Ejemplo n.º 12
0
 private void AddReturnMold_Click(object sender, EventArgs e)
 {
     Me = new ReturnMold();
     Confirmation(Me);
 }
Ejemplo n.º 13
0
 private void AddCaseButton_Click(object sender, EventArgs e)
 {
     Me = new CaseControl();
     Confirmation(Me);
 }
Ejemplo n.º 14
0
        public void InsertContlols(StatementBase item)
        {
            IndexNumber++;
            if (item.GetType().Equals(typeof(AddMethod)))
            {
                item.Name = "AddMethod" + number.ToString();
                item.Size = new Size(460, 270);
            }
            if (item.GetType().Equals(typeof(MainMethod)))
            {
                item.Name = "Main" + number.ToString();
                item.Size = new Size(500, 400);
            }
            else if (item.GetType().Equals(typeof(VariableDefine)))
            {
                item.Name = "VariableDefine" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(OutputConsole)))
            {
                item.Name = "OutputConsole" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(Conditions)))
            {
                item.Name = "Conditions" + number.ToString();
                item.Size = new Size(460, 200);
            }
            else if (item.GetType().Equals(typeof(Calculation)))
            {
                item.Name = "Calculation" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(InputConsole)))
            {
                item.Name = "ImputConsole" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(Loop)))
            {
                item.Name = "Loop" + number.ToString();
                item.Size = new Size(460, 200);
            }
            else if (item.GetType().Equals(typeof(ListDefine)))
            {
                item.Name = "ListDefine" + number.ToString();
                item.Size = new Size(460, 200);
            }
            else if (item.GetType().Equals(typeof(ArrayDefine)))
            {
                item.Name = "ArrayDefine" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(BreakControl)))
            {
                item.Name = "ArrayDefine" + number.ToString();
                item.Size = new Size(400, 100);
            }
            else if (item.GetType().Equals(typeof(ReturnMold)))
            {
                item.Name = "ReturnMold" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(Assignment)))
            {
                item.Name = "Assignment" + number.ToString();
                item.Size = new Size(400, 200);
            }
            else if (item.GetType().Equals(typeof(CaseControl)))
            {
                item.Name = "CaseControl" + number.ToString();
            }

            this.Controls.Add(item);
            Button us1 = new Button();

            Name1      = "AddButton" + number.ToString();
            us1.Name   = Name1;
            us1.Size   = new Size(400, 30);
            us1.Text   = "コントロールをたす";
            us1.Click += addbutton;
            this.Controls.Add(us1);
            ControlAddButton.Insert(IndexNumber, us1);

            ControlOrder.Insert(IndexNumber, item);

            number++;

            Sorting();
        }
Ejemplo n.º 15
0
 private void ListDefine_Click(object sender, EventArgs e)
 {
     Me = new ListDefine();
     Confirmation(Me);
 }
Ejemplo n.º 16
0
 private void AddAssignmentButton_Click(object sender, EventArgs e)
 {
     Me = new Assignment();
     Confirmation(Me);
 }
Ejemplo n.º 17
0
 private void ArrayDefineButton_Click(object sender, EventArgs e)
 {
     Me = new ArrayDefine();
     Confirmation(Me);
 }
Ejemplo n.º 18
0
 private void Button1_Click(object sender, EventArgs e)
 {
     Me = new AddMethod();
     Confirmation(Me);
 }
Ejemplo n.º 19
0
 private void Confirmation(StatementBase AddName)
 {
     mTargetStatementBlock.InsertContlols(AddName);
     this.Close();
 }
Ejemplo n.º 20
0
        public static List <string> VariableConfirmation(Control My)
        {
            List <string>        VariableConfirmationList = new List <string>();
            Control              MyParent         = My.Parent;
            StatementBlock       MystatementBlock = (StatementBlock)MyParent;
            List <StatementBase> OrderControls    = new List <StatementBase>();

            OrderControls = MystatementBlock.GetOrderControls();
            for (int i = 0; OrderControls[i] != My; i++)
            {
                if (OrderControls[i].GetType().Equals(typeof(VariableDefine)))
                {
                    VariableDefine variableDefineName = (VariableDefine)OrderControls[i];
                    if (variableDefineName.checkBox1.Checked)
                    {
                        if (variableDefineName.comboBox1.SelectedIndex != 1)
                        {
                            if (string.IsNullOrWhiteSpace(variableDefineName.textBox1.Text) == false || string.IsNullOrEmpty(variableDefineName.comboBox1.Text) == false)
                            {
                                VariableConfirmationList.Add(variableDefineName.textBox1.Text);
                            }
                        }
                        else
                        {
                            VariableConfirmationList.Add(variableDefineName.textBox1.Text);
                        }
                    }
                }
                else if (OrderControls[i].GetType().Equals(typeof(Assignment)))
                {
                    Assignment AssignmentName = (Assignment)OrderControls[i];
                    if (AssignmentName.comboBox1.SelectedIndex != -1)
                    {
                        VariableConfirmationList.Add(AssignmentName.comboBox1.Text);
                    }
                }
                else if (OrderControls[i].GetType().Equals(typeof(ReturnMold)))
                {
                    ReturnMold ReturnMoldName = (ReturnMold)OrderControls[i];
                    if (ReturnMoldName.comboBox2.SelectedIndex != -1)
                    {
                        VariableConfirmationList.Add(ReturnMoldName.comboBox2.Text);
                        if (ReturnMoldName.checkBox1.Checked)
                        {
                            if (ReturnMoldName.comboBox3.SelectedIndex == -1)
                            {
                                VariableConfirmationList.Add(ReturnMoldName.comboBox3.Text);
                            }
                        }
                    }
                }
                else if (OrderControls[i].GetType().Equals(typeof(Calculation)))
                {
                    Calculation CalculationName = (Calculation)OrderControls[i];
                    if (CalculationName.comboBox1.SelectedIndex != -1)
                    {
                        VariableConfirmationList.Add(CalculationName.comboBox1.Text);
                    }
                }
                else if (OrderControls[i].GetType().Equals(typeof(InputConsole)))
                {
                    InputConsole ImputConsoleName = (InputConsole)OrderControls[i];
                    if (ImputConsoleName.comboBox1.SelectedIndex != -1)
                    {
                        VariableConfirmationList.Add(ImputConsoleName.comboBox1.Text);
                    }
                }
            }
            if (MyParent.Parent is StatementBase)
            {
                StatementBase GParent = (StatementBase)MyParent.Parent;
                VariableConfirmationList.AddRange(VariableConfirmation(MyParent.Parent));
            }
            return(VariableConfirmationList);
        }