Beispiel #1
0
        /// <summary>
        /// Utility function which updates the value of a PropertyString. (Not intended for external use)
        /// </summary>
        /// <remarks>If the property value has changed and the properties are not locked (PropertiesLock()
        /// called more recently than PropertiesUnlock()), publication of an update is scheduled.
        ///
        /// Throws ParameterValidationError if the property has a range of allowed values and
        /// the new value is not in this range</remarks>
        /// <param name="aProperty">Property to be updated</param>
        /// <param name="aValue">New value for the property</param>
        /// <returns>true if the property's value has changed (aValue was different to the previous value)</returns>
        protected bool SetPropertyString(PropertyString aProperty, String aValue)
        {
            uint   changed;
            IntPtr value = InteropUtils.StringToHGlobalUtf8(aValue);
            int    err   = DvProviderSetPropertyString(iHandle, aProperty.Handle(), value, out changed);

            Marshal.FreeHGlobal(value);
            if (err != 0)
            {
                throw new PropertyUpdateError();
            }
            return(changed != 0);
        }