void IActivityEventListener <ActivityExecutionStatusChangedEventArgs> .OnEvent(object sender, ActivityExecutionStatusChangedEventArgs e) { ActivityExecutionContext context = sender as ActivityExecutionContext; if (e.ExecutionStatus == ActivityExecutionStatus.Closed) { e.Activity.UnregisterForStatusChange(Activity.ClosedEvent, this); LoggerActivity lgr = context.Activity as LoggerActivity; bool finished = true; for (int childNum = 0; childNum < lgr.EnabledActivities.Count; childNum++) { Activity child = lgr.EnabledActivities[childNum]; if ((child.ExecutionStatus != ActivityExecutionStatus. Initialized) && (child.ExecutionStatus != ActivityExecutionStatus.Closed)) { finished = false; } } if (finished) { context.CloseActivity(); } } }
protected override IComponent[] CreateComponentsCore(IDesignerHost host) { System.Workflow.ComponentModel.CompositeActivity activity = new LoggerActivity(); LogToHistoryListActivity logger = new LogToHistoryListActivity(); logger.Name = "logger"; logger.UserData["logger"] = "logger"; activity.Activities.Add(logger); return(new IComponent[] { activity }); }