/// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.Offset:
                this.offset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue());
                return(true);

            case XmlElementNames.RelativeYearlyRecurrence:
                this.Recurrence = new TimeChangeRecurrence();
                this.Recurrence.LoadFromXml(reader, reader.LocalName);
                return(true);

            case XmlElementNames.AbsoluteDate:
                DateTime dateTime = DateTime.Parse(reader.ReadElementValue());

                // TODO: BUG
                this.absoluteDate = new DateTime(dateTime.ToUniversalTime().Ticks, DateTimeKind.Unspecified);
                return(true);

            case XmlElementNames.Time:
                this.time = new Time(DateTime.Parse(reader.ReadElementValue()));
                return(true);

            default:
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.Offset:
                    this.offset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue());
                    return true;
                case XmlElementNames.RelativeYearlyRecurrence:
                    this.Recurrence = new TimeChangeRecurrence();
                    this.Recurrence.LoadFromXml(reader, reader.LocalName);
                    return true;
                case XmlElementNames.AbsoluteDate:
                    DateTime dateTime = DateTime.Parse(reader.ReadElementValue());

                    // TODO: BUG
                    this.absoluteDate = new DateTime(dateTime.ToUniversalTime().Ticks, DateTimeKind.Unspecified);
                    return true;
                case XmlElementNames.Time:
                    this.time = new Time(DateTime.Parse(reader.ReadElementValue()));
                    return true;
                default:
                    return false;
            }
        }