Exemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="BeforePropertyChanged"/> event.
        /// </summary>
        /// <param name="propertyName">The property name.</param>
        /// <param name="newValue">The new value.</param>
        /// <returns><c>true</c> indicates that the property change is to be cancelled; otherwise, <c>false</c>.</returns>
        protected virtual bool OnBeforePropertyChanged(string propertyName, object newValue)
        {
            Check.NotNull(propertyName, nameof(propertyName));

            if (BeforePropertyChanged != null)
            {
                var e = new BeforePropertyChangedEventArgs(propertyName, newValue);
                BeforePropertyChanged(this, e);
                if (e.Cancel)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="BeforePropertyChanged"/> event.
        /// </summary>
        /// <param name="propertyName">The property name.</param>
        /// <param name="newValue">The new value.</param>
        /// <returns><c>true</c> indicates that the property change is to be cancelled; otherwise, <c>false</c>.</returns>
        protected virtual bool OnBeforePropertyChanged(string propertyName, object newValue)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }

            if (BeforePropertyChanged != null)
            {
                var e = new BeforePropertyChangedEventArgs(propertyName, newValue);
                BeforePropertyChanged(this, e);
                if (e.Cancel)
                {
                    return(true);
                }
            }

            return(false);
        }