/// <summary> /// Edit a calendar item /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEdit_Click(object sender, EventArgs e) { if(dgvCalendar.CurrentCellAddress.Y == -1) { MessageBox.Show("Please select an item to edit", "No Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } switch(cboComponents.SelectedIndex) { case 0: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.Events[dgvCalendar.CurrentCellAddress.Y]); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.Events[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 1: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.ToDos[dgvCalendar.CurrentCellAddress.Y]); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.ToDos[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 2: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.Journals[dgvCalendar.CurrentCellAddress.Y]); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.Journals[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 3: using(VFreeBusyDlg dlg = new VFreeBusyDlg()) { dlg.SetValues(vCal.FreeBusys[dgvCalendar.CurrentCellAddress.Y]); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.FreeBusys[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; } }
/// <summary> /// Edit a calendar item /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEdit_Click(object sender, EventArgs e) { if (dgvCalendar.CurrentCellAddress.Y == -1) { MessageBox.Show("Please select an item to edit", "No Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } switch (cboComponents.SelectedIndex) { case 0: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.Events[dgvCalendar.CurrentCellAddress.Y]); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.Events[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 1: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.ToDos[dgvCalendar.CurrentCellAddress.Y]); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.ToDos[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 2: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { dlg.SetValues(vCal.Journals[dgvCalendar.CurrentCellAddress.Y]); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.Journals[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; case 3: using (VFreeBusyDlg dlg = new VFreeBusyDlg()) { dlg.SetValues(vCal.FreeBusys[dgvCalendar.CurrentCellAddress.Y]); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCal.FreeBusys[dgvCalendar.CurrentCellAddress.Y]); wasModified = true; } } break; } }
/// <summary> /// Add a calendar item /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAdd_Click(object sender, EventArgs e) { switch(cboComponents.SelectedIndex) { case 0: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { VEvent evt = new VEvent(); evt.UniqueId.AssignNewId(true); evt.DateCreated.TimeZoneDateTime = DateTime.Now; evt.LastModified.TimeZoneDateTime = evt.DateCreated.TimeZoneDateTime; dlg.SetValues(evt); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(evt); // Create a unique ID for the new item evt.UniqueId.AssignNewId(true); vCal.Events.Add(evt); } } break; case 1: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { VToDo td = new VToDo(); td.DateCreated.TimeZoneDateTime = DateTime.Now; td.LastModified.TimeZoneDateTime = td.DateCreated.TimeZoneDateTime; dlg.SetValues(td); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(td); // Create a unique ID for the new item td.UniqueId.AssignNewId(true); vCal.ToDos.Add(td); } } break; case 2: using(CalendarObjectDlg dlg = new CalendarObjectDlg()) { VJournal j = new VJournal(); j.DateCreated.TimeZoneDateTime = DateTime.Now; j.LastModified.TimeZoneDateTime = j.DateCreated.TimeZoneDateTime; dlg.SetValues(j); if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(j); // Create a unique ID for the new item j.UniqueId.AssignNewId(true); vCal.Journals.Add(j); } } break; case 3: using(VFreeBusyDlg dlg = new VFreeBusyDlg()) { if(dlg.ShowDialog() == DialogResult.OK) { VFreeBusy fb = new VFreeBusy(); dlg.GetValues(fb); // Create a unique ID for the new item fb.UniqueId.AssignNewId(true); vCal.FreeBusys.Add(fb); } } break; } }
/// <summary> /// Add a calendar item /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAdd_Click(object sender, EventArgs e) { switch (cboComponents.SelectedIndex) { case 0: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { VEvent evt = new VEvent(); evt.UniqueId.AssignNewId(true); evt.DateCreated.TimeZoneDateTime = DateTime.Now; evt.LastModified.TimeZoneDateTime = evt.DateCreated.TimeZoneDateTime; dlg.SetValues(evt); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(evt); // Create a unique ID for the new item evt.UniqueId.AssignNewId(true); vCal.Events.Add(evt); } } break; case 1: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { VToDo td = new VToDo(); td.DateCreated.TimeZoneDateTime = DateTime.Now; td.LastModified.TimeZoneDateTime = td.DateCreated.TimeZoneDateTime; dlg.SetValues(td); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(td); // Create a unique ID for the new item td.UniqueId.AssignNewId(true); vCal.ToDos.Add(td); } } break; case 2: using (CalendarObjectDlg dlg = new CalendarObjectDlg()) { VJournal j = new VJournal(); j.DateCreated.TimeZoneDateTime = DateTime.Now; j.LastModified.TimeZoneDateTime = j.DateCreated.TimeZoneDateTime; dlg.SetValues(j); if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(j); // Create a unique ID for the new item j.UniqueId.AssignNewId(true); vCal.Journals.Add(j); } } break; case 3: using (VFreeBusyDlg dlg = new VFreeBusyDlg()) { if (dlg.ShowDialog() == DialogResult.OK) { VFreeBusy fb = new VFreeBusy(); dlg.GetValues(fb); // Create a unique ID for the new item fb.UniqueId.AssignNewId(true); vCal.FreeBusys.Add(fb); } } break; } }