.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to implement delay in code activity

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :JQuery

Actually i want to use the delay in async code activity. 

For example, In my async code activity i am trying to check the file presence in a folder, if file is not present i have to wait for some time (consider 30 seconds), after 30 seconds i have to check the file again.

Can any one help me, hwo to implement this in async code activity.


Thanks raj

View Complete Post

More Related Resource Links

How to implement handle externl event activity by my code?...

As a programmer, I write some code to practice wwf, and I have implemented the **call external activity** by using reflection. 1. Firstly, define a xml document that contain a plugin detail: <xml version="1.0" encoding="utf-8" > 2.Secondly, call the external method by reflection in some codes: Assembly assembly = Assembly.Load(assemblyName); Type myInterface = assembly.GetType(interfaceName); Type myClassType = null; foreach (Type t in assembly.GetTypes()) { if (myInterface.IsAssignableFrom(t) && t.IsClass) { myClassType = t; break; } } MethodInfo methodInfo = myClassType.GetMethod(method); object instance = Activator.CreateInstance(myClassType); object result = methodInfo.Invoke(instance, userData); But when I implement the handle external event pattern, i can't finish it by using reflection directly, then i want to hookup delegate, still faild. It seems that the mothod **addService(service)** do somethings inside the wf side. Could I still implement it by use reflection? Actualy, I don't know the detail about when the host client raise an event, how wf side can recieve this action. it seemed that this is the key for my question... Thanks ligong

how implement this code


check this link

and how can i implement on aspx page to get value on textbox


Invoke Delay Activity multiple times

HI! I am using Workflow Foundation workflows with sharepoint lists. I have a state machine workflow. One state of workflow has 2 event driven activities, one is waiting for task change and other is waiting for delay of 1 day. What i need is to send email if delay of 1 day is elapsed and send this email every day. But Delay activity is invoked only once. How can i change it so that it can be invoked multiple times. Shabih

Delay Activity wake up issue..

Hi guys! I've a big problem with my sharepoint 2010: when I use a DelayActivity my workflow NEVER wake up... Sharepoint timer service is ON, and it's loop time is set to 2 minutes. I have already tried with this suggestion (http://howtosharepoint.blogspot.com/2010/05/sharepoint-workflow-delay-activity-not.html), but I still have the problem. Any ideas? Enrico

Unit Testing Delay Activity in workflows 4.0

I need to run unit test scripts for workflows developed in workflows 4.0. I have requirement to unit test the whole workflow including the delay activity.   If the delay activity contains for example for 15 days delay and after that it perform certain other tasks. In this scenario I cannot wait for 15 days for unit test the workflows.   Please let me know How to unit test workflows in case of delay activity? Can I modify the pending timer filed in instance table to advance time?  rajeevkalyan

Delay Activity is not working with SharePoint state machine workflow

Hello,   I have a problem with Delay Activity in Sharepoint state machine workflow. This issue is kind of common to many people but so far I haven't come accross any working solution. In one of the workflow states, I want to add a delay activity to send email notification if no action is taken after certain time. Below is what I have done:   In the targeted state: 1) add one eventDriven activity to handle the normal process (approve the item) 2) add another eventDriven activity to send the reminder email. In this eventDriven activity, I first add a delayActivity, set it to 2 minutes for test purpose. Then I add a Sharepoint SentEmail activity.   With my test, the Dealy Activity is never invoked after timeout period. What should I do to make the delay activity work in the SharePoint state machine workflow? Is there any work around if the delay activity is simply not working there?   Any suggestions are appreciated.

Problem with bookmarks when combined with Delay activity.

Let's take this code sample : using System; using System.Activities; using System.Activities.DurableInstancing; using System.Activities.Statements; using System.Collections.Generic; using System.Runtime.DurableInstancing; using System.Threading; using System.Xml.Linq; using Microsoft.VisualBasic.Activities; namespace WindowsFormsApplication1 { public class WaitExternalEventActivityTestInnerCode : CodeActivity { public OutArgument<string> resultat { get; set; } protected override void Execute (CodeActivityContext context) { context.SetValue (resultat, "SUCCEEDED"); } } public class WaitExternalEventTestEvent : NativeActivity { protected override void Execute (NativeActivityContext context) { context.CreateBookmark ("TestEvent"); } protected override bool CanInduceIdle { get { return true; } } } internal static class Program { private static SqlWorkflowInstanceStore _store; private static readonly XName WorkflowHostTypePropertyName = XNamespace.Get ("urn:schemas-microsoft-com:System.Activities/4.0/properties").GetName ("WorkflowHostType"); private static readonly XName WfHostTypeName = XName.Get ("V1", "Test"); [STAThread] static void Main () { // Init the persistance store string connectionString = @"Data Source=.\

How do I assign the return value of a async code activity to the send activity in a workflow?



Here's my scenario:

- I have a WF service with a Pick activity. 

- The pick branch contains a Sequence activity in the trigger section. 

- The sequence contains a Receive activity that receives some information from another WF service.  It then performs an async code activity called CopyFiles.  CopyFiles returns a boolean value based on if the copy was successful or not. 

- The Action section of the pick branch has a Send activity, which will send this result to the calling WF service.

- The calling WF will look at this boolean value and decide whether to move to the next step or not.


How can I pass this boolean value to the Send activity?

Below is my async CopyFiles activity:

public sealed class CopyFiles : AsyncCodeActivity<bool>
    public InArgument<Services.Application> Application { get; set; }
    public InArgument<Services.Resource> ResourceFrom { get; <

State Machine Workflow + External Event + Delay activity



I have state machine workflow with a state contain 2 event driven activities, one is waiting for an external event, and second one is delay. If the external event didn't happen within specified time, timeout occurs and send email. But if the external event delivered, it transited to next state.


Both situation works fine. But once the external event occurred and transited to next state, the delay activity time out happens and it sends the mail. I don't want it happen, When i read through various blog, I learnt that once the workflow instance moved to next state, all event subscriptions related to the previous state are removed from the queue.... But it is not happening in my situation

Kindly help me to find where i am going and to resolve this issue..


p.s I set manualworkflow scheduler  - useActiv

Is it possible to access ExecutionProperties in a code, or asyncode activity?


I notice that the contect in these doesn't have an executionProperties property.  I keep havind to convert activities across to native just for this feature.

Is there a way to access this?

Jason Bolstad

WorkflowApplication.Run, SqlWorkflowInstanceStore and Delay Activity not resumed(?)

Hi all, 

I am trying to leverage the persistence on our own BPM application built upon BETA 2 of WF. We have a WCF service that accepts external "RunWorkflow" requests, that, in turn (on the WCF method implementation) create the WorkflowApplication, loads designed XAML, and runs the workflow itself.

I added a Delay activity and added SqlWorkflowInstanceStore instance. Basically on my logs, I see that the Workflows runs fine until Delay activity is reached. The Workflow gets Unloaded correctly but is never resumed.

Obviously I installed and configured the  Workflow Management Service correctly (I suppose) by making it point my instance database, where the appropriate scripts have been executed.

Looking at the  SQL Profiler, I see activity of the Management Service. 

I tried to look into the [System.Activities.DurableInstancing].CommandQueueExecutionLogTable and  [System.Activities.DurableInstancing].CommandQueueTable are empty.

The table 

Contains some rows (at each new worfklow appends a new instance and this is fine)... however wiht the "ExecutionStatus" set

How do I implement a Copy/Paste graphics code(similar to paint)?



Im clueless about how to solve it!

Instances not unloading on Delay Activity


Hi there,

We have an application that uses a Delay Activity with a timeout set to 10 seconds. We have set up persistance to unload on idle, but for some reason instances don't seem to unload when they reach this particular delay activity. Our loading interval is 30 seconds and my guess, that I would like to confirm with you, is that instances do not get unloaded when they reach a delay activity with a timeout that is shorter than the loading interval. Can this be correct?

Thank you in advance!

// Peter


Beginner seeking help on when to use InvokeMethod or to create a code Activity



Can anyone tell me or give me some "best practices" about when to use InvokeMethod versus creating a code activity. When would you choose one over the other?

My workflow uses some variables and arguments that are all exposed via interfaces. In building my workflow I can either call InvokeMethod on the object using one of the interface methods, or wrap the method in a code activity (which seems like overkill).

My line of thinking so far is to use the InvokeMethod unless I have a sequence of calls on an object that should be done as a group. Any thoughts?



Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend