예제 #1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            string temp_result = this.textBox1.Text.Trim();

            result = "";
            if (temp_result.Length == 0)
            {
                this.label4.Text = "Can't have blank name";
            }
            else if (!Char.IsLetter(temp_result, 0))
            {
                this.label4.Text = "Name must begin with letter";
            }
            else if (!All_Legal(temp_result))
            {
                this.label4.Text = "Use only letter, number, or underscore";
            }
            else if (!token_helpers_pkg.verify_id(temp_result))
            {
                this.label4.Text = temp_result + " is a reserved word";
            }
            else if (form.Is_Subchart_Name(temp_result) && temp_result.ToLower() != init_name)
            {
                this.label4.Text = temp_result + " is already used";
            }
            else
            {
                result = temp_result;
                this.Close();
            }
        }
예제 #2
0
 public static bool Is_Subchart_Name(string s)
 {
     return(form.Is_Subchart_Name(s));
 }
예제 #3
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            bool   have_error;
            int    param_count = 0;
            string temp_result = this.textBoxProcedureName.Text.Trim();

            result = "";
            if (temp_result.Length == 0)
            {
                this.labelError.Text = "Procedure name must not be blank";
                have_error           = true;
                return;
            }
            else if (form.Is_Subchart_Name(temp_result) && temp_result.ToLower() != init_name)
            {
                this.labelError.Text = temp_result + " is already used";
                have_error           = true;
                return;
            }
            string[] parameters = new string[6];
            parameters[0] = this.textBoxParam1.Text.Trim();
            parameters[1] = this.textBoxParam2.Text.Trim();
            parameters[2] = this.textBoxParam3.Text.Trim();
            parameters[3] = this.textBoxParam4.Text.Trim();
            parameters[4] = this.textBoxParam5.Text.Trim();
            parameters[5] = this.textBoxParam6.Text.Trim();
            bool[] inputs = new bool[6];
            inputs[0] = this.checkBoxInput1.Checked;
            inputs[1] = this.checkBoxInput2.Checked;
            inputs[2] = this.checkBoxInput3.Checked;
            inputs[3] = this.checkBoxInput4.Checked;
            inputs[4] = this.checkBoxInput5.Checked;
            inputs[5] = this.checkBoxInput6.Checked;
            bool[] outputs = new bool[6];
            outputs[0] = this.checkBoxOutput1.Checked;
            outputs[1] = this.checkBoxOutput2.Checked;
            outputs[2] = this.checkBoxOutput3.Checked;
            outputs[3] = this.checkBoxOutput4.Checked;
            outputs[4] = this.checkBoxOutput5.Checked;
            outputs[5] = this.checkBoxOutput6.Checked;

            have_error = Check_Name(temp_result, "Procedure name ");
            if (have_error)
            {
                return;
            }
            for (int i = 0; i < parameters.Length; i++)
            {
                if (parameters[i] != "")
                {
                    param_count++;
                    have_error = Check_Name(parameters[i], "Parameter " + (i + 1) + " ");
                    for (int j = i + 1; j < parameters.Length; j++)
                    {
                        if (parameters[j].ToLower() == parameters[i].ToLower())
                        {
                            this.labelError.Text = "Can not have two parameters (" +
                                                   (i + 1) + ") and (" + (j + 1) + ") named the same.";
                            have_error = true;
                        }
                    }
                }
                else
                {
                    for (int j = i + 1; j < parameters.Length; j++)
                    {
                        if (parameters[j] != "")
                        {
                            this.labelError.Text = "Can not have blank parameter (" +
                                                   (i + 1) + ") before non-blank (" + (j + 1) + ")";
                            have_error = true;
                        }
                    }
                }
                if (have_error)
                {
                    return;
                }
            }

            if (!have_error)
            {
                param_names     = new string[param_count];
                param_is_input  = new bool[param_count];
                param_is_output = new bool[param_count];
                for (int i = 0; i < param_count; i++)
                {
                    param_names[i]     = parameters[i];
                    param_is_input[i]  = inputs[i];
                    param_is_output[i] = outputs[i];
                }
                result = temp_result;

                this.Close();
            }
        }