示例#1
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.StartTime:
            this.startTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

        case XmlElementNames.EndTime:
            this.endTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

        case XmlElementNames.BusyType:
            this.freeBusyStatus = reader.ReadElementValue <LegacyFreeBusyStatus>();
            return(true);

        case XmlElementNames.CalendarEventDetails:
            this.details = new CalendarEventDetails();
            this.details.LoadFromXml(reader, reader.LocalName);
            return(true);

        default:
            return(false);
        }
    }
示例#2
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.MeetingTime:
            this.meetingTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

        case XmlElementNames.IsWorkTime:
            this.isWorkTime = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SuggestionQuality:
            this.quality = reader.ReadElementValue <SuggestionQuality>();
            return(true);

        case XmlElementNames.AttendeeConflictDataArray:
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if (reader.IsStartElement())
                    {
                        Conflict conflict = null;

                        switch (reader.LocalName)
                        {
                        case XmlElementNames.UnknownAttendeeConflictData:
                            conflict = new Conflict(ConflictType.UnknownAttendeeConflict);
                            break;

                        case XmlElementNames.TooBigGroupAttendeeConflictData:
                            conflict = new Conflict(ConflictType.GroupTooBigConflict);
                            break;

                        case XmlElementNames.IndividualAttendeeConflictData:
                            conflict = new Conflict(ConflictType.IndividualAttendeeConflict);
                            break;

                        case XmlElementNames.GroupAttendeeConflictData:
                            conflict = new Conflict(ConflictType.GroupConflict);
                            break;

                        default:
                            EwsUtilities.Assert(
                                false,
                                "TimeSuggestion.TryReadElementFromXml",
                                string.Format("The {0} element name does not map to any AttendeeConflict descendant.", reader.LocalName));

                            // The following line to please the compiler
                            break;
                        }

                        conflict.LoadFromXml(reader, reader.LocalName);

                        this.conflicts.Add(conflict);
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.AttendeeConflictDataArray));
            }

            return(true);

        default:
            return(false);
        }
    }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if appropriate element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.MeetingTime:
                    this.meetingTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
                    return true;
                case XmlElementNames.IsWorkTime:
                    this.isWorkTime = reader.ReadElementValue<bool>();
                    return true;
                case XmlElementNames.SuggestionQuality:
                    this.quality = reader.ReadElementValue<SuggestionQuality>();
                    return true;
                case XmlElementNames.AttendeeConflictDataArray:
                    if (!reader.IsEmptyElement)
                    {
                        do
                        {
                            reader.Read();

                            if (reader.IsStartElement())
                            {
                                Conflict conflict = null;

                                switch (reader.LocalName)
                                {
                                    case XmlElementNames.UnknownAttendeeConflictData:
                                        conflict = new Conflict(ConflictType.UnknownAttendeeConflict);
                                        break;
                                    case XmlElementNames.TooBigGroupAttendeeConflictData:
                                        conflict = new Conflict(ConflictType.GroupTooBigConflict);
                                        break;
                                    case XmlElementNames.IndividualAttendeeConflictData:
                                        conflict = new Conflict(ConflictType.IndividualAttendeeConflict);
                                        break;
                                    case XmlElementNames.GroupAttendeeConflictData:
                                        conflict = new Conflict(ConflictType.GroupConflict);
                                        break;
                                    default:
                                        EwsUtilities.Assert(
                                            false,
                                            "TimeSuggestion.TryReadElementFromXml",
                                            string.Format("The {0} element name does not map to any AttendeeConflict descendant.", reader.LocalName));

                                        // The following line to please the compiler
                                        break;
                                }

                                conflict.LoadFromXml(reader, reader.LocalName);

                                this.conflicts.Add(conflict);
                            }
                        }
                        while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.AttendeeConflictDataArray));
                    }

                    return true;
                default:
                    return false;
            }
        }
 /// <summary>
 /// Attempts to read the element at the reader's current position.
 /// </summary>
 /// <param name="reader">The reader used to read the element.</param>
 /// <returns>True if the element was read, false otherwise.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.StartTime:
             this.startTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
             return true;
         case XmlElementNames.EndTime:
             this.endTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
             return true;
         case XmlElementNames.BusyType:
             this.freeBusyStatus = reader.ReadElementValue<LegacyFreeBusyStatus>();
             return true;
         case XmlElementNames.CalendarEventDetails:
             this.details = new CalendarEventDetails();
             this.details.LoadFromXml(reader, reader.LocalName);
             return true;
         default:
             return false;
     }
 }