public void RegisterEvents() { Init(); foreach (var criteria in TheWorkflowInstantiationCriteriaService.List()) { var hydratedCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteria.Id); if (hydratedCriteria.Events == null) { continue; } foreach (var eve in hydratedCriteria.Events) { var eventInfo = TheEventInfoService.GetByFullName(eve); if (_registeredEvents.Contains(eventInfo.FullName)) { return; } if (!_tracers.ContainsKey(eventInfo.TypeAssemblyQualifiedName)) { var t = Type.GetType(eventInfo.TypeAssemblyQualifiedName); _tracers.Add(eventInfo.TypeAssemblyQualifiedName, new TracerEx(t, OnEvent)); } var tracer = _tracers[eventInfo.TypeAssemblyQualifiedName]; tracer.HookEvent(eventInfo.EventName); _registeredEvents.Add(eventInfo.FullName); } } }
protected void Page_Load(object sender, EventArgs e) { var u = umbraco.BusinessLogic.User.GetCurrent(); var workflows = new List <IWorkflowConfiguration>(); foreach (var criteria in TheWorkflowInstantiationCriteriaService.List()) { var hydratedCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteria.Id); if (!hydratedCriteria.Active) { continue; } if (!((UmbracoWorkflowInstantiationCriteria)hydratedCriteria).AllowManualInstantiation) { continue; } if (!TheCriteriaValidationService.IsCriteriaValid((UmbracoWorkflowInstantiationCriteria)hydratedCriteria, u)) { continue; } workflows.Add(TheWorkflowConfigurationService.GetConfiguration(hydratedCriteria.WorkflowConfiguration)); } if (workflows.Count == 0) { NoCriteriasLiteral.Text = TheGlobalisationService.GetString("no_valid_workflow_instantiation_criteria"); NoCriteriasLiteral.Visible = true; } else { AvailableCriteriaDropDownList.DataSource = workflows; AvailableCriteriaDropDownList.DataTextField = "Name"; AvailableCriteriaDropDownList.DataValueField = "Id"; AvailableCriteriaDropDownList.DataBind(); SendToWorkflowPanel.Visible = true; } }
public ActionResult Index() { return(View(TheWorkflowInstantiationCriteriaService.List())); }