internal static List <CustomProperty> GetCustomProperties(IServiceProvider serviceProvider) { WorkflowDesignerLoader service = serviceProvider.GetService(typeof(IDesignerLoaderService)) as WorkflowDesignerLoader; if (service != null) { service.Flush(); } System.Type customActivityType = GetCustomActivityType(serviceProvider); if (customActivityType == null) { return(null); } List <CustomProperty> list = new List <CustomProperty>(); foreach (PropertyInfo info in customActivityType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { if (info.PropertyType != null) { list.Add(CreateCustomProperty(serviceProvider, customActivityType, info, info.PropertyType)); } } foreach (EventInfo info2 in customActivityType.GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { if (info2.EventHandlerType != null) { CustomProperty item = CreateCustomProperty(serviceProvider, customActivityType, info2, info2.EventHandlerType); item.IsEvent = true; list.Add(item); } } return(list); }
internal static List <CustomProperty> GetCustomProperties(IServiceProvider serviceProvider) { // We need to perform a flush just before getting the custom properties so that we are sure that type system is updated // and we always get the updated properties WorkflowDesignerLoader loader = serviceProvider.GetService(typeof(IDesignerLoaderService)) as WorkflowDesignerLoader; if (loader != null) { loader.Flush(); } Type customActivityType = GetCustomActivityType(serviceProvider); if (customActivityType == null) { return(null); } List <CustomProperty> cpc = new List <CustomProperty>(); PropertyInfo[] properties = customActivityType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo property in properties) { if (property.PropertyType != null) { cpc.Add(CreateCustomProperty(serviceProvider, customActivityType, property, property.PropertyType)); } } EventInfo[] events = customActivityType.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance); foreach (EventInfo evt in events) { if (evt.EventHandlerType == null) { continue; } CustomProperty eventProperty = CreateCustomProperty(serviceProvider, customActivityType, evt, evt.EventHandlerType); eventProperty.IsEvent = true; cpc.Add(eventProperty); } return(cpc); }