コード例 #1
0
        /// <summary>
        ///    The event handler for the Click event on the "Add Action" menu item
        /// </summary>
        /// <param name = "sender">The sender.</param>
        /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
        private void AddActionClick(object sender, EventArgs e)
        {
            var profile       = new Profile(string.Empty);
            var profileEditor = new ProfileEditorForm(profile);

            if (profileEditor.ShowDialog(FindForm()) == DialogResult.OK)
            {
                // Do Add
                _profileList.Add(profile);

                // Sort the list
                RefreshProfileList();
                _pendingChanges = true;
            }
        }
コード例 #2
0
        /// <summary>
        ///    The event handler for the Click event on the "Edit Action" menu item
        /// </summary>
        /// <param name = "sender">The sender.</param>
        /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
        private void EditActionClick(object sender, EventArgs e)
        {
            var profileNode   = SelectedNode as ProfileTreeNode;
            var profileEditor = new ProfileEditorForm(profileNode.Profile);

            if (profileEditor.ShowDialog(FindForm()) == DialogResult.OK)
            {
                // Make sure only one is the default
                if (profileNode.Profile.IsDefault)
                {
                    _profileList.Each(p => p.IsDefault = false);
                    profileNode.Profile.IsDefault      = true;
                }

                RefreshProfileList();
                _pendingChanges = true;
            }
        }