本文整理汇总了C#中System.ComponentModel.EventDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# EventDescriptor类的具体用法?C# EventDescriptor怎么用?C# EventDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventDescriptor类属于System.ComponentModel命名空间,在下文中一共展示了EventDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataItemEventDescriptor
internal DataItemEventDescriptor(
DataItemTypeDescriptor owner,
EventDescriptor parent,
Type componentType,
Type eventType,
Action<object, object> addHandler,
Action<object, object> removeHandler )
: base( owner, parent )
{
if( componentType == null )
throw new ArgumentNullException( "componentType" );
if( eventType == null )
throw new ArgumentNullException( "eventType" );
if( addHandler == null )
throw new ArgumentNullException( "addHandler" );
if( removeHandler == null )
throw new ArgumentNullException( "removeHandler" );
m_componentType = componentType;
m_eventType = eventType;
m_addHandler = addHandler;
m_removeHandler = removeHandler;
}
示例2: Add
public int Add(EventDescriptor value)
{
Contract.Ensures(0 <= Contract.Result<int>());
Contract.Ensures(Contract.Result<int>() <= 2147483646);
return default(int);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.ComponentModel.EventDescriptorCollection.cs
示例3: GetCompatibleMethods
protected override ICollection GetCompatibleMethods(EventDescriptor e)
{
ITypeDefinition definition = loader.GetPrimaryTypeDefinition();
ArrayList compatibleMethods = new ArrayList();
MethodInfo methodInfo = e.EventType.GetMethod("Invoke");
var methodInfoParameters = methodInfo.GetParameters();
foreach (IMethod method in definition.Methods) {
if (method.Parameters.Count == methodInfoParameters.Length) {
bool found = true;
for (int i = 0; i < methodInfoParameters.Length; ++i) {
ParameterInfo pInfo = methodInfoParameters[i];
IParameter p = method.Parameters[i];
if (p.Type.ReflectionName != pInfo.ParameterType.ToString()) {
found = false;
break;
}
}
if (found) {
compatibleMethods.Add(method.Name);
}
}
}
return compatibleMethods;
}
示例4: ArgumentNullException
ICollection IEventBindingService.GetCompatibleMethods(EventDescriptor e)
{
if (e == null)
{
throw new ArgumentNullException("e");
}
return this.GetCompatibleMethods(e);
}
示例5: ShowCode
protected override bool ShowCode(IComponent component, EventDescriptor edesc, string methodName)
{
if (formDesigner != null) {
formDesigner.ShowSourceCode(component, edesc, methodName);
return true;
}
return false;
}
示例6: DataItemEventDescriptorBase
protected DataItemEventDescriptorBase( DataItemTypeDescriptor owner, EventDescriptor parent )
: base( parent )
{
if( owner == null )
throw new ArgumentNullException( "owner" );
m_owner = owner;
}
示例7: ArgumentNullException
string IEventBindingService.CreateUniqueMethodName (IComponent component, EventDescriptor eventDescriptor)
{
if (eventDescriptor == null)
throw new ArgumentNullException ("eventDescriptor");
if (component == null)
throw new ArgumentNullException ("component");
return this.CreateUniqueMethodName (component, eventDescriptor);
}
示例8: ReflectionEventDescriptor
public ReflectionEventDescriptor (Type componentType, EventDescriptor oldEventDescriptor, Attribute[] attrs) : base (oldEventDescriptor, attrs)
{
_componentType = componentType;
_eventType = oldEventDescriptor.EventType;
EventInfo event_info = componentType.GetEvent (oldEventDescriptor.Name);
add_method = event_info.GetAddMethod ();
remove_method = event_info.GetRemoveMethod ();
}
示例9: EventDescriptorCollection
EventDescriptorCollection (EventDescriptor[] events, bool readOnly)
{
this.isReadOnly = readOnly;
if (events == null)
return;
for (int i = 0; i < events.Length; i++)
this.Add (events[i]);
}
示例10: CreateUniqueMethodName
public string CreateUniqueMethodName (IComponent component, EventDescriptor e)
{
if (component.Site == null || component.Site.Name == null)
throw new ArgumentException ("IComponent must be sited and named");
//TODO: check component.Site.Name is valid as start of method name
string trialPrefix = component.Site.Name + "_" + e.Name;
return proxy.GenerateIdentifierUniqueInCodeBehind (trialPrefix);
}
示例11: Add
public int Add(EventDescriptor value)
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.EnsureSize(this.eventCount + 1);
this.events[this.eventCount++] = value;
return (this.eventCount - 1);
}
示例12: GetEventDescriptorHashCode
private string GetEventDescriptorHashCode(EventDescriptor eventDesc)
{
StringBuilder builder = new StringBuilder(eventDesc.Name);
builder.Append(eventDesc.EventType.GetHashCode().ToString(CultureInfo.InvariantCulture));
foreach (Attribute attribute in eventDesc.Attributes)
{
builder.Append(attribute.GetHashCode().ToString(CultureInfo.InvariantCulture));
}
return builder.ToString();
}
示例13: EventDescriptorCollection
// Constructors.
public EventDescriptorCollection(EventDescriptor[] events)
{
list = new ArrayList();
if(events != null)
{
foreach(EventDescriptor descr in events)
{
list.Add(descr);
}
}
}
示例14: EventDescriptorCollection
/// <devdoc>
/// <para>
/// Initializes a new instance of the <see cref='System.ComponentModel.EventDescriptorCollection'/> class.
/// </para>
/// </devdoc>
public EventDescriptorCollection(EventDescriptor[] events) {
this.events = events;
if (events == null) {
this.events = new EventDescriptor[0];
this.eventCount = 0;
}
else {
this.eventCount = this.events.Length;
}
this.eventsOwned = true;
}
示例15: EventPropertyDescriptor
public EventPropertyDescriptor(EventDescriptor eventDesc, IServiceProvider serviceProvider)
: base(eventDesc)
{
_eventDescriptor = eventDesc;
_serviceProvider = serviceProvider;
FieldInfo eventFieldInfo = _eventDescriptor.ComponentType.GetField(_eventDescriptor.Name + "Event");
if (eventFieldInfo != null)
{
_eventProperty = eventFieldInfo.GetValue(_eventDescriptor.ComponentType) as DependencyProperty;
}
}