public EventTriggerBinding(EventTriggerAttributeBindingProvider eventTriggerAttributeBindingProvider, ParameterInfo parameter, EventTriggerAttribute trigger) { this.eventTriggerAttributeBindingProvider = eventTriggerAttributeBindingProvider; this.parameter = parameter; this.trigger = trigger; // Create the data binding contract.. contract = new Dictionary <string, Type>(StringComparer.OrdinalIgnoreCase) { // This binding supports return values of any type { "$return", typeof(object).MakeByRefType() }, { "instanceid", typeof(string) }, }; }
public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } ParameterInfo parameter = context.Parameter; EventTriggerAttribute trigger = parameter.GetCustomAttribute <EventTriggerAttribute>(inherit: false); if (trigger == null) { // We could not bind to an event trigger as there is no attribute so return NULL return(Task.FromResult <ITriggerBinding>(null)); } // TODO: Get the details of the event(s) to bind to from the attribute // TODO: Create the binding var binding = new EventTriggerBinding(this, parameter, trigger); return(Task.FromResult <ITriggerBinding>(binding)); }