Esempio n. 1
0
 public static SpecialDate Duplicate(this SpecialDate date)
 {
     return(new SpecialDate
     {
         Date = date.Date,
         IncludeYear = date.IncludeYear,
         Type = date.Type,
     });
 }
        public EditSpecialDateDialog(SpecialDate date)
        {
            InitializeComponent();
            cboTypes.Properties.FillWithEnum <SpecialDateType>();

            chkIncludeYear.DataBindings.Add("Checked", date, "IncludeYear");
            dtDate.DataBindings.Add("DateTime", date, "Date");
            cboTypes.DataBindings.Add("EditValue", date, "Type");
        }
        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);
                }
            }
        }