public static IMethodDeclaration GetAddMethod(IEventReference value) { IEventDeclaration eventDeclaration = value.Resolve(); if (eventDeclaration.AddMethod != null) { return eventDeclaration.AddMethod.Resolve (); } return null; }
public static IMethodDeclaration GetRemoveMethod(IEventReference value) { IEventDeclaration declaration2 = value.Resolve(); if (declaration2.RemoveMethod != null) { return(declaration2.RemoveMethod.Resolve()); } return(null); }
public static IMethodDeclaration GetInvokeMethod(IEventReference value) { IEventDeclaration eventDeclaration = value.Resolve(); if (eventDeclaration.InvokeMethod != null) { return(eventDeclaration.InvokeMethod.Resolve()); } return(null); }
public static IMethodDeclaration GetInvokeMethod(IEventReference value) { IEventDeclaration eventDeclaration = value.Resolve(); IMethodDeclaration result; if (eventDeclaration.InvokeMethod != null) { result = eventDeclaration.InvokeMethod.Resolve(); } else { result = null; } return(result); }
/// <summary> /// Gets the invoke method. /// </summary> /// <param name="value">The event reference value.</param> /// <returns>A method declaration for the event's invoke method.</returns> internal static IMethodDeclaration GetInvokeMethod(IEventReference value) { IEventDeclaration eventDeclaration = value.Resolve(); if (eventDeclaration.InvokeMethod != null) { return eventDeclaration.InvokeMethod.Resolve(); } return null; }
private TreeNode FindNode(IMemberReference memberReference) { if (memberReference is IAssemblyReference) { foreach (TreeNode node in _assembliesTree.Nodes) { if (node.Tag == memberReference) { return(node); } } return(null); } if (memberReference is IResourceReference) { IResourceReference resourceReference = (IResourceReference)memberReference; TreeNode assemblyNode = FindNode(resourceReference.Resolve().Assembly); TreeNode resourcesNode = null; foreach (TreeNode childNode in assemblyNode.Nodes) { if (childNode.Text == "Resources") { resourcesNode = childNode; } } return(FindNode(memberReference, resourcesNode)); } if (memberReference is IModuleReference) { IModuleReference moduleReference = (IModuleReference)memberReference; return(FindNode(memberReference, FindNode(moduleReference.Resolve().Assembly))); } if (memberReference is ITypeReference) { ITypeReference typeReference = (ITypeReference)memberReference; if (typeReference.Resolve().DeclaringType != null) { TreeNode declaringTypeNode = FindNode(typeReference.Resolve().DeclaringType); return(FindNode(memberReference, declaringTypeNode)); } else { TreeNode moduleNode = FindNode(typeReference.Resolve().Module); foreach (TreeNode namespaceNode in moduleNode.Nodes) { if (((namespaceNode.Text == "-") && (typeReference.Namespace == null)) || (namespaceNode.Text == typeReference.Namespace)) { return(FindNode(memberReference, namespaceNode)); } } } return(null); } if (memberReference is IMethodReference) { IMethodReference methodReference = (IMethodReference)memberReference; TreeNode typeNode = FindNode(methodReference.Resolve().DeclaringType); if (typeNode == null) { return(null); } foreach (TreeNode node in typeNode.Nodes) { if (node.Tag == memberReference) { return(node); } if ((node.Tag is IPropertyReference) || (node.Tag is IEventReference)) { TreeNode nestedEventNode = FindNode(memberReference, node); if (nestedEventNode != null) { return(nestedEventNode); } } } return(null); } if (memberReference is IFieldReference) { IFieldReference fieldReference = (IFieldReference)memberReference; return(FindNode(memberReference, FindNode(fieldReference.Resolve().DeclaringType))); } if (memberReference is IPropertyReference) { IPropertyReference propertyReference = (IPropertyReference)memberReference; return(FindNode(memberReference, FindNode(propertyReference.Resolve().DeclaringType))); } if (memberReference is IEventReference) { IEventReference eventReference = (IEventReference)memberReference; return(FindNode(memberReference, FindNode(eventReference.Resolve().DeclaringType))); } return(null); }
public static IMethodDeclaration GetInvokeMethod(IEventReference value) { IEventDeclaration eventDeclaration = value.Resolve(); return(eventDeclaration.InvokeMethod?.Resolve()); }