Пример #1
0
    /// <summary>
    /// Determines whether the specified property was updated.
    /// </summary>
    /// <param name="property">property to evaluate.</param>
    /// <returns>Boolean indicating whether to send the property Xml.</returns>
    /* private */ bool IsPropertyUpdated(UserConfigurationProperties property)
    {
        bool isPropertyDirty = false;
        bool isPropertyEmpty = false;

        switch (property)
        {
        case UserConfigurationProperties.Dictionary:
            isPropertyDirty = this.Dictionary.IsDirty;
            isPropertyEmpty = this.Dictionary.Count == 0;
            break;

        case UserConfigurationProperties.XmlData:
            isPropertyDirty = (property & this.updatedProperties) == property;
            isPropertyEmpty = (this.xmlData == null) || (this.xmlData.Length == 0);
            break;

        case UserConfigurationProperties.BinaryData:
            isPropertyDirty = (property & this.updatedProperties) == property;
            isPropertyEmpty = (this.binaryData == null) || (this.binaryData.Length == 0);
            break;

        default:
            EwsUtilities.Assert(
                false,
                "UserConfiguration.IsPropertyUpdated",
                "property not supported: " + property.ToString());
            break;
        }

        // Consider the property updated, if it's been modified, and either
        //    . there's a value or
        //    . there's no value but the operation is update.
        return(isPropertyDirty && ((!isPropertyEmpty) || (!this.isNew)));
    }
Пример #2
0
 /// <summary>
 /// Determines whether the specified property may be accessed.
 /// </summary>
 /// <param name="property">Property to access.</param>
 /* private */ void ValidatePropertyAccess(UserConfigurationProperties property)
 {
     if ((property & this.propertiesAvailableForAccess) != property)
     {
         throw new PropertyException(Strings.MustLoadOrAssignPropertyBeforeAccess, property.ToString());
     }
 }
 /// <summary>
 /// Determines whether the specified property may be accessed.
 /// </summary>
 /// <param name="property">Property to access.</param>
 private void ValidatePropertyAccess(UserConfigurationProperties property)
 {
     if ((property & this.propertiesAvailableForAccess) != property)
     {
         throw new PropertyException(Strings.MustLoadOrAssignPropertyBeforeAccess, property.ToString());
     }
 }
        /// <summary>
        /// Determines whether the specified property was updated.
        /// </summary>
        /// <param name="property">property to evaluate.</param>
        /// <returns>Boolean indicating whether to send the property Xml.</returns>
        private bool IsPropertyUpdated(UserConfigurationProperties property)
        {
            bool isPropertyDirty = false;
            bool isPropertyEmpty = false;

            switch (property)
            {
                case UserConfigurationProperties.Dictionary:
                    isPropertyDirty = this.Dictionary.IsDirty;
                    isPropertyEmpty = this.Dictionary.Count == 0;
                    break;
                case UserConfigurationProperties.XmlData:
                    isPropertyDirty = (property & this.updatedProperties) == property;
                    isPropertyEmpty = (this.xmlData == null) || (this.xmlData.Length == 0);
                    break;
                case UserConfigurationProperties.BinaryData:
                    isPropertyDirty = (property & this.updatedProperties) == property;
                    isPropertyEmpty = (this.binaryData == null) || (this.binaryData.Length == 0);
                    break;
                default:
                    EwsUtilities.Assert(
                        false,
                        "UserConfiguration.IsPropertyUpdated",
                        "property not supported: " + property.ToString());
                    break;
            }

            // Consider the property updated, if it's been modified, and either 
            //    . there's a value or 
            //    . there's no value but the operation is update.
            return isPropertyDirty && ((!isPropertyEmpty) || (!this.isNew));
        }