コード例 #1
0
        private void buttonConfirm_Click(object sender, EventArgs e)
        {
            textBoxListName.Text = textBoxListName.Text.Trim();

            if (!string.IsNullOrEmpty(textBoxListName.Text))
            {
                if (textBoxListLanguages.Lines.Length > 1)
                {
                    if (!string.IsNullOrEmpty(textBoxListLanguages.Lines[0]) &&
                        !string.IsNullOrEmpty(textBoxListLanguages.Lines[1]))
                    {
                        string[] language = textBoxListLanguages.Lines;

                        for (int i = 0; i < language.Length; i++)
                        {
                            language[i] = language[i].Trim();
                        }

                        WinFormsHelper.New(textBoxListName.Text, language);

                        buttonConfirm.DialogResult = DialogResult.OK;

                        if (parentLoadList != null)
                        {
                            parentLoadList.RefreshListBoxLists();
                        }
                        else
                        {
                            parentWordList.LoadNewList(this);
                        }

                        Close();
                    }
                    else
                    {
                        MessageBox.Show(this, "Enter at least two languages.", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show(this, "Enter at least two languages.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show(this, "Enter a list name.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }