private void OnExecute(IPluginExecutionContext executionContext) { var parameters = new ParametersWrapper <T>(executionContext); var parentContext = executionContext.ParentContext; var prop = executionContext.GetType().GetProperty("MessageCategory"); var messageCategory = string.Empty; if (prop != null) { messageCategory = (string)prop.GetValue(executionContext); } string messageName; if (messageCategory == MessageCategory.CustomOperation) { messageName = MessageCategory.CustomOperation; } else { messageName = parentContext == null ? executionContext.MessageName : parentContext.MessageName; } if (eventHandlers.TryGetValue(messageName, out Action <IPluginExecutionContext, ParametersWrapper <T> > pluginAction)) { pluginAction(executionContext, parameters); } }
private void OnExecute(IPluginExecutionContext executionContext) { var parameters = new ParametersWrapper <T>(executionContext); var parentContext = executionContext.ParentContext; var prop = executionContext.GetType().GetProperty("MessageCategory"); var messageCategory = string.Empty; if (prop != null) { messageCategory = (string)prop.GetValue(executionContext); } string messageName; if (messageCategory == MessageCategory.CustomOperation) { messageName = MessageCategory.CustomOperation; } else if (parentContext != null && (parentContext.MessageName == PluginVirtualMessageName.ExportToExcel || parentContext.MessageName == PluginVirtualMessageName.ExportDynamicToExcel)) { messageName = parentContext.MessageName; } else { messageName = executionContext.MessageName; } Action <IPluginExecutionContext, ParametersWrapper <T> > pluginAction; if (eventHandlers.TryGetValue(messageName, out pluginAction)) { pluginAction(executionContext, parameters); } }