コード例 #1
0
        /// <summary>
        /// The ButtonModify_Click method.
        /// </summary>
        /// <param name="sender">The <paramref name="sender"/> parameter.</param>
        /// <param name="args">The <paramref name="args"/> parameter.</param>
        private void ButtonModify_Click(object sender, EventArgs args)
        {
            if (lvMemberManager.SelectedItems.Count == 0)
            {
                return;
            }

            var member = (Member)lvMemberManager.SelectedItems[0].Tag;

            // Show the ModifyMemberForm dialog.
            DialogResult result;

            using (var modifyMemberForm = new ModifyMemberForm(member))
            {
                result = modifyMemberForm.ShowDialog();
            }

            // If the dialog was closed without clicking OK then skip the refresh.
            if (result != DialogResult.OK)
            {
                return;
            }

            // Refresh the items in the list view.
            PopulateMembers();
            lvMemberManager.Refresh();
        }
コード例 #2
0
        /// <summary>
        /// The ButtonAdd_Click method.
        /// </summary>
        /// <param name="sender">The <paramref name="sender"/> parameter.</param>
        /// <param name="args">The <paramref name="args"/> parameter.</param>
        private void ButtonAdd_Click(object sender, EventArgs args)
        {
            // Show the ModifyMemberForm dialog.
            DialogResult result;

            using (var modifyMemberForm = new ModifyMemberForm(null))
            {
                result = modifyMemberForm.ShowDialog();
            }

            // If the dialog was closed without clicking OK then skip the refresh.
            if (result != DialogResult.OK)
            {
                return;
            }

            // Refresh the items in the list view.
            PopulateMembers();
            lvMemberManager.Refresh();
        }