/// <summary> /// Construct a new EventApiView instance, represented by the provided symbol. /// </summary> /// <param name="symbol">The symbol representing the event.</param> public EventApiView(IEventSymbol symbol) { this.Id = symbol.ToDisplayString(); this.Name = symbol.Name; this.Accessibility = symbol.DeclaredAccessibility.ToString().ToLower(); this.Type = new TypeReferenceApiView(symbol.Type); }
private static string _BuildEvent(IEventSymbol symbol, SemanticModel semanticModel) { var fieldName = symbol.ToDisplayString().Replace('.', '_'); var source = $@" public Regulus.Remote.GhostEventHandler _{fieldName} = new Regulus.Remote.GhostEventHandler(); event {symbol.Type.ToDisplayString()} {symbol.ToDisplayString()} {{ add {{ var id = _{fieldName}.Add(value); _AddEventEvent(typeof({symbol.ContainingType.ToDisplayString()}).GetEvent(""{symbol.Name}""),id); }} remove {{ var id = _{fieldName}.Remove(value); _RemoveEventEvent(typeof({symbol.ContainingType.ToDisplayString()}).GetEvent(""{symbol.Name}""),id); }} }} "; return(source); }