public override void OnComponentChanged(Object sender, ComponentChangedEventArgs e) { if ((e.Member != null) && e.Member.Name.Equals("AlternateUrl")) { _call.AlternateUrl = NavigateUrlConverter.GetUrl( _call, e.NewValue.ToString(), e.OldValue.ToString() ); e = new ComponentChangedEventArgs(e.Component, e.Member, e.OldValue, _call.AlternateUrl); } base.OnComponentChanged(sender, e); }
// REVIEW: This function could be renamed OnUrlChanging and the // constant string indicating which property to read/write // from could be passed in rather than the bool. private void OnSpecialPropertyChanged(Object sender, bool navigateUrl) { IComponent component = (IComponent)sender; PropertyDescriptor property = TypeDescriptor.GetProperties(component)[navigateUrl ? _navigateUrl : _alternateUrl]; String newValue = (String)property.GetValue(component); String oldValue = (String)_specialProp_buffer[navigateUrl ? _navigateUrl : _alternateUrl]; newValue = NavigateUrlConverter.GetUrl( component, newValue, oldValue ); property.RemoveValueChanged( _underlyingObject, _specialProp_delegate ); property.SetValue(component, newValue); property.AddValueChanged( _underlyingObject, _specialProp_delegate ); }