public SetWorkflowActivityType ( WorkflowActivityType value ) : void | ||
value | WorkflowActivityType | The value. |
Résultat | void |
/// <summary> /// Builds the activity control. /// </summary> /// <param name="activityType">Type of the activity.</param> /// <param name="activeActivityTypeGuid">The active activity type unique identifier.</param> /// <param name="activeWorkflowActionTypeGuid">The active workflow action type unique identifier.</param> /// <returns></returns> private WorkflowActivityTypeEditor BuildActivityControl( Control parentControl, bool setValues, WorkflowActivityType activityType, Dictionary<Guid, Attribute> workflowAttributes, Guid? activeActivityTypeGuid = null, Guid? activeWorkflowActionTypeGuid = null, bool showInvalid = false ) { // Save the current activity type attributes to state for any action settings that may need them var activityAttributes = new Dictionary<Guid, Attribute>(); ActivityAttributesState[activityType.Guid].OrderBy( a => a.Order ).ToList().ForEach( a => activityAttributes.Add( a.Guid, a ) ); System.Web.HttpContext.Current.Items["ActivityTypeAttributes"] = activityAttributes; var control = new WorkflowActivityTypeEditor(); control.ID = activityType.Guid.ToString( "N" ); parentControl.Controls.Add( control ); control.ValidationGroup = btnSave.ValidationGroup; control.DeleteActivityTypeClick += workflowActivityTypeEditor_DeleteActivityClick; control.AddActionTypeClick += workflowActivityTypeEditor_AddActionTypeClick; control.RebindAttributeClick += control_RebindAttributeClick; control.AddAttributeClick += control_AddAttributeClick; control.EditAttributeClick += control_EditAttributeClick; control.ReorderAttributeClick += control_ReorderAttributeClick; control.DeleteAttributeClick += control_DeleteAttributeClick; control.SetWorkflowActivityType( activityType ); control.BindAttributesGrid( ActivityAttributesState[activityType.Guid] ); foreach ( WorkflowActionType actionType in activityType.ActionTypes.OrderBy( a => a.Order ) ) { var attributes = new Dictionary<Guid, Attribute>(); workflowAttributes.ToList().ForEach( a => attributes.Add( a.Key, a.Value ) ); ActivityAttributesState[activityType.Guid].OrderBy( a => a.Order ).ToList().ForEach( a => attributes.Add( a.Guid, a ) ); var activities = new Dictionary<string, string>(); ActivityTypesState.OrderBy( a => a.Order ).ToList().ForEach( a => activities.Add( a.Guid.ToString().ToUpper(), a.Name ) ); BuildActionControl( control, setValues, actionType, attributes, activities, activeWorkflowActionTypeGuid, showInvalid ); } if ( setValues ) { control.Expanded = ExpandedActivities.Contains( activityType.Guid ) || activityType.ActionTypes.Any( a => ExpandedActions.Contains( a.Guid ) ); control.AttributesExpanded = ExpandedActivityAttributes.Contains( activityType.Guid ); if ( !control.Expanded && showInvalid && !activityType.IsValid ) { control.Expanded = true; } if ( !control.Expanded ) { control.Expanded = activeActivityTypeGuid.HasValue && activeActivityTypeGuid.Equals( activityType.Guid ); } } return control; }
/// <summary> /// Creates the workflow activity type editor control. /// </summary> /// <param name="workflowActivityType">Type of the workflow activity.</param> /// <param name="forceContentVisible">if set to <c>true</c> [force content visible].</param> private void CreateWorkflowActivityTypeEditorControls( WorkflowActivityType workflowActivityType, bool forceContentVisible = false ) { WorkflowActivityTypeEditor workflowActivityTypeEditor = new WorkflowActivityTypeEditor(); workflowActivityTypeEditor.ID = "WorkflowActivityTypeEditor_" + workflowActivityType.Guid.ToString( "N" ); workflowActivityTypeEditor.SetWorkflowActivityType( workflowActivityType ); workflowActivityTypeEditor.DeleteActivityTypeClick += workflowActivityTypeEditor_DeleteActivityClick; workflowActivityTypeEditor.AddActionTypeClick += workflowActivityTypeEditor_AddActionTypeClick; workflowActivityTypeEditor.ForceContentVisible = forceContentVisible; foreach ( WorkflowActionType actionType in workflowActivityType.ActionTypes.OrderBy( a => a.Order ) ) { CreateWorkflowActionTypeEditorControl( workflowActivityTypeEditor, actionType ); } phActivities.Controls.Add( workflowActivityTypeEditor ); }