Esempio n. 1
0
        private void addForm()
        {
            if (string.IsNullOrWhiteSpace(txtForm.Text) || string.IsNullOrWhiteSpace(txtTypeForm.Text))
            {
                return;
            }



            if (TextBuilder.rgxText.IsMatch(txtForm.Text) && TextBuilder.rgxText.IsMatch(txtTypeForm.Text))
            {
                if (txtForm.Text.Length != 0 && txtTypeForm.Text.Length != 0)
                {
                    string line = txtForm.Text;
                    if (line.ElementAt(line.Length - 1) == ';')
                    {
                        line.Remove(line.Length - 1);
                    }

                    string[] forms = line.Split(';');


                    line = txtTypeForm.Text;
                    if (line.ElementAt(line.Length - 1) == ';')
                    {
                        line.Remove(line.Length - 1);
                    }

                    string[] typeForms = line.Split(';');

                    if (typeForms.Length == forms.Length)
                    {
                        for (int i = 0; i < forms.Length; i++)
                        {
                            Datastructure.Form frm = new Datastructure.Form(forms[i], typeForms[i]);
                            wrdBuilder.addForm(frm);
                        }
                    }
                }
            }
        }