Exemple #1
0
        /// <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);
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.StartTime:
                    this.startTime = EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone(
                        jsonProperty.ReadAsString(key),
                        service);
                    break;

                case XmlElementNames.EndTime:
                    this.endTime = EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone(
                        jsonProperty.ReadAsString(key),
                        service);
                    break;

                case XmlElementNames.BusyType:
                    this.freeBusyStatus = jsonProperty.ReadEnumValue <LegacyFreeBusyStatus>(key);
                    break;

                case XmlElementNames.CalendarEventDetails:
                    this.details = new CalendarEventDetails();
                    this.details.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                default:
                    break;
                }
            }
        }
 /// <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;
     }
 }