private async void Button_Clicked(object sender, EventArgs e)
        {
            var add = new VToDo();
            await Navigation.PushModalAsync(new NavigationPage(add));

            while (!add.Done)
            {
                await Task.Delay(100);
            }
            ///////
            //if (add.IsInserted)
            //{
            //    TransactionCollection.Add(add.Transaction);
            //    CalculateTransactions();
            //    UpdateProgressValue();
            //}
        }
Exemplo n.º 2
0
        /// <summary>
        /// This is an example of how you can sort calendar object collections
        /// </summary>
        /// <param name="x">The first calendar object</param>
        /// <param name="y">The second calendar object</param>
        /// <remarks>Due to the variety of properties in a calendar object, sorting is left up to the developer
        /// utilizing a comparison delegate.  This example sorts the collection by the start date/time property
        /// and, if they are equal, the summary description.  This is used to handle all of the collection
        /// types.</remarks>
        private static int CalendarSorter(CalendarObject x, CalendarObject y)
        {
            DateTime d1, d2;
            string   summary1, summary2;

            if (x is VEvent)
            {
                VEvent e1 = (VEvent)x, e2 = (VEvent)y;

                d1       = e1.StartDateTime.TimeZoneDateTime;
                d2       = e2.StartDateTime.TimeZoneDateTime;
                summary1 = e1.Summary.Value;
                summary2 = e2.Summary.Value;
            }
            else
            if (x is VToDo)
            {
                VToDo t1 = (VToDo)x, t2 = (VToDo)y;

                d1       = t1.StartDateTime.TimeZoneDateTime;
                d2       = t2.StartDateTime.TimeZoneDateTime;
                summary1 = t1.Summary.Value;
                summary2 = t2.Summary.Value;
            }
            else
            if (x is VJournal)
            {
                VJournal j1 = (VJournal)x, j2 = (VJournal)y;

                d1       = j1.StartDateTime.TimeZoneDateTime;
                d2       = j2.StartDateTime.TimeZoneDateTime;
                summary1 = j1.Summary.Value;
                summary2 = j2.Summary.Value;
            }
            else
            {
                VFreeBusy f1 = (VFreeBusy)x, f2 = (VFreeBusy)y;

                d1       = f1.StartDateTime.TimeZoneDateTime;
                d2       = f2.StartDateTime.TimeZoneDateTime;
                summary1 = f1.Organizer.Value;
                summary2 = f2.Organizer.Value;
            }

            if (d1.CompareTo(d2) == 0)
            {
                if (summary1 == null)
                {
                    summary1 = String.Empty;
                }

                if (summary2 == null)
                {
                    summary2 = String.Empty;
                }

                // For descending order, change this to compare summary 2 to summary 1 instead
                return(String.Compare(summary1, summary2, StringComparison.CurrentCulture));
            }

            // For descending order, change this to compare date 2 to date 1 instead
            return(d1.CompareTo(d2));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Store To-Do information from the controls
        /// </summary>
        /// <param name="td">The To-Do to use</param>
        private bool StoreToDoInfo(VToDo td)
        {
            DateTime startDate = DateTime.MinValue, endDate = DateTime.MinValue, completedDate = DateTime.MinValue;
            Duration dur = Duration.Zero;

            lblMsg.Text = null;

            // Perform some edits
            if (txtStartDate.Text.Trim().Length != 0 && !DateTime.TryParse(txtStartDate.Text,
                                                                           CultureInfo.CurrentCulture, DateTimeStyles.None, out startDate))
            {
                lblMsg.Text = "Invalid start date format<br>";
            }

            if (txtEndDate.Text.Trim().Length != 0 && !DateTime.TryParse(txtEndDate.Text,
                                                                         CultureInfo.CurrentCulture, DateTimeStyles.None, out endDate))
            {
                lblMsg.Text = "Invalid end date format<br>";
            }

            if (txtCompleted.Text.Trim().Length != 0 && !DateTime.TryParse(txtCompleted.Text,
                                                                           CultureInfo.CurrentCulture, DateTimeStyles.None, out completedDate))
            {
                lblMsg.Text = "Invalid completed date format<br>";
            }

            if (txtDuration.Text.Trim().Length != 0 && !Duration.TryParse(txtDuration.Text, out dur))
            {
                lblMsg.Text += "Invalid duration format<br>";
            }

            if (!String.IsNullOrWhiteSpace(lblMsg.Text))
            {
                return(false);
            }

            // Unique ID is not changed
            td.LastModified.TimeZoneDateTime = DateTime.Now;

            if (txtSequence.Text.Trim().Length == 0)
            {
                td.Sequence.SequenceNumber = 0;
            }
            else
            {
                td.Sequence.SequenceNumber = Convert.ToInt32(txtSequence.Text);
            }

            if (txtPriority.Text.Trim().Length == 0)
            {
                td.Priority.PriorityValue = 0;
            }
            else
            {
                td.Priority.PriorityValue = Convert.ToInt32(txtPriority.Text);
            }

            td.StartDateTime.TimeZoneDateTime     = startDate;
            td.StartDateTime.ValueLocation        = ValLocValue.DateTime;
            td.DueDateTime.TimeZoneDateTime       = endDate;
            td.DueDateTime.ValueLocation          = ValLocValue.DateTime;
            td.CompletedDateTime.TimeZoneDateTime = completedDate;
            td.CompletedDateTime.ValueLocation    = ValLocValue.DateTime;

            if (txtPercent.Text.Trim().Length == 0)
            {
                td.PercentComplete.Percentage = 0;
            }
            else
            {
                td.PercentComplete.Percentage = Convert.ToInt32(txtPercent.Text);
            }

            td.Duration.DurationValue = dur;
            td.Summary.Value          = txtSummary.Text;
            td.Description.Value      = txtDescription.Text;
            td.Organizer.Value        = txtOrganizer.Text;
            td.Url.Value     = txtUrl.Text;
            td.Comment.Value = txtComments.Text;

            // Get status value
            td.Status.StatusValue = (StatusValue)Enum.Parse(typeof(StatusValue),
                                                            cboStatus.Items[cboStatus.SelectedIndex].ToString(), true);

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Load To-Do information into the controls
        /// </summary>
        /// <param name="td">The To-Do to use</param>
        private void LoadToDoInfo(VToDo td)
        {
            chkTransparent.Enabled = txtLocation.Enabled = false;

            lblEndDate.Text = "Due";

            lblUniqueId.Text = td.UniqueId.Value;
            lblTimeZone.Text = td.StartDateTime.TimeZoneId;
            txtSequence.Text = td.Sequence.SequenceNumber.ToString();
            txtPriority.Text = td.Priority.PriorityValue.ToString();

            // General
            if (td.StartDateTime.TimeZoneDateTime != DateTime.MinValue)
            {
                txtStartDate.Text = td.StartDateTime.TimeZoneDateTime.ToString("G");
            }

            // We'll reuse End Date for Due Date
            if (td.DueDateTime.TimeZoneDateTime != DateTime.MinValue)
            {
                txtEndDate.Text = td.DueDateTime.TimeZoneDateTime.ToString("G");
            }

            if (td.CompletedDateTime.TimeZoneDateTime != DateTime.MinValue)
            {
                txtCompleted.Text = td.CompletedDateTime.TimeZoneDateTime.ToString("G");
            }

            if (td.Duration.DurationValue != Duration.Zero)
            {
                txtDuration.Text = td.Duration.DurationValue.ToString(Duration.MaxUnit.Weeks);
            }

            txtPercent.Text     = td.PercentComplete.Percentage.ToString();
            txtSummary.Text     = td.Summary.Value;
            txtDescription.Text = td.Description.Value;
            txtOrganizer.Text   = td.Organizer.Value;
            txtUrl.Text         = td.Url.Value;
            txtComments.Text    = td.Comment.Value;

            // Load status values and set status
            cboStatus.Items.Add("None");
            cboStatus.Items.Add("NeedsAction");
            cboStatus.Items.Add("Completed");
            cboStatus.Items.Add("InProcess");
            cboStatus.Items.Add("Cancelled");

            if (cboStatus.Items.FindByValue(td.Status.StatusValue.ToString()) == null)
            {
                cboStatus.Items.Add(td.Status.StatusValue.ToString());
            }

            cboStatus.SelectedValue = td.Status.StatusValue.ToString();

            dgAttendees.DataSource   = td.Attendees;
            dgRecurrences.DataSource = td.RecurrenceRules;
            dgRecurDates.DataSource  = td.RecurDates;
            dgExceptions.DataSource  = td.ExceptionRules;
            dgExDates.DataSource     = td.ExceptionDates;
            dgReqStats.DataSource    = td.RequestStatuses;
        }
Exemplo n.º 5
0
        /// <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;
            }
        }
Exemplo n.º 6
0
        //=====================================================================

        /// <summary>
        /// Initialize the dialog controls using the specified object
        /// </summary>
        /// <param name="oCal">The calendar object from which to get the settings</param>
        public void SetValues(CalendarObject oCal)
        {
            string timeZoneId  = null;
            bool   isICalendar = (oCal.Version == SpecificationVersions.iCalendar20);

            // Disable controls that aren't relevant to the vCalendar spec
            txtDuration.Enabled      = txtOrganizer.Enabled = ucRequestStatus.Enabled = txtLatitude.Enabled =
                txtLongitude.Enabled = btnFind.Enabled = cboTimeZone.Enabled = btnApplyTZ.Enabled = isICalendar;

            if (oCal is VEvent)
            {
                VEvent e = (VEvent)oCal;
                this.Text = "Event Properties";

                lblCompleted.Visible = dtpCompleted.Visible = lblPercent.Visible = udcPercent.Visible = false;
                lblEndDate.Text      = "End";

                // Header
                txtUniqueId.Text       = e.UniqueId.Value;
                chkTransparent.Checked = e.Transparency.IsTransparent;
                txtCreated.Text        = e.DateCreated.TimeZoneDateTime.ToString("G");
                txtLastModified.Text   = e.LastModified.TimeZoneDateTime.ToString("G");
                txtClass.Text          = e.Classification.Value;
                udcSequence.Value      = e.Sequence.SequenceNumber;
                udcPriority.Value      = e.Priority.PriorityValue;

                timeZoneId = e.StartDateTime.TimeZoneId;

                // General
                if (e.StartDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpStartDate.Checked = false;
                }
                else
                {
                    dtpStartDate.Value   = e.StartDateTime.TimeZoneDateTime;
                    dtpStartDate.Checked = true;
                }

                if (e.EndDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpEndDate.Checked = false;
                }
                else
                {
                    dtpEndDate.Value   = e.EndDateTime.TimeZoneDateTime;
                    dtpEndDate.Checked = true;
                }

                if (e.Duration.DurationValue != Duration.Zero)
                {
                    txtDuration.Text = e.Duration.DurationValue.ToString(Duration.MaxUnit.Weeks);
                }

                txtSummary.Text     = e.Summary.Value;
                txtLocation.Text    = e.Location.Value;
                txtDescription.Text = e.Description.Value;

                // Load status values and set status
                cboStatus.Items.AddRange(new[] { "None", "Tentative", "Confirmed", "Cancelled" });

                if (!cboStatus.Items.Contains(e.Status.StatusValue.ToString()))
                {
                    cboStatus.Items.Add(e.Status.StatusValue.ToString());
                }

                cboStatus.SelectedIndex = cboStatus.Items.IndexOf(e.Status.StatusValue.ToString());

                // We'll edit categories and resources as comma separated strings
                txtCategories.Text = e.Categories.CategoriesString;
                txtResources.Text  = e.Resources.ResourcesString;

                txtOrganizer.Text = e.Organizer.Value;

                // We could bind directly to the existing collections but that would modify them.  To preserve
                // the original items, we'll pass a copy of the collections instead.

                // Attendees
                ucAttendees.BindingSource.DataSource = new AttendeePropertyCollection().CloneRange(e.Attendees);

                // Recurrences and exceptions
                ucRecurrences.SetValues(e.RecurrenceRules, e.RecurDates);
                ucExceptions.SetValues(e.ExceptionRules, e.ExceptionDates);

                // Set attachments
                ucAttachments.SetValues(e.Attachments);

                // Set alarms
                ucAlarms.BindingSource.DataSource = new VAlarmCollection().CloneRange(e.Alarms);

                // Miscellaneous
                txtLatitude.Text  = e.GeographicPosition.Latitude.ToString();
                txtLongitude.Text = e.GeographicPosition.Longitude.ToString();

                ucRequestStatus.BindingSource.DataSource = new RequestStatusPropertyCollection().CloneRange(e.RequestStatuses);

                txtUrl.Text      = e.Url.Value;
                txtComments.Text = e.Comment.Value;
            }
            else if (oCal is VToDo)
            {
                VToDo td = (VToDo)oCal;
                this.Text = "To-Do Properties";

                chkTransparent.Visible = lblLocation.Visible = txtLocation.Visible = false;

                lblCompleted.Visible = dtpCompleted.Visible = lblPercent.Visible = udcPercent.Visible = true;
                lblEndDate.Text      = "Due";

                // Header
                txtUniqueId.Text     = td.UniqueId.Value;
                txtCreated.Text      = td.DateCreated.TimeZoneDateTime.ToString("G");
                txtLastModified.Text = td.LastModified.TimeZoneDateTime.ToString("G");
                txtClass.Text        = td.Classification.Value;
                udcSequence.Value    = td.Sequence.SequenceNumber;
                udcPriority.Value    = td.Priority.PriorityValue;

                timeZoneId = td.StartDateTime.TimeZoneId;

                // General
                if (td.StartDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpStartDate.Checked = false;
                }
                else
                {
                    dtpStartDate.Value   = td.StartDateTime.TimeZoneDateTime;
                    dtpStartDate.Checked = true;
                }

                // We'll reuse End Date for Due Date
                if (td.DueDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpEndDate.Checked = false;
                }
                else
                {
                    dtpEndDate.Value   = td.DueDateTime.TimeZoneDateTime;
                    dtpEndDate.Checked = true;
                }

                if (td.CompletedDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpCompleted.Checked = false;
                }
                else
                {
                    dtpCompleted.Value   = td.CompletedDateTime.TimeZoneDateTime;
                    dtpCompleted.Checked = true;
                }

                if (td.Duration.DurationValue != Duration.Zero)
                {
                    txtDuration.Text = td.Duration.DurationValue.
                                       ToString(Duration.MaxUnit.Weeks);
                }

                udcPercent.Value    = td.PercentComplete.Percentage;
                txtSummary.Text     = td.Summary.Value;
                txtDescription.Text = td.Description.Value;

                // Load status values and set status
                cboStatus.Items.AddRange(new[] { "None", "NeedsAction", "Completed", "InProcess", "Cancelled" });

                if (!cboStatus.Items.Contains(td.Status.StatusValue.ToString()))
                {
                    cboStatus.Items.Add(td.Status.StatusValue.ToString());
                }

                cboStatus.SelectedIndex = cboStatus.Items.IndexOf(td.Status.StatusValue.ToString());

                // We'll edit categories and resources as comma separated strings
                txtCategories.Text = td.Categories.CategoriesString;
                txtResources.Text  = td.Resources.ResourcesString;

                txtOrganizer.Text = td.Organizer.Value;

                // We could bind directly to the existing collections but that would modify them.  To preserve
                // the original items, we'll pass a copy of the collections instead.

                // Attendees
                ucAttendees.BindingSource.DataSource = new AttendeePropertyCollection().CloneRange(td.Attendees);

                // Recurrences and exceptions
                ucRecurrences.SetValues(td.RecurrenceRules, td.RecurDates);
                ucExceptions.SetValues(td.ExceptionRules, td.ExceptionDates);

                // Set attachments
                ucAttachments.SetValues(td.Attachments);

                // Set alarms
                ucAlarms.BindingSource.DataSource = new VAlarmCollection().CloneRange(td.Alarms);

                // Miscellaneous
                txtLatitude.Text  = td.GeographicPosition.Latitude.ToString();
                txtLongitude.Text = td.GeographicPosition.Longitude.ToString();

                ucRequestStatus.BindingSource.DataSource = new RequestStatusPropertyCollection().CloneRange(td.RequestStatuses);

                txtUrl.Text      = td.Url.Value;
                txtComments.Text = td.Comment.Value;
            }
            else if (oCal is VJournal)
            {
                VJournal j = (VJournal)oCal;
                this.Text = "Journal Properties";

                chkTransparent.Visible               = lblPriority.Visible = udcPriority.Visible = lblEndDate.Visible =
                    dtpEndDate.Visible               = lblDuration.Visible = txtDuration.Visible = lblLocation.Visible =
                        txtLocation.Visible          = lblResources.Visible = txtResources.Visible = lblLatitude.Visible =
                            txtLatitude.Visible      = lblLongitude.Visible = txtLongitude.Visible = btnFind.Visible =
                                lblCompleted.Visible = dtpCompleted.Visible = lblPercent.Visible = udcPercent.Visible = false;

                tabInfo.TabPages.Remove(pgAlarms);
                tabInfo.SelectedTab = pgGeneral;

                // Header
                txtUniqueId.Text     = j.UniqueId.Value;
                txtCreated.Text      = j.DateCreated.TimeZoneDateTime.ToString("G");
                txtLastModified.Text = j.LastModified.TimeZoneDateTime.ToString("G");
                txtClass.Text        = j.Classification.Value;
                udcSequence.Value    = j.Sequence.SequenceNumber;

                timeZoneId = j.StartDateTime.TimeZoneId;

                // General
                if (j.StartDateTime.TimeZoneDateTime == DateTime.MinValue)
                {
                    dtpStartDate.Checked = false;
                }
                else
                {
                    dtpStartDate.Value   = j.StartDateTime.TimeZoneDateTime;
                    dtpStartDate.Checked = true;
                }

                txtSummary.Text     = j.Summary.Value;
                txtDescription.Text = j.Description.Value;

                // Load status values and set status
                cboStatus.Items.AddRange(new[] { "None", "Draft", "Final", "Cancelled" });

                if (!cboStatus.Items.Contains(j.Status.StatusValue.ToString()))
                {
                    cboStatus.Items.Add(j.Status.StatusValue.ToString());
                }

                cboStatus.SelectedIndex = cboStatus.Items.IndexOf(j.Status.StatusValue.ToString());

                // We'll edit categories as a comma separated string
                txtCategories.Text = j.Categories.CategoriesString;

                txtOrganizer.Text = j.Organizer.Value;

                // We could bind directly to the existing collections but that would modify them.  To preserve
                // the original items, we'll pass a copy of the collections instead.

                // Attendees
                ucAttendees.BindingSource.DataSource = new AttendeePropertyCollection().CloneRange(j.Attendees);

                // Recurrences and exceptions
                ucRecurrences.SetValues(j.RecurrenceRules, j.RecurDates);
                ucExceptions.SetValues(j.ExceptionRules, j.ExceptionDates);

                // Set attachments
                ucAttachments.SetValues(j.Attachments);

                // Miscellaneous
                ucRequestStatus.BindingSource.DataSource = new RequestStatusPropertyCollection().CloneRange(j.RequestStatuses);

                txtUrl.Text      = j.Url.Value;
                txtComments.Text = j.Comment.Value;
            }

            // We use the start date's time zone ID for the combo box.  It should represent the time zone used
            // throughout the component.
            if (timeZoneId == null)
            {
                cboTimeZone.SelectedIndex = timeZoneIdx = 0;
            }
            else
            {
                timeZoneIdx = cboTimeZone.Items.IndexOf(timeZoneId);

                if (timeZoneIdx != -1)
                {
                    cboTimeZone.SelectedIndex = timeZoneIdx;
                }
                else
                {
                    cboTimeZone.SelectedIndex = timeZoneIdx = 0;
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update the calendar object with the dialog control values
        /// </summary>
        /// <param name="oCal">The calendar object in which the settings are updated</param>
        public void GetValues(CalendarObject oCal)
        {
            // We'll use the TimeZoneDateTime property on all date/time values so that they are set literally
            // rather than being converted to the time zone as would happen with the DateTimeValue property.
            if (oCal is VEvent)
            {
                VEvent e = (VEvent)oCal;

                // Header.  Unique ID and Created Date are not changed
                e.Transparency.IsTransparent    = chkTransparent.Checked;
                e.LastModified.TimeZoneDateTime = DateTime.Now;
                e.Classification.Value          = txtClass.Text;
                e.Sequence.SequenceNumber       = (int)udcSequence.Value;
                e.Priority.PriorityValue        = (int)udcPriority.Value;

                // General
                if (!dtpStartDate.Checked)
                {
                    e.StartDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    e.StartDateTime.TimeZoneDateTime = dtpStartDate.Value;
                    e.StartDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                if (!dtpEndDate.Checked)
                {
                    e.EndDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    e.EndDateTime.TimeZoneDateTime = dtpEndDate.Value;
                    e.EndDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                e.Duration.DurationValue = new Duration(txtDuration.Text);
                e.Summary.Value          = txtSummary.Text;
                e.Location.Value         = txtLocation.Text;
                e.Description.Value      = txtDescription.Text;

                // Get status value
                e.Status.StatusValue = (StatusValue)Enum.Parse(typeof(StatusValue),
                                                               cboStatus.Items[cboStatus.SelectedIndex].ToString(), true);

                // We'll edit categories and resources as comma separated strings
                e.Categories.CategoriesString = txtCategories.Text;
                e.Resources.ResourcesString   = txtResources.Text;

                e.Organizer.Value = txtOrganizer.Text;

                // For the collections, we'll clear the existing items and copy the modified items from the
                // browse control binding sources.

                // Attendees
                e.Attendees.Clear();
                e.Attendees.CloneRange((AttendeePropertyCollection)ucAttendees.BindingSource.DataSource);

                // Recurrences and exceptions.
                ucRecurrences.GetValues(e.RecurrenceRules, e.RecurDates);
                ucExceptions.GetValues(e.ExceptionRules, e.ExceptionDates);

                // Get attachments
                ucAttachments.GetValues(e.Attachments);

                // Get alarms
                e.Alarms.Clear();
                e.Alarms.CloneRange((VAlarmCollection)ucAlarms.BindingSource.DataSource);

                // Miscellaneous
                if (txtLatitude.Text.Length != 0 || txtLongitude.Text.Length != 0)
                {
                    e.GeographicPosition.Latitude  = Convert.ToDouble(txtLatitude.Text, CultureInfo.CurrentCulture);
                    e.GeographicPosition.Longitude = Convert.ToDouble(txtLongitude.Text, CultureInfo.CurrentCulture);
                }
                else
                {
                    e.GeographicPosition.Latitude = e.GeographicPosition.Longitude = 0.0F;
                }

                e.RequestStatuses.Clear();
                e.RequestStatuses.CloneRange((RequestStatusPropertyCollection)ucRequestStatus.BindingSource.DataSource);

                e.Url.Value     = txtUrl.Text;
                e.Comment.Value = txtComments.Text;
            }
            else if (oCal is VToDo)
            {
                VToDo td = (VToDo)oCal;

                // Header.  Unique ID and Created Date are not changed
                td.LastModified.TimeZoneDateTime = DateTime.Now;
                td.Classification.Value          = txtClass.Text;
                td.Sequence.SequenceNumber       = (int)udcSequence.Value;
                td.Priority.PriorityValue        = (int)udcPriority.Value;

                // General
                if (!dtpStartDate.Checked)
                {
                    td.StartDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    td.StartDateTime.TimeZoneDateTime = dtpStartDate.Value;
                    td.StartDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                if (!dtpEndDate.Checked)
                {
                    td.DueDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    td.DueDateTime.TimeZoneDateTime = dtpEndDate.Value;
                    td.DueDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                if (!dtpCompleted.Checked)
                {
                    td.CompletedDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    td.CompletedDateTime.TimeZoneDateTime = dtpCompleted.Value;
                    td.CompletedDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                td.PercentComplete.Percentage = (int)udcPercent.Value;
                td.Duration.DurationValue     = new Duration(txtDuration.Text);
                td.Summary.Value     = txtSummary.Text;
                td.Description.Value = txtDescription.Text;

                // Get status value
                td.Status.StatusValue = (StatusValue)Enum.Parse(typeof(StatusValue),
                                                                cboStatus.Items[cboStatus.SelectedIndex].ToString(), true);

                // We'll edit categories and resources as comma separated strings
                td.Categories.CategoriesString = txtCategories.Text;
                td.Resources.ResourcesString   = txtResources.Text;

                td.Organizer.Value = txtOrganizer.Text;

                // For the collections, we'll clear the existing items and copy the modified items from the
                // browse control binding sources.

                // Attendees
                td.Attendees.Clear();
                td.Attendees.CloneRange((AttendeePropertyCollection)ucAttendees.BindingSource.DataSource);

                // Recurrences and exceptions.
                ucRecurrences.GetValues(td.RecurrenceRules, td.RecurDates);
                ucExceptions.GetValues(td.ExceptionRules, td.ExceptionDates);

                // Get attachments
                ucAttachments.GetValues(td.Attachments);

                // Get alarms
                td.Alarms.Clear();
                td.Alarms.CloneRange((VAlarmCollection)ucAlarms.BindingSource.DataSource);

                // Miscellaneous
                if (txtLatitude.Text.Length != 0 || txtLongitude.Text.Length != 0)
                {
                    td.GeographicPosition.Latitude  = Convert.ToDouble(txtLatitude.Text, CultureInfo.CurrentCulture);
                    td.GeographicPosition.Longitude = Convert.ToDouble(txtLongitude.Text, CultureInfo.CurrentCulture);
                }
                else
                {
                    td.GeographicPosition.Latitude = td.GeographicPosition.Longitude = 0.0F;
                }

                td.RequestStatuses.Clear();
                td.RequestStatuses.CloneRange((RequestStatusPropertyCollection)ucRequestStatus.BindingSource.DataSource);

                td.Url.Value     = txtUrl.Text;
                td.Comment.Value = txtComments.Text;
            }
            else if (oCal is VJournal)
            {
                VJournal j = (VJournal)oCal;

                // Header.  Unique ID and Created Date are not changed
                j.LastModified.TimeZoneDateTime = DateTime.Now;
                j.Classification.Value          = txtClass.Text;
                j.Sequence.SequenceNumber       = (int)udcSequence.Value;

                // General
                if (!dtpStartDate.Checked)
                {
                    j.StartDateTime.TimeZoneDateTime = DateTime.MinValue;
                }
                else
                {
                    j.StartDateTime.TimeZoneDateTime = dtpStartDate.Value;
                    j.StartDateTime.ValueLocation    = ValLocValue.DateTime;
                }

                j.Summary.Value     = txtSummary.Text;
                j.Description.Value = txtDescription.Text;

                // Get status value
                j.Status.StatusValue = (StatusValue)Enum.Parse(typeof(StatusValue),
                                                               cboStatus.Items[cboStatus.SelectedIndex].ToString(), true);

                // We'll edit categories as a comma separated string
                j.Categories.CategoriesString = txtCategories.Text;

                j.Organizer.Value = txtOrganizer.Text;

                // For the collections, we'll clear the existing items and copy the modified items from the
                // browse control binding sources.

                // Attendees
                j.Attendees.Clear();
                j.Attendees.CloneRange((AttendeePropertyCollection)ucAttendees.BindingSource.DataSource);

                // Recurrences and exceptions.
                ucRecurrences.GetValues(j.RecurrenceRules, j.RecurDates);
                ucExceptions.GetValues(j.ExceptionRules, j.ExceptionDates);

                // Get attachments
                ucAttachments.GetValues(j.Attachments);

                // Miscellaneous
                j.RequestStatuses.Clear();
                j.RequestStatuses.CloneRange((RequestStatusPropertyCollection)ucRequestStatus.BindingSource.DataSource);

                j.Url.Value     = txtUrl.Text;
                j.Comment.Value = txtComments.Text;
            }

            // Set the time zone in the object after getting all the data.  The "Set" method will not modify the
            // date/times like the "Apply" method does.
            if (cboTimeZone.Enabled && cboTimeZone.SelectedIndex != 0)
            {
                oCal.SetTimeZone(VCalendar.TimeZones[cboTimeZone.SelectedIndex - 1]);
            }
            else
            {
                oCal.SetTimeZone(null);
            }
        }