Browse Source

implementation of Attached Events and Attached Properties

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3972 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
45a7ef931e
  1. 254
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs
  2. 65
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs
  3. 4
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs
  4. 1
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj
  5. 46
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs
  6. 13
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizerSettings.cs
  7. 25
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItem.cs
  8. 39
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlContext.cs
  9. 11
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs

254
src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml;
@ -55,7 +56,7 @@ namespace ICSharpCode.XamlBinding @@ -55,7 +56,7 @@ namespace ICSharpCode.XamlBinding
return false;
}
static List<ICompletionItem> CreateListForElement(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
public static List<ICompletionItem> CreateListForElement(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
{
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
try {
@ -68,11 +69,11 @@ namespace ICSharpCode.XamlBinding @@ -68,11 +69,11 @@ namespace ICSharpCode.XamlBinding
var result = new List<ICompletionItem>();
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
TypeResolveResult rr = new XamlResolver().Resolve(new ExpressionResult(r.Name), parseInfo, fileContent) as TypeResolveResult;
if (rr != null) {
AddPropertiesForType(result, r, rr);
AddEventsForType(result, r, rr);
}
// TypeResolveResult rr = new XamlResolver().Resolve(new ExpressionResult(r.Name), parseInfo, fileContent) as TypeResolveResult;
// if (rr != null) {
// AddPropertiesForType(result, r, rr);
// AddEventsForType(result, r, rr);
// }
foreach (var ns in r.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml)) {
var list = XamlCompilationUnit.GetNamespaceMembers(pc, ns.Value);
@ -137,42 +138,6 @@ namespace ICSharpCode.XamlBinding @@ -137,42 +138,6 @@ namespace ICSharpCode.XamlBinding
return rt.GetMethods().Any(m => m.Name == "Add" && m.IsPublic);
}
class XamlCompletionProperty : DefaultProperty, IEntity
{
string newName;
public XamlCompletionProperty(IProperty baseProperty, string prefix)
: base(baseProperty.DeclaringType, baseProperty.Name)
{
this.Modifiers = baseProperty.Modifiers;
this.CopyDocumentationFrom(baseProperty);
newName = prefix + "." + baseProperty.Name;
}
string IEntity.Name
{
get { return newName; }
}
}
class XamlCompletionEvent : DefaultEvent, IEntity
{
string newName;
public XamlCompletionEvent(IEvent baseEvent, string prefix)
: base(baseEvent.DeclaringType, baseEvent.Name)
{
this.Modifiers = baseEvent.Modifiers;
this.CopyDocumentationFrom(baseEvent);
newName = prefix + "." + baseEvent.Name;
}
string IEntity.Name
{
get { return newName; }
}
}
static readonly List<ICompletionItem> standardElements = new List<ICompletionItem> {
new DefaultCompletionItem("!--"),
new DefaultCompletionItem("![CDATA["),
@ -185,7 +150,7 @@ namespace ICSharpCode.XamlBinding @@ -185,7 +150,7 @@ namespace ICSharpCode.XamlBinding
public const string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml";
static List<ICompletionItem> CreateListOfMarkupExtensions(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
public static List<ICompletionItem> CreateListOfMarkupExtensions(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
{
var list = CreateListForElement(parseInfo, fileContent, caretLine, caretColumn);
@ -217,6 +182,8 @@ namespace ICSharpCode.XamlBinding @@ -217,6 +182,8 @@ namespace ICSharpCode.XamlBinding
break;
case XamlContext.InTag:
list.Items.AddRange(CreateListForAttributeName(info, editor.Document.Text, new XamlExpressionContext(path, null, false), Utils.GetListOfExistingAttributeNames(editor.Document.Text, editor.Caret.Offset)));
list.Items.AddRange(GetListOfAttachedProperties(info, editor.Document.Text, editor.Caret.Line, editor.Caret.Column));
list.Items.AddRange(GetListOfAttachedEvents(info, editor.Document.Text, editor.Caret.Line, editor.Caret.Column));
list.Items.AddRange(standardAttributes);
break;
case XamlContext.InAttributeValue:
@ -232,7 +199,7 @@ namespace ICSharpCode.XamlBinding @@ -232,7 +199,7 @@ namespace ICSharpCode.XamlBinding
}
} else if (entity is IEvent) {
IEvent e = entity as IEvent;
IMethod invoker = GetInvokeMethod(e.ReturnType);
IMethod invoker = GetInvokeMethod(e);
if (invoker == null)
break;
var item = path.Elements[path.Elements.Count - 1];
@ -297,17 +264,202 @@ namespace ICSharpCode.XamlBinding @@ -297,17 +264,202 @@ namespace ICSharpCode.XamlBinding
return result;
}
static IMethod GetInvokeMethod(IReturnType type)
static IMethod GetInvokeMethod(IEvent e)
{
if (type == null)
return null;
if (e != null && e.ReturnType != null)
return e.ReturnType.GetMethods()
.Where(m => m.Name == "Invoke")
.FirstOrDefault();
foreach (IMethod method in type.GetMethods()) {
if (method.Name == "Invoke")
return method;
return null;
}
static List<ICompletionItem> GetListOfAttachedProperties(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
{
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
try {
r.WhitespaceHandling = WhitespaceHandling.Significant;
// move reader to correct position
while (r.Read() && !IsReaderAtTarget(r, caretLine, caretColumn)) { }
}
catch (XmlException) {
}
var result = new List<ICompletionItem>();
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
foreach (var ns in r.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml)) {
var list = XamlCompilationUnit.GetNamespaceMembers(pc, ns.Value);
if (list != null) {
foreach (IClass c in list.OfType<IClass>()) {
if (c.ClassType != ClassType.Class)
continue;
if (c.IsAbstract && c.IsStatic)
continue;
if (c.ClassInheritanceTree.Any(b => b.FullyQualifiedName == "System.Attribute"))
continue;
if (!c.Methods.Any(m => m.IsConstructor && m.IsPublic))
continue;
var attachedProperties = c.Fields
.Where(f =>
f.IsPublic &&
f.IsStatic &&
f.IsReadonly &&
f.ReturnType != null &&
f.ReturnType.FullyQualifiedName == "System.Windows.DependencyProperty" &&
f.Name.Length > "Property".Length &&
f.Name.EndsWith("Property", StringComparison.Ordinal) &&
c.Methods.Any(m =>
m.IsPublic &&
m.IsStatic &&
m.Name.Length > 3 &&
(m.Name.StartsWith("Get", StringComparison.Ordinal) || m.Name.StartsWith("Set", StringComparison.Ordinal)) &&
m.Name.Remove(0, 3) == f.Name.Remove(f.Name.Length - "Property".Length)
)
);
result.AddRange(attachedProperties
.Select(item => {
string name = (!string.IsNullOrEmpty(ns.Key)) ? ns.Key + ":" : "";
string property = item.Name.Remove(item.Name.Length - "Property".Length);
name += c.Name + "." + item.Name.Remove(item.Name.Length - "Property".Length);
return new XamlCompletionItem(name, new DefaultProperty(c, property) { ReturnType = GetAttachedPropertyType(item, c) } ) as ICompletionItem;
}));
}
}
}
return result;
}
}
static List<ICompletionItem> GetListOfAttachedEvents(ParseInformation parseInfo, string fileContent, int caretLine, int caretColumn)
{
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
try {
r.WhitespaceHandling = WhitespaceHandling.Significant;
// move reader to correct position
while (r.Read() && !IsReaderAtTarget(r, caretLine, caretColumn)) { }
}
catch (XmlException) {
}
var result = new List<ICompletionItem>();
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
foreach (var ns in r.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml)) {
var list = XamlCompilationUnit.GetNamespaceMembers(pc, ns.Value);
if (list != null) {
foreach (IClass c in list.OfType<IClass>()) {
if (c.ClassType != ClassType.Class)
continue;
if (c.IsAbstract && c.IsStatic)
continue;
if (c.ClassInheritanceTree.Any(b => b.FullyQualifiedName == "System.Attribute"))
continue;
if (!c.Methods.Any(m => m.IsConstructor && m.IsPublic))
continue;
var attachedEvents = c.Fields
.Where(f =>
f.IsPublic &&
f.IsStatic &&
f.IsReadonly &&
f.ReturnType != null &&
f.ReturnType.FullyQualifiedName == "System.Windows.RoutedEvent" &&
f.Name.Length > "Event".Length &&
f.Name.EndsWith("Event", StringComparison.Ordinal) &&
c.Methods.Any(m =>
m.IsPublic &&
m.IsStatic &&
m.Name.Length > 3 &&
(m.Name.StartsWith("Add", StringComparison.Ordinal) || m.Name.StartsWith("Remove", StringComparison.Ordinal)) &&
m.Name.EndsWith("Handler", StringComparison.Ordinal) &&
IsMethodFromEvent(f, m)
)
);
result.AddRange(attachedEvents
.Select(item => {
string name = (!string.IsNullOrEmpty(ns.Key)) ? ns.Key + ":" : "";
string property = item.Name.Remove(item.Name.Length - "Event".Length);
name += c.Name + "." + item.Name.Remove(item.Name.Length - "Event".Length);
return new XamlCompletionItem(name, new DefaultEvent(c, GetEventNameFromField(item)) { ReturnType = GetAttachedEventDelegateType(item, c) }) as ICompletionItem;
}));
}
}
}
return result;
}
}
static IReturnType GetAttachedEventDelegateType(IField field, IClass c)
{
if (c == null || field == null)
return null;
return null;
string eventName = field.Name.Remove(field.Name.Length - "Event".Length);
IMethod method = c.Methods
.Where(m =>
m.IsPublic &&
m.IsStatic &&
m.Parameters.Count == 2 &&
(m.Name == "Add" + eventName + "Handler" ||
m.Name == "Remove" + eventName + "Handler"))
.FirstOrDefault();
if (method == null)
return null;
return method.Parameters[1].ReturnType;
}
static IReturnType GetAttachedPropertyType(IField field, IClass c)
{
if (c == null || field == null)
return null;
string propertyName = field.Name.Remove(field.Name.Length - "Property".Length);
IMethod method = c.Methods
.Where(m =>
m.IsPublic &&
m.IsStatic &&
m.Name == "Get" + propertyName)
.FirstOrDefault();
if (method == null)
return null;
return method.ReturnType;
}
static string GetEventNameFromMethod(IMethod m)
{
string mName = m.Name;
if (mName.StartsWith("Add", StringComparison.Ordinal))
mName = mName.Remove(0, 3);
else if (mName.StartsWith("Remove", StringComparison.Ordinal))
mName = mName.Remove(0, 6);
if (mName.EndsWith("Handler", StringComparison.Ordinal))
mName = mName.Remove(mName.Length - "Handler".Length);
return mName;
}
static string GetEventNameFromField(IField f)
{
string fName = f.Name;
if (fName.EndsWith("Event", StringComparison.Ordinal))
fName = fName.Remove(fName.Length - "Event".Length);
return fName;
}
static bool IsMethodFromEvent(IField f, IMethod m)
{
return GetEventNameFromField(f) == GetEventNameFromMethod(m);
}
static bool TypeCompletion(IClass type, XamlCompletionItemList list)

65
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs

@ -5,29 +5,72 @@ @@ -5,29 +5,72 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Gui;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{
public static class Extensions
{
static readonly char[] whitespaces = new char[] { ' ', '\t', '\n', '\r' };
public static string[] Split(this string s, StringSplitOptions options, params char[] delimiters)
{
return s.Split(delimiters, options);
}
public static MarkupExtensionInfo ParseMarkupExtension(this XamlParser parser, string fileName, string fileContent, int index)
{
XmlElementPath path = XmlParser.GetActiveElementStartPathAtIndex(fileContent, index);
ParseInformation info = ParserService.GetParseInformation(fileName);
if (path != null && path.Elements.Count > 0) {
if (XmlParser.IsInsideAttributeValue(fileContent, index)) {
string value = XmlParser.GetAttributeValueAtIndex(fileContent, index).Trim(whitespaces);
string name = XmlParser.GetAttributeNameAtIndex(fileContent, index);
if (!string.IsNullOrEmpty(value) && value.StartsWith("{")) {
string[] parts = value.Split(whitespaces, StringSplitOptions.RemoveEmptyEntries);
string extensionType = parts[0].TrimStart('{');
XamlResolver resolver = new XamlResolver();
TypeResolveResult trr = resolver.Resolve(new ExpressionResult(extensionType, new XamlExpressionContext(path, name, true)), info, fileContent) as TypeResolveResult;
if (trr != null) {
}
}
}
}
return MarkupExtensionInfo.Empty;
}
public static bool IsInsideMarkupExtension(this XamlParser parser, string fileContent, int index)
{
if (XmlParser.IsInsideAttributeValue(fileContent, index)) {
string value = XmlParser.GetAttributeValueAtIndex(fileContent, index).Trim(' ', '\t', '\n', '\r');
if (!string.IsNullOrEmpty(value) && value.StartsWith("{"))
return true;
}
return false;
}
}
public struct MarkupExtensionInfo
{
IEntity extension;
public static readonly MarkupExtensionInfo Empty = new MarkupExtensionInfo(null);
public MarkupExtensionInfo(IEntity extension)
{
this.extension = extension;
}
public IEntity Extension {
get { return extension; }
}
}
}

4
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs

@ -9,12 +9,11 @@ using System; @@ -9,12 +9,11 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Linq;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.XmlEditor;
using System.Linq;
namespace ICSharpCode.XamlBinding
{
@ -191,6 +190,7 @@ namespace ICSharpCode.XamlBinding @@ -191,6 +190,7 @@ namespace ICSharpCode.XamlBinding
int index = XmlParser.GetActiveElementStartIndex(text, offset);
if (index == -1) return null;
index = text.IndexOf(' ', index);
if (index == -1) return null;
text = text.Substring(index);
int endIndex = text.IndexOfAny(new char[] { '<', '>' });
text = text.Substring(0, endIndex).Trim(' ', '\t', '\n', '\r', '/');

1
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj

@ -71,6 +71,7 @@ @@ -71,6 +71,7 @@
<Compile Include="XamlCompilationUnit.cs" />
<Compile Include="XamlCompletionItem.cs" />
<Compile Include="XamlCompletionItemList.cs" />
<Compile Include="XamlContext.cs" />
<Compile Include="XamlExpressionContext.cs" />
<Compile Include="XamlExpressionFinder.cs">
<DependentUpon>XamlExpressionContext.cs</DependentUpon>

46
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs

@ -18,30 +18,12 @@ using ICSharpCode.XmlEditor; @@ -18,30 +18,12 @@ using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{
public enum XamlContext {
/// <summary>
/// After '&lt;'
/// </summary>
AtTag,
/// <summary>
/// Inside '&lt;TagName &gt;'
/// </summary>
InTag,
/// <summary>
/// Inside '="Value"'
/// </summary>
InAttributeValue,
/// <summary>
/// Inside '="{}"'
/// </summary>
InMarkupExtension
}
public class XamlCodeCompletionBinding : ICodeCompletionBinding
{
public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch)
{
XamlResolver resolver = new XamlResolver();
XamlParser parser = new XamlParser();
ParseInformation info = ParserService.GetParseInformation(editor.FileName);
XmlElementPath path;
@ -126,6 +108,16 @@ namespace ICSharpCode.XamlBinding @@ -126,6 +108,16 @@ namespace ICSharpCode.XamlBinding
ICompletionItemList list = CompletionDataHelper.CreateListForContext(editor, XamlContext.InTag, path, null);
editor.ShowCompletionWindow(list);
return CodeCompletionKeyPressResult.Completed;
} else {
if (parser.IsInsideMarkupExtension(editor.Document.Text, editor.Caret.Offset)) {
var list = CompletionDataHelper.CreateListForElement(info, editor.Document.Text,
editor.Caret.Line, editor.Caret.Column);
var needed = list.Where(i => ((i as XamlCompletionItem).Entity as IClass).ClassInheritanceTree
.Any(item => item.FullyQualifiedName == "System.Windows.Markup.MarkupExtension"));
MarkupExtensionInfo markup = parser.ParseMarkupExtension(editor.FileName, editor.Document.Text, editor.Caret.Offset);
}
}
}
break;
@ -149,6 +141,8 @@ namespace ICSharpCode.XamlBinding @@ -149,6 +141,8 @@ namespace ICSharpCode.XamlBinding
}
}
break;
case '/': // ignore '/' when trying to type '/>'
return CodeCompletionKeyPressResult.None;
case '=':
offset = editor.Caret.Offset;
path = XmlParser.GetActiveElementStartPathAtIndex(editor.Document.Text, offset);
@ -217,6 +211,20 @@ namespace ICSharpCode.XamlBinding @@ -217,6 +211,20 @@ namespace ICSharpCode.XamlBinding
}
editor.ShowCompletionWindow(list);
return true;
} else {
string attribute = XmlParser.GetAttributeNameAtIndex(editor.Document.Text, editor.Caret.Offset);
string attribValue = XmlParser.GetAttributeValueAtIndex(editor.Document.Text, editor.Caret.Offset);
if (!string.IsNullOrEmpty(attribute)) {
XamlResolver resolver = new XamlResolver();
ExpressionResult expr = new ExpressionResult(attribute, new XamlExpressionContext(path, attribute, true));
MemberResolveResult mrr = resolver.Resolve(expr, ParserService.GetParseInformation(editor.FileName), editor.Document.Text) as MemberResolveResult;
if (mrr != null) {
var list = CompletionDataHelper.CreateListForContext(editor, XamlContext.InAttributeValue, path, mrr.ResolvedMember) as XamlCompletionItemList;
editor.ShowCompletionWindow(list);
return true;
}
}
}
}
return false;

13
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizerSettings.cs

@ -5,21 +5,8 @@ @@ -5,21 +5,8 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Gui;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{

25
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItem.cs

@ -18,30 +18,29 @@ using ICSharpCode.XmlEditor; @@ -18,30 +18,29 @@ using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{
class XamlCompletionItem : DefaultCompletionItem
class XamlCompletionItem : CodeCompletionItem
{
IEntity entity;
public IEntity Entity {
get { return entity; }
}
public XamlCompletionItem(IEntity entity, string prefix)
: base(prefix + ":" + entity.Name)
: base(entity)
{
this.entity = entity;
this.Text = prefix + ":" + entity.Name;
}
public XamlCompletionItem(IEntity entity)
: base(entity.Name)
: base(entity)
{
this.entity = entity;
this.Text = entity.Name;
}
public XamlCompletionItem(string text, IEntity entity)
: base(text)
: base(entity)
{
this.Text = text;
}
public override string ToString()
{
this.entity = entity;
return "[" + this.Text + "]";
}
}

39
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlContext.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision: 3731 $</version>
// </file>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{
public enum XamlContext {
/// <summary>
/// After '&lt;'
/// </summary>
AtTag,
/// <summary>
/// Inside '&lt;TagName &gt;'
/// </summary>
InTag,
/// <summary>
/// Inside '="Value"'
/// </summary>
InAttributeValue,
/// <summary>
/// Inside '="{}"'
/// </summary>
InMarkupExtension
}
}

11
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs

@ -121,6 +121,17 @@ namespace ICSharpCode.XamlBinding @@ -121,6 +121,17 @@ namespace ICSharpCode.XamlBinding
delegate(IMethod p) {
return p.IsStatic && p.Parameters.Count == 1 && p.Name == "Get" + propertyName;
});
if (member != null) {
member = new DefaultProperty(resolvedType.GetUnderlyingClass(), propertyName);
} else {
IMethod m = resolvedType.GetMethods().Find(
delegate(IMethod p) {
return p.IsPublic && p.IsStatic && p.Parameters.Count == 2 && (p.Name == "Add" + propertyName + "Handler" || p.Name == "Remove" + propertyName + "Handler");
});
member = m;
if (member != null)
member = new DefaultEvent(resolvedType.GetUnderlyingClass(), propertyName) { ReturnType = m.Parameters[1].ReturnType };
}
}
if (member != null)
return new MemberResolveResult(callingClass, null, member);

Loading…
Cancel
Save