Beispiel #1
0
        /// <summary>
        /// Edit the selected text editor.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]		07/20/2006	Created
        /// </history>
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            if (tbcOptions.SelectedTab == tabTextEditors)
             {
            if (TextEditorsList.SelectedItems.Count > 0)
            {
               ListViewItem item = TextEditorsList.SelectedItems[0];
               frmAddEditTextEditor dlg = new frmAddEditTextEditor();

               // set values
               dlg.IsAdd = false;
               dlg.IsAllTypesDefined = IsAllTypesDefined();
               dlg.TextEditorFileType = item.Text;
               dlg.TextEditorLocation = item.SubItems[1].Text;
               dlg.TextEditorCommandLine = item.SubItems[2].Text;

               if (dlg.ShowDialog(this) == DialogResult.OK)
               {
                  // get values
                  TextEditorsList.SelectedItems[0].Text = dlg.TextEditorFileType;
                  TextEditorsList.SelectedItems[0].SubItems[1].Text = dlg.TextEditorLocation;
                  TextEditorsList.SelectedItems[0].SubItems[2].Text = dlg.TextEditorCommandLine;
               }

               SetTextEditorsButtonState();
            }
             }

             this.DialogResult = DialogResult.None;
        }
Beispiel #2
0
        /// <summary>
        /// Add a new text editor.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]		07/20/2006	Created
        /// </history>
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (tbcOptions.SelectedTab == tabTextEditors)
             {
            frmAddEditTextEditor dlg = new frmAddEditTextEditor();
            dlg.IsAdd = true;
            dlg.IsAllTypesDefined = IsAllTypesDefined();
            dlg.ExistingFileTypes = GetExistingFileTypes();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
               // create new entry
               ListViewItem item = new ListViewItem();
               item.Text = dlg.TextEditorFileType;
               item.SubItems.Add(dlg.TextEditorLocation);
               item.SubItems.Add(dlg.TextEditorCommandLine);
               TextEditorsList.Items.Add(item);

               SetTextEditorsButtonState();
            }
             }

             this.DialogResult = DialogResult.None;
        }