Beispiel #1
0
        private void btnAddWord_Click(object sender, EventArgs e)
        {
            if (rgx.IsMatch(txtWord.Text))
            {
                wrdBuilder.setTitle(txtWord.Text);

                if (rgxText.IsMatch(txtOri.Text))
                {
                    wrdBuilder.setOrigin(txtOri.Text);
                }
                else
                {
                    wrdBuilder.setOrigin("");
                }

                if (rgxText.IsMatch(txtNote.Text))
                {
                    wrdBuilder.setNote(txtNote.Text);
                }
                else
                {
                    wrdBuilder.setNote("");
                }

                if (rgx.IsMatch(txtType.Text))
                {
                    wrdBuilder.setType(txtType.Text);
                }
                else
                {
                    wrdBuilder.setType("");
                }


                dictManger.CurDict().add(wrdBuilder.build());
                clrTextFields();
            }
            else
            {
                MessageBox.Show("Inserire una parola!");
            }
        }
Beispiel #2
0
        private void btnAddWord_Click(object sender, EventArgs e)
        {
            if (TextBuilder.rgx.IsMatch(txtWord.Text))
            {
                wrdBuilder.setTitle(txtWord.Text);

                if (TextBuilder.rgxText.IsMatch(txtOri.Text))
                {
                    wrdBuilder.setOrigin(txtOri.Text);
                }
                else
                {
                    wrdBuilder.setOrigin("");
                }

                if (TextBuilder.rgxText.IsMatch(txtNote.Text))
                {
                    wrdBuilder.setNote(txtNote.Text);
                }
                else
                {
                    wrdBuilder.setNote("");
                }

                addForm();

                wrdBuilder.setType((string)cmbTipo.SelectedItem);
                Word wrd = (Word)wrdBuilder.build();
                dictManger.CurDict().add(wrd);

                clrTextFields();
            }
            else
            {
                MessageBox.Show("Inserire una parola adatta!");
            }
        }