示例#1
0
        private void ChangeEditor()
        {
            if (InputValid())
            {
                if (NameChanged() || InputChanged())
                {
                    TrimInput();

                    if (ApplicationExists())
                    {
                        if (EditorCollection.GetByName(textBoxName.Text) != null && NameChanged())
                        {
                            MessageBox.Show("An editor with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            EditorCollection.Get(EditorObject).Application = textBoxApplication.Text;
                            EditorCollection.Get(EditorObject).Arguments   = textBoxArguments.Text;
                            EditorCollection.Get(EditorObject).Name        = textBoxName.Text;
                            EditorCollection.Get(EditorObject).Notes       = textBoxNotes.Text;

                            Okay();
                        }
                    }
                    else
                    {
                        MessageBox.Show($"Could not find \"{textBoxApplication.Text}\".", "Application Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void ChangeEditor()
        {
            if (InputChanged())
            {
                TrimInput();

                if (EditorCollection.GetByName(textBoxEditorName.Text) == null)
                {
                    EditorCollection.Get(EditorObject).Application = textBoxEditorApplication.Text;
                    EditorCollection.Get(EditorObject).Arguments   = textBoxEditorArguments.Text;
                    EditorCollection.Get(EditorObject).Name        = textBoxEditorName.Text;

                    Okay();
                }
                else
                {
                    MessageBox.Show("An editor with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                Close();
            }
        }