/// <summary> /// Add a recurrence date /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event parameters</param> private void btnAddRDate_Click(object sender, EventArgs e) { // Add a recurrence date to the collection and the list box. If "Exclude whole day" is checked, the // time part is omitted. if (chkExcludeDay.Checked) { RDateProperty rdate = new RDateProperty(); rdate.ValueLocation = ValLocValue.Date; rdate.TimeZoneDateTime = dtpRDate.Value.Date; rDates.Add(rdate); lbRDates.Items.Add(dtpRDate.Value.Date.ToString("d")); } else { RDateProperty rdate = new RDateProperty(); rdate.TimeZoneDateTime = dtpRDate.Value; rDates.Add(rdate); lbRDates.Items.Add(dtpRDate.Value.ToString("G")); } this.SetButtonStates(); }
/// <summary> /// Initialize the dialog controls using the specified exception rule and exception date collections /// </summary> /// <param name="er">The exception rules from which to get the settings</param> /// <param name="ed">The exception dates from which to get the settings</param> public void SetValues(RRulePropertyCollection er, ExDatePropertyCollection ed) { rRules.Clear(); rDates.Clear(); rRules.CloneRange(er); // Convert the exception dates to RDate format internally foreach (ExDateProperty edate in ed) { RDateProperty rd = new RDateProperty(); rd.ValueLocation = edate.ValueLocation; rd.TimeZoneId = edate.TimeZoneId; rd.TimeZoneDateTime = edate.TimeZoneDateTime; rDates.Add(rd); } lbRRules.Items.Clear(); foreach (RRuleProperty r in rRules) { lbRRules.Items.Add(r.Recurrence.ToString()); } lbRDates.Items.Clear(); foreach (RDateProperty rdt in rDates) { if (rdt.ValueLocation == ValLocValue.Date) { lbRDates.Items.Add(rdt.TimeZoneDateTime.ToString("d")); } else { lbRDates.Items.Add(rdt.TimeZoneDateTime.ToString("G")); } } this.SetButtonStates(); }