예제 #1
0
        private void lstDates_AddClick(object sender, EventArgs e)
        {
            var date = new SpecialDate
            {
                Date        = DateTime.Today,
                IncludeYear = false,
                Type        = SpecialDateType.Birthday,
            };

            using (var dlg = new EditSpecialDateDialog(date))
            {
                dlg.Text = "Add Date";
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    dates.Add(date);
                }
            }
        }
예제 #2
0
        private void lstDates_EditClick(object sender, EventArgs e)
        {
            var item = lstEmails.SelectedItems.Cast <SpecialDate>().FirstOrDefault();

            if (item != null)
            {
                var copy = item.Duplicate();
                using (var dlg = new EditSpecialDateDialog(copy))
                {
                    dlg.Text = "Edit Date";
                    if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        var index = dates.IndexOf(item);
                        dates[index] = copy;
                        dates.ResetItem(index);
                    }
                }
            }
        }