public override void SetValue(object component, object value)
{
if (component != null)
{
ISite site = MemberDescriptor.GetSite(component);
IComponentChangeService service = null;
object oldValue = null;
object invocationTarget = this.GetInvocationTarget(this.componentClass, component);
if (!this.IsReadOnly)
{
if (site != null)
{
service = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
}
if (service != null)
{
oldValue = SecurityUtils.MethodInfoInvoke(this.GetMethodValue, invocationTarget, null);
try
{
service.OnComponentChanging(component, this);
}
catch (CheckoutException exception)
{
if (exception != CheckoutException.Canceled)
{
throw exception;
}
return;
}
}
try
{
SecurityUtils.MethodInfoInvoke(this.SetMethodValue, invocationTarget, new object[] { value });
this.OnValueChanged(invocationTarget, EventArgs.Empty);
}
catch (Exception exception2)
{
value = oldValue;
if ((exception2 is TargetInvocationException) && (exception2.InnerException != null))
{
throw exception2.InnerException;
}
throw exception2;
}
finally
{
if (service != null)
{
service.OnComponentChanged(component, this, oldValue, value);
}
}
}
}
}