Beispiel #1
0
        private void add_Click(object sender, EventArgs e)
        {
            var form = new TeamMemberForm(new TeamMember());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                listBox1.Items.Add(form.tm);
            }
            numericUpDownCount.Value = listBox1.Items.Count;

            save.Enabled = true;
        }
Beispiel #2
0
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            var tm = listBox1.SelectedItem as TeamMember;

            if (tm == null)
            {
                return;
            }

            var form = new TeamMemberForm(tm.Clone());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                var si = listBox1.SelectedIndex;
                listBox1.Items.RemoveAt(si);
                listBox1.Items.Insert(si, form.tm);
            }

            numericUpDownCount.Value = listBox1.Items.Count;
        }