Ejemplo n.º 1
0
        /// <summary>
        /// This is used to replace an old time zone ID with a new time zone ID in all properties of a calendar
        /// object.
        /// </summary>
        /// <param name="oldId">The old ID being replaced</param>
        /// <param name="newId">The new ID to use</param>
        public override void UpdateTimeZoneId(string oldId, string newId)
        {
            CalendarObject.UpdatePropertyTimeZoneId(startDate, oldId, newId);
            CalendarObject.UpdatePropertyTimeZoneId(recurId, oldId, newId);

            base.UpdateTimeZoneId(oldId, newId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is used to set the selected time zone in all date/time objects in the component without
        /// modifying the date/time values.
        /// </summary>
        /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
        /// in the component.</param>
        /// <remarks>This method does not affect the date/time values</remarks>
        public override void SetTimeZone(VTimeZone vTimeZone)
        {
            CalendarObject.SetPropertyTimeZone(startDate, vTimeZone);
            CalendarObject.SetPropertyTimeZone(recurId, vTimeZone);

            base.SetTimeZone(vTimeZone);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This is used to set the selected time zone in all date/time objects in the component without
        /// modifying the date/time values.
        /// </summary>
        /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
        /// in the component.</param>
        /// <remarks>This method does not affect the date/time values</remarks>
        public override void SetTimeZone(VTimeZone vTimeZone)
        {
            if (rDates != null)
            {
                foreach (RDateProperty rdt in rDates)
                {
                    if (vTimeZone == null || rdt.TimeZoneId != vTimeZone.TimeZoneId.Value)
                    {
                        // If the time zone is null, just clear the time zone ID
                        if (vTimeZone == null)
                        {
                            rdt.TimeZoneId = null;
                        }
                        else
                        {
                            rdt.TimeZoneId = vTimeZone.TimeZoneId.Value;
                        }
                    }
                }
            }

            if (exDates != null)
            {
                foreach (ExDateProperty edt in exDates)
                {
                    CalendarObject.SetPropertyTimeZone(edt, vTimeZone);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This is used to apply the selected time zone to all date/time objects in the component and convert
        /// them to the new time zone.
        /// </summary>
        /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
        /// in the component.</param>
        /// <remarks>When applied, all date/time values in the object will be converted to the new time zone</remarks>
        public override void ApplyTimeZone(VTimeZone vTimeZone)
        {
            if (rDates != null)
            {
                foreach (RDateProperty rdt in rDates)
                {
                    if (vTimeZone == null || rdt.TimeZoneId != vTimeZone.TimeZoneId.Value)
                    {
                        // If the time zone is null, just clear the time zone ID
                        if (vTimeZone == null)
                        {
                            rdt.TimeZoneId = null;
                        }
                        else
                        {
                            DateTimeInstance dti = VCalendar.TimeZoneToTimeZone(rdt.TimeZoneDateTime,
                                                                                rdt.TimeZoneId, vTimeZone.TimeZoneId.Value);

                            rdt.TimeZoneDateTime = dti.StartDateTime;
                            rdt.TimeZoneId       = vTimeZone.TimeZoneId.Value;
                        }
                    }
                }
            }

            if (exDates != null)
            {
                foreach (ExDateProperty edt in exDates)
                {
                    CalendarObject.ApplyPropertyTimeZone(edt, vTimeZone);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This is used to get a list of time zones used by all owned objects
        /// </summary>
        /// <param name="timeZoneIds">A <see cref="StringCollection"/> that will be used to store the list of
        /// unique time zone IDs used by the calendar objects.</param>
        public override void TimeZonesUsed(StringCollection timeZoneIds)
        {
            CalendarObject.AddTimeZoneIfUsed(startDate, timeZoneIds);
            CalendarObject.AddTimeZoneIfUsed(recurId, timeZoneIds);

            base.TimeZonesUsed(timeZoneIds);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This is used to get a list of time zones used by all owned objects
        /// </summary>
        /// <param name="timeZoneIds">A <see cref="StringCollection"/> that will be used to store the list of
        /// unique time zone IDs used by the calendar objects.</param>
        public override void TimeZonesUsed(StringCollection timeZoneIds)
        {
            string timeZoneId;

            if (rDates != null)
            {
                foreach (RDateProperty rdt in rDates)
                {
                    if (rdt.ValueLocation == ValLocValue.DateTime && rdt.TimeZoneDateTime != DateTime.MinValue)
                    {
                        timeZoneId = rdt.TimeZoneId;

                        if (timeZoneId != null && !timeZoneIds.Contains(timeZoneId))
                        {
                            timeZoneIds.Add(timeZoneId);
                        }
                    }
                }
            }

            if (exDates != null)
            {
                foreach (ExDateProperty edt in exDates)
                {
                    CalendarObject.AddTimeZoneIfUsed(edt, timeZoneIds);
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This is used to apply the selected time zone to all date/time objects in the component and convert
        /// them to the new time zone.
        /// </summary>
        /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
        /// in the component.</param>
        /// <remarks>When applied, all date/time values in the object will be converted to the new time zone</remarks>
        public override void ApplyTimeZone(VTimeZone vTimeZone)
        {
            CalendarObject.ApplyPropertyTimeZone(startDate, vTimeZone);
            CalendarObject.ApplyPropertyTimeZone(due, vTimeZone);
            CalendarObject.ApplyPropertyTimeZone(recurId, vTimeZone);

            if (alarms != null)
            {
                alarms.ApplyTimeZone(vTimeZone);
            }

            base.ApplyTimeZone(vTimeZone);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This is used to set the selected time zone in all date/time objects in the component without
        /// modifying the date/time values.
        /// </summary>
        /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
        /// in the component.</param>
        /// <remarks>This method does not affect the date/time values</remarks>
        public override void SetTimeZone(VTimeZone vTimeZone)
        {
            CalendarObject.SetPropertyTimeZone(startDate, vTimeZone);
            CalendarObject.SetPropertyTimeZone(endDate, vTimeZone);
            CalendarObject.SetPropertyTimeZone(recurId, vTimeZone);

            if (alarms != null)
            {
                alarms.SetTimeZone(vTimeZone);
            }

            base.SetTimeZone(vTimeZone);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// This is used to get a list of time zones used by all owned objects
        /// </summary>
        /// <param name="timeZoneIds">A <see cref="StringCollection"/> that will be used to store the list of
        /// unique time zone IDs used by the calendar objects.</param>
        public override void TimeZonesUsed(StringCollection timeZoneIds)
        {
            CalendarObject.AddTimeZoneIfUsed(startDate, timeZoneIds);
            CalendarObject.AddTimeZoneIfUsed(endDate, timeZoneIds);
            CalendarObject.AddTimeZoneIfUsed(recurId, timeZoneIds);

            if (alarms != null)
            {
                alarms.TimeZonesUsed(timeZoneIds);
            }

            base.TimeZonesUsed(timeZoneIds);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// This is used to replace an old time zone ID with a new time zone ID in all properties of a calendar
        /// object.
        /// </summary>
        /// <param name="oldId">The old ID being replaced</param>
        /// <param name="newId">The new ID to use</param>
        public override void UpdateTimeZoneId(string oldId, string newId)
        {
            CalendarObject.UpdatePropertyTimeZoneId(startDate, oldId, newId);
            CalendarObject.UpdatePropertyTimeZoneId(endDate, oldId, newId);
            CalendarObject.UpdatePropertyTimeZoneId(recurId, oldId, newId);

            if (alarms != null)
            {
                alarms.UpdateTimeZoneId(oldId, newId);
            }

            base.UpdateTimeZoneId(oldId, newId);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This is used to replace an old time zone ID with a new time zone ID in all properties of a calendar
        /// object.
        /// </summary>
        /// <param name="oldId">The old ID being replaced</param>
        /// <param name="newId">The new ID to use</param>
        public override void UpdateTimeZoneId(string oldId, string newId)
        {
            if (rDates != null)
            {
                foreach (RDateProperty rdt in rDates)
                {
                    if (rdt.TimeZoneId == oldId)
                    {
                        rdt.TimeZoneId = newId;
                    }
                }
            }

            if (exDates != null)
            {
                foreach (ExDateProperty edt in exDates)
                {
                    CalendarObject.UpdatePropertyTimeZoneId(edt, oldId, newId);
                }
            }
        }
Ejemplo n.º 12
0
Archivo: VAlarm.cs Proyecto: ywscr/PDI
 /// <summary>
 /// This is used to replace an old time zone ID with a new time zone ID in all properties of a calendar
 /// object.
 /// </summary>
 /// <param name="oldId">The old ID being replaced</param>
 /// <param name="newId">The new ID to use</param>
 public override void UpdateTimeZoneId(string oldId, string newId)
 {
     CalendarObject.UpdatePropertyTimeZoneId(trigger, oldId, newId);
 }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// This is an example of how you can sort calendar object collections
        /// </summary>
        /// <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.
        /// </summary>
        private 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);
        }
Ejemplo n.º 16
0
Archivo: VAlarm.cs Proyecto: ywscr/PDI
 /// <summary>
 /// This is used to set the selected time zone in all date/time objects in the component without
 /// modifying the date/time values.
 /// </summary>
 /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
 /// in the component.</param>
 /// <remarks>This method does not affect the date/time values</remarks>
 public override void SetTimeZone(VTimeZone vTimeZone)
 {
     CalendarObject.SetPropertyTimeZone(trigger, vTimeZone);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// This is used to apply the selected time zone to all date/time objects in the component and convert
 /// them to the new time zone.
 /// </summary>
 /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
 /// in the component.</param>
 /// <remarks>When applied, all date/time values in the object will be converted to the new time zone</remarks>
 public override void ApplyTimeZone(VTimeZone vTimeZone)
 {
     CalendarObject.ApplyPropertyTimeZone(startDate, vTimeZone);
     CalendarObject.ApplyPropertyTimeZone(endDate, vTimeZone);
 }
Ejemplo n.º 18
0
Archivo: VAlarm.cs Proyecto: ywscr/PDI
 /// <summary>
 /// This is used to get a list of time zones used by all owned objects
 /// </summary>
 /// <param name="timeZoneIds">A <see cref="StringCollection"/> that will be used to store the list of
 /// unique time zone IDs used by the calendar objects.</param>
 public override void TimeZonesUsed(StringCollection timeZoneIds)
 {
     CalendarObject.AddTimeZoneIfUsed(trigger, timeZoneIds);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// This is used to set the selected time zone in all date/time objects in the component without
 /// modifying the date/time values.
 /// </summary>
 /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
 /// in the component.</param>
 /// <remarks>This method does not affect the date/time values</remarks>
 public override void SetTimeZone(VTimeZone vTimeZone)
 {
     CalendarObject.SetPropertyTimeZone(startDate, vTimeZone);
     CalendarObject.SetPropertyTimeZone(endDate, vTimeZone);
 }
Ejemplo n.º 20
0
Archivo: VAlarm.cs Proyecto: ywscr/PDI
 /// <summary>
 /// This is used to apply the selected time zone to all date/time objects in the component and convert
 /// them to the new time zone.
 /// </summary>
 /// <param name="vTimeZone">A <see cref="VTimeZone"/> object that will be used for all date/time objects
 /// in the component.</param>
 /// <remarks>When applied, all date/time values in the object will be converted to the new time zone</remarks>
 public override void ApplyTimeZone(VTimeZone vTimeZone)
 {
     CalendarObject.ApplyPropertyTimeZone(trigger, vTimeZone);
 }