Beispiel #1
0
        /// <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.OofState:
                this.state = reader.ReadValue <OofState>();
                return(true);

            case XmlElementNames.ExternalAudience:
                this.externalAudience = reader.ReadValue <OofExternalAudience>();
                return(true);

            case XmlElementNames.Duration:
                this.duration = new TimeWindow();
                this.duration.LoadFromXml(reader);
                return(true);

            case XmlElementNames.InternalReply:
                this.internalReply = new OofReply();
                this.internalReply.LoadFromXml(reader, reader.LocalName);
                return(true);

            case XmlElementNames.ExternalReply:
                this.externalReply = new OofReply();
                this.externalReply.LoadFromXml(reader, reader.LocalName);
                return(true);

            default:
                return(false);
            }
        }
Beispiel #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.OofState:
                    this.state = jsonProperty.ReadEnumValue <OofState>(key);
                    break;

                case XmlElementNames.ExternalAudience:
                    this.externalAudience = jsonProperty.ReadEnumValue <OofExternalAudience>(key);
                    break;

                case XmlElementNames.Duration:
                    this.duration = new TimeWindow();
                    this.duration.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                case XmlElementNames.InternalReply:
                    this.internalReply = new OofReply();
                    this.internalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                case XmlElementNames.ExternalReply:
                    this.externalReply = new OofReply();
                    this.externalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                default:
                    break;
                }
            }
        }
 /// <summary>
 /// Serializes an OofReply. Emits an empty OofReply in case the one passed in is null.
 /// </summary>
 /// <param name="oofReply">The oof reply.</param>
 /// <param name="writer">The writer.</param>
 /// <param name="xmlElementName">Name of the XML element.</param>
 private void SerializeOofReply(
     OofReply oofReply,
     EwsServiceXmlWriter writer,
     string xmlElementName)
 {
     if (oofReply != null)
     {
         oofReply.WriteToXml(writer, xmlElementName);
     }
     else
     {
         OofReply.WriteEmptyReplyToXml(writer, xmlElementName);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Serializes an OofReply. Emits an empty OofReply in case the one passed in is null.
 /// </summary>
 /// <param name="oofReply">The oof reply.</param>
 /// <param name="writer">The writer.</param>
 /// <param name="xmlElementName">Name of the XML element.</param>
 private void SerializeOofReply(
     OofReply oofReply,
     EwsServiceXmlWriter writer,
     string xmlElementName)
 {
     if (oofReply != null)
     {
         oofReply.WriteToXml(writer, xmlElementName);
     }
     else
     {
         OofReply.WriteEmptyReplyToXml(writer, xmlElementName);
     }
 }
 /// <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.OofState:
             this.state = reader.ReadValue<OofState>();
             return true;
         case XmlElementNames.ExternalAudience:
             this.externalAudience = reader.ReadValue<OofExternalAudience>();
             return true;
         case XmlElementNames.Duration:
             this.duration = new TimeWindow();
             this.duration.LoadFromXml(reader);
             return true;
         case XmlElementNames.InternalReply:
             this.internalReply = new OofReply();
             this.internalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         case XmlElementNames.ExternalReply:
             this.externalReply = new OofReply();
             this.externalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         default:
             return false;
     }
 }