|
/* ****************************************************************************
* RuntimeObjectEditor
*
* Copyright (c) 2005 Corneliu I. Tusnea
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the author be held liable for any damages arising from
* the use of this software.
* Permission to use, copy, modify, distribute and sell this software for any
* purpose is hereby granted without fee, provided that the above copyright
* notice appear in all copies and that both that copyright notice and this
* permission notice appear in supporting documentation.
*
* Corneliu I. Tusnea (corneliutusnea@yahoo.com.au)
* www.acorns.com.au
* ****************************************************************************/
using System;
using System.Collections;
using System.ComponentModel;
using RuntimeObjectEditor.Utils;
namespace RuntimeObjectEditor.Tabs.Events
{
public class EventListenerPropertyDescriptor : AbstractPropertyDescriptor, IRealValueHolder
{
private EventPropertyDescriptor eventDescriptor;
private Delegate handler;
public EventListenerPropertyDescriptor(EventPropertyDescriptor eventDescriptor, Delegate handler)
: base(handler.Method.Name)
{
this.eventDescriptor = eventDescriptor;
this.handler = handler;
}
protected override void FillAttributes(IList attributeList)
{
base.FillAttributes(attributeList);
attributeList.Add(new RefreshPropertiesAttribute(RefreshProperties.All));
}
#region AbstractPropertyDescriptor
public override Type ComponentType
{
get { return eventDescriptor.ComponentType; }
}
public override object GetValue(object component)
{
return handler.Target;
}
public override Type PropertyType
{
get { return typeof (string); }
}
#endregion
#region IRealValueHolder Members
public object RealValue
{
get { return handler.Target; }
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here