Oftentimes, an activity requires additional functionality. To accomplish this, you can write an extension for the activity.
Activate the Code
- Add a class library to your solution. Add the relevant references.
- PNMsoft.Sequence
- PNMsoft.Sequence.Forms
- PNMsoft.Sequence.Security
- PNMsoft.Sequence.Extension
- Strongly sign the project.
- Complete the code in the relevant places, and compile the assembly.
- Put the assembly in the GAC.
- Insert a new record into tblTemplateWorkflowExtensions.
- In fldType, type the assembly strong name.
- In fldGuid, type the GUID in the class decorator.
NOTE: If your code raises an exception, execution will continue.
//*************************************************** // // Copyright (C) PNMsoft. All rights reserved. // // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // //*************************************************** // Assemblies // // PNMsoft.Sequence.dll // Pnmsoft.Sequence.Security.dll // Pnmsoft.Sequence.Extensions.dll // Pnmsoft.Sequence.Forms.dll using System; using PNMsoft.Sequence; using PNMsoft.Sequence.Forms.Activities; namespace SequenceEx.Samples.TaskActivityExtensions { [WorkflowElementExtension("put extension guid")] public class ExecutionListenerTaskActivityExtension : WorkflowElementExtension<TaskActivity> { public ExecutionListenerTaskActivityExtension() { } protected override void OnAttached() { base.OnAttached(); this.Owner.InstanceCreated += new EventHandler<ActivityInstanceEventArgs>(OnActivityInstanceCreated); } protected override void OnDetached() { base.OnDetached(); this.Owner.InstanceCreated -= new EventHandler<ActivityInstanceEventArgs>(OnActivityInstanceCreated); } private void OnActivityInstanceCreated(object sender, ActivityInstanceEventArgs e) { } } }