creating custom client activities with VS
Where can one find documentation or help on creating custom client activities? It's not covered in the developers guide and the videos and code only touch on it briefly.
0
-
using System.Linq;
using System.Text;
using System.Activities;
using System.Data;
namespace AddTwoNumbers
{
public sealed class CodeActivity1 : CodeActivity
{
// Define activity input argument
public InArgument<int> Value1 { get; set; }
public InArgument<int> Value2 { get; set; }
// Define activity output argument
public OutArgument<int> MyResult { get; set; }
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
int myValue1 = Value1.Get(context);
int myValue2 = Value2.Get(context);
// return the addition of the two values
MyResult.Set(context, myValue1 + myValue2);
}
}
}
Is this you are looking for?
Kindly let me know if you need any further help.
Regards,
Mohammad Ashraf0 -
Thanks Mohammad - that's a great start for me! I'm just a newbie with custom activities - is this a client activity or server activity?
Basically, this is what GTX support recommended for my situation where I want to suspend a layer service from drawing until a series of changes to the layer are made. Right now when my workflow runs it redraws the map layer after each change making it very slow.
"In the Esri JavaScript API there is a way to suspend drawing of individual services while you fiddle with their layers, but there isn’t currently a way to trigger this from a workflow. You would need to create custom client activities to call the suspend() and resume() functions."
Wish me luck!0 -
Hi James,
This is server side activity.
Regards,
Mohammad Ashraf0 -
Hi James,
I was just curious that if you are still want to write a client side activity. The steps to develop a custom client side activity goes as follows:
1. Create a custom activity class as you have done above without execute method.
2. Register the activity handler in a custom module written in Javascript (if you are using HTML5 viewer). This handler should be based on activity type.I would suggest if you are not using this activity many times in a single workflow, then better use DynamicExternal activity and then register activity handler by ID. This is do the job.
Please let me know if you need any sample or any clarifications.
Regards,
Mohammad Ashraf0
Please sign in to leave a comment.
Comments
4 comments