コード例 #1
0
        /// <summary>
        /// Writes the json value.
        /// </summary>
        /// <param name="jsonObject">The json object.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="service">The service.</param>
        /// <param name="isUpdateOperation">if set to <c>true</c> [is update operation].</param>
        internal override void WriteJsonValue(JsonObject jsonObject, PropertyBag propertyBag, ExchangeService service, bool isUpdateOperation)
        {
            ComplexProperty complexProperty = (ComplexProperty)propertyBag[this];

            if (complexProperty != null)
            {
                jsonObject.Add(this.XmlElementName, complexProperty.InternalToJson(service));
            }
        }
コード例 #2
0
        /// <summary>
        /// Entry was changed.
        /// </summary>
        /// <param name="complexProperty">The complex property.</param>
        private void EntryChanged(ComplexProperty complexProperty)
        {
            TKey key = (complexProperty as TEntry).Key;

            if (!this.addedEntries.Contains(key) && !this.modifiedEntries.Contains(key))
            {
                this.modifiedEntries.Add(key);
                this.Changed();
            }
        }
コード例 #3
0
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="isUpdateOperation">Indicates whether the context is an update operation.</param>
        internal override void WritePropertyValueToXml(
            EwsServiceXmlWriter writer,
            PropertyBag propertyBag,
            bool isUpdateOperation)
        {
            ComplexProperty complexProperty = (ComplexProperty)propertyBag[this];

            if (complexProperty != null)
            {
                complexProperty.WriteToXml(writer, this.XmlElementName);
            }
        }
コード例 #4
0
ファイル: PropertyBag.cs プロジェクト: cortfr/ews-managed-api
        /// <summary>
        /// Initializes a ComplexProperty instance. When a property is inserted into the bag, it needs to be
        /// initialized in order for changes that occur on that property to be properly detected and dispatched.
        /// </summary>
        /// <param name="complexProperty">The ComplexProperty instance to initialize.</param>
        private void InitComplexProperty(ComplexProperty complexProperty)
        {
            if (complexProperty != null)
            {
                complexProperty.OnChange += this.PropertyChanged;

                IOwnedProperty ownedProperty = complexProperty as IOwnedProperty;

                if (ownedProperty != null)
                {
                    ownedProperty.Owner = this.Owner;
                }
            }
        }
コード例 #5
0
ファイル: PropertyBag.cs プロジェクト: cortfr/ews-managed-api
 /// <summary>
 /// Handles a change event for the specified property.
 /// </summary>
 /// <param name="complexProperty">The property that changes.</param>
 internal void PropertyChanged(ComplexProperty complexProperty)
 {
     foreach (KeyValuePair <PropertyDefinition, object> keyValuePair in this.properties)
     {
         if (keyValuePair.Value == complexProperty)
         {
             if (!this.deletedProperties.ContainsKey(keyValuePair.Key))
             {
                 AddToChangeList(keyValuePair.Key, this.modifiedProperties);
                 this.Changed();
             }
         }
     }
 }
コード例 #6
0
ファイル: PropertyBag.cs プロジェクト: cortfr/ews-managed-api
        /// <summary>
        /// Clears the bag's change log.
        /// </summary>
        internal void ClearChangeLog()
        {
            this.deletedProperties.Clear();
            this.modifiedProperties.Clear();
            this.addedProperties.Clear();

            foreach (KeyValuePair <PropertyDefinition, object> keyValuePair in this.properties)
            {
                ComplexProperty complexProperty = keyValuePair.Value as ComplexProperty;

                if (complexProperty != null)
                {
                    complexProperty.ClearChangeLog();
                }
            }

            this.isDirty = false;
        }
コード例 #7
0
        /// <summary>
        /// Item changed.
        /// </summary>
        /// <param name="complexProperty">The complex property.</param>
        internal void ItemChanged(ComplexProperty complexProperty)
        {
            TComplexProperty property = complexProperty as TComplexProperty;

            EwsUtilities.Assert(
                property != null,
                "ComplexPropertyCollection.ItemChanged",
                string.Format("ComplexPropertyCollection.ItemChanged: the type of the complexProperty argument ({0}) is not supported.", complexProperty.GetType().Name));

            if (!this.addedItems.Contains(property))
            {
                if (!this.modifiedItems.Contains(property))
                {
                    this.modifiedItems.Add(property);
                    this.Changed();
                }
            }
        }
コード例 #8
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)
        {
            while (true)
            {
                switch (reader.LocalName)
                {
                case XmlElementNames.InsightGroupType:
                    this.InsightGroupType = reader.ReadElementValue <InsightGroupType>();
                    break;

                case XmlElementNames.InsightType:
                    this.InsightType = reader.ReadElementValue <InsightType>();
                    break;

                case XmlElementNames.Rank:
                    this.Rank = reader.ReadElementValue <double>();
                    break;

                case XmlElementNames.Content:
                    var type = reader.ReadAttributeValue("xsi:type");
                    switch (type)
                    {
                    case XmlElementNames.SingleValueInsightContent:
                        this.Content = new SingleValueInsightContent();
                        ((SingleValueInsightContent)this.Content).LoadFromXml(reader, reader.LocalName);
                        break;

                    case XmlElementNames.MultiValueInsightContent:
                        this.Content = new MultiValueInsightContent();
                        ((MultiValueInsightContent)this.Content).LoadFromXml(reader, reader.LocalName);
                        break;

                    default:
                        return(false);
                    }
                    break;

                default:
                    return(false);
                }

                return(true);
            }
        }
コード例 #9
0
ファイル: PropertyBag.cs プロジェクト: cortfr/ews-managed-api
        /// <summary>
        /// Deletes the property from the bag.
        /// </summary>
        /// <param name="propertyDefinition">The property to delete.</param>
        internal void DeleteProperty(PropertyDefinition propertyDefinition)
        {
            if (!this.deletedProperties.ContainsKey(propertyDefinition))
            {
                object propertyValue;

                this.properties.TryGetValue(propertyDefinition, out propertyValue);

                this.properties.Remove(propertyDefinition);
                this.modifiedProperties.Remove(propertyDefinition);
                this.deletedProperties.Add(propertyDefinition, propertyValue);

                ComplexProperty complexProperty = propertyValue as ComplexProperty;

                if (complexProperty != null)
                {
                    complexProperty.OnChange -= this.PropertyChanged;
                }
            }
        }
コード例 #10
0
 /// <summary>
 /// E-mail address was changed.
 /// </summary>
 /// <param name="complexProperty">Property that changed.</param>
 private void EmailAddressChanged(ComplexProperty complexProperty)
 {
     this.Changed();
 }
コード例 #11
0
 /// <summary>
 /// PersonaPostalAddress OnChange.
 /// </summary>
 /// <param name="complexProperty">ComplexProperty object.</param>
 private void PersonaPostalAddress_OnChange(ComplexProperty complexProperty)
 {
     this.Changed();
 }
コード例 #12
0
 /// <summary>
 /// Change event handler.
 /// </summary>
 /// <param name="complexProperty">The complex property.</param>
 private void DaysOfTheWeekChanged(ComplexProperty complexProperty)
 {
     this.Changed();
 }
コード例 #13
0
 /// <summary>
 /// Property was changed.
 /// </summary>
 /// <param name="complexProperty">The complex property.</param>
 private void PropertyChanged(ComplexProperty complexProperty)
 {
     this.Changed();
 }
コード例 #14
0
 /// <summary>
 /// A search filter has changed.
 /// </summary>
 /// <param name="complexProperty">The complex property.</param>
 private void SearchFilterChanged(ComplexProperty complexProperty)
 {
     this.Changed();
 }