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

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

Wait for an activity to complete?

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Windows Application
I have the following scenario:My workflow (Workflow1) has a custom activity which inserts data into the database.My program creates an instance of WorkflowApplication (passing an instance of Workflow1) and runs the instance.Thereafter, it reads the data that has been inserted in the execute method of my custom activity. How do I know that the execution of the activity is complete? I am running in issues as the workflow instance seems to run on its own thread.Code snippet:Program.cs  // create the WF instanceActivity wf = new WorkflowTests.MicroLoanOrignation(); WorkflowApplication instance = new WorkflowApplication(wf){                PersistableIdle = OnIdleAndPersistable,                Completed = OnWorkflowCompleted,                Idle = OnIdle}; instance.Run(); //Gets data here..//Enters into this code block before the Execute method of the lst activity of the workflow is complete How do I make it synchronous. I have have tried BeginRun and EndRun methods on the WorkflowApplication - but the Run method merely schedules the workflow to run as per https://connect.microsoft.com/VisualStudio/feedback/details/509928/workflow

View Complete Post

More Related Resource Links

Silverlight - Textbox on focus wait till a Asynchronous process is complete



I have a textbox, where i call its lostfocus event when the value changes.

In lost focus i do a Asynchronous process to update a grid with the text entered. 

I have a scenario in which immediately after changing the value in textbox i hit a button, though the button click event raises i want it to wait till the asysnchronous process in lost focus of the textbox is complete. i want to do this as i use the result from lostfocus in button click event.

Please let mt know if there is a way to make the lost focus wait till it completes the asynchronous call.



WebBrowser control, wait till all request complete?


I was creating WebBrowser control that auto navigate list of urls, but when I set DocumentComplete events it raised only when main DOM document downloaded (not include image, javascript, iframe, etc.) Is there any point that I can check from WebBrowser properties that the browser have completely load all element related to the page, e.g page images, domready javascript event, iframe, etc.


Complete SQL Solution

SQL Server Solutions: SQL Server 2000/2005 Related Free Snippets.

Parallel port complete: programming, interfacing & using the PC's parallel

Parallel port complete: programming, interfacing & using the PC's parallel


Bugslayer: Wait Chain Traversal


Windows Vista has a new API called Wait Chain Traversal (WCT), which allows you to determine when and why a process is deadlocked. Read on.

John Robbins

MSDN Magazine July 2007

A Simple XML-driven Tool: Monitor Your Web Site's Activity with COM and Active Scripting


This article describes a simple Web site monitoring tool built with XML, JScript, Windows Script Host, and COM objects. Although it is not intended to replace complete Web site monitoring software products, it has many useful features that help to keep Web servers up and running. An XML configuration file specifies which Web sites to monitor and the actions to be taken if the site isn't functioning properly. In addition, the tool can be scheduled to run at any specified interval using the Windows Task Scheduler. Functions that probe the sites, log events, and send e-mail notifications are written in JScript.

Panos Kougiouris

MSDN Magazine July 2000

Windows 2000: Asynchronous Method Calls Eliminate the Wait for COM Clients and Servers


Windows 2000 is the first version of COM to support asynchronous method calls, which permit clients to make nonblocking calls to COM objects and objects to process incoming calls without blocking the calling threads. COM clients benefit from asynchronous method calls because they can continue working while waiting for outbound calls to return. Objects benefit because they can queue incoming calls and service them from a thread pool. Our SieveClient and SieveServer sample apps demonstrate how to create and use asynchronous clients and servers in COM-based distributed applications.

Jeff Prosise

MSDN Magazine April 2000

auto complete extender stops


Hello everyone

when the textbox of the  autocomplete extender looses focas the auto complete extender stops the returning any results or even firing events(onpopulating, onpupulated).

Could you please help me fix this.


and I there any way to know when the extender fires the request(please provide code example if you can).


thanks a lot.

Convert .docx to web page - "the converter cannot complete the task because an internal error occurr


I'm trying to convert docx files to webpages to be published in to a library elsewhere on our sharepoint site. At first I was having no problem, the files were converting, however more recent files have returned the error: the converter cannot complete the task because an internal error occurred

I've tried writing, uploading and converting a simple docx file, and this works which has led me to believe that the problem is something in the docx files that i'm trying to convert. So i tried using word07 to clean the documents up by clicking Office button>prepare>inspect document then removing all the metadata, custom xml etc from the files resave, upload and convert, but still no joy.

I'd simply rewrite the document but the problem is that there are a lot of them.

Any ideas what's going wrong?


System.NullReferenceException: At Createtask Activity



I created  Approval Workflow application(.net3.0), it has successfully deployed at sharepoint server, but when executing  workflow at createTask activity, the following errror has occured.

System.NullReferenceException: Object reference not set to an instance of an object.     at BasicApprovalWorkflow.Workflow2.createApprovalTask_MethodInvoking(Object sender, EventArgs e)

below is the code :



void createApprovalTask_MethodInvoking(object sender, EventArgs e)



Workflow doesn't complete when a task is updated directly from an infopath form.

I have an approval workflow that creates a task for a group to approve or reject an InfoPath form. But if a member of the group opens the form and updates the task from there, it doesn't complete the workflow. It only completes the workflow if they go to the actual task and update it from there. Does anyone know how to fix that?

How to Cancel a Workflow Activity - LogToHistoryListActivity


How can I cancel a LogToHistoryListActivity? I don't understand how to get access to the ActivityExecutionContext. I guess one way is to add an IfElse before entry to avoid the activity completely. Casting the sender object does not work. Help anyone?

  private void logToHistoryListActivity_WorkflowActivated_MethodInvoking(object sender, EventArgs e)
   LogToHistoryListActivity log = (LogToHistoryListActivity)sender;
   string msg = string.Format("Work Request has been SAVED by {0}. Awaiting submittal.", workflowProperties.Originator);
   WFHelper.LogMessageToHistoryList(log, msg, null);

Populate Treeview upon entered criteria and page action without complete page posting on client side


1. I have a treeview on left side in a panel in my aspx page and I have a Text box and a Search button on the right panel. On entering a search criteria and clicking the Search button, I want to get the data needed for the treeview (FYI - I have a webservice call for that) and then populate the treeview completely but keep it collapsed to the root node.

  Each time I enter the search criteria and click the Search button, I don't want to post the entire page (and also don't like the page flicker), how can I achieve this? I know that in order to avoid complete postback upon Search button click, I can do so by client callback and get the data needed for the treeview, but in this case, I have to build the treeview nodes as table - row/cells and handle all the events and handlers myself, which I want to avoid (also means that I won't be able to take advantage of the inherent expand and collapse capabilities of the Treeview). On the other hand, if I use the OnTreeNodePopulate event handling of the Treeview control, using the C# script code on the aspx markup, it doesn't recognize the entered criteria in the Text box. So either way,

C# - Creating web client for automating user activity on a HTTPS site

I've been wracking my brain for a couple of weeks on this.  I need to create a web client (I don't want to use the webBrowser control because I need this to be as lightweight as possible) to log in to a secure web site, and then effectively click links and fill in fields to get the data that would normally be displayed in the web browser.  I'm then going to parse the data and perform other actions with it. I have been working with HttpWebRequest and HttpWebResponse and many permutations of suggestions I have found while Googling my issue, but I can't get rid of my problem:  Sometimes when I effictively click the ultimate link that I need to click to get to my data, I get what I am looking for.  However, MOST of the timel, I get a response page that tells me my connection timed out and that I need to log in again.  I have tried messing with cookies and such, but to no avail. I know it's good form to post my code, but it is so sloppy and screwed up right now from tweaking this and trying that, that I'd rather not take the approach of fixing what's there, rather I'd like to start with solid, clean code to begin with. Your help will be greatly appreciated. Thanks, ALo

SQL Server 2008 - Job Activity Monitor Failing

I recently began migrating to Windows 2008. One of the first servers is a server which we install our tools on. This is a new server which currently is only running the SQL Server management tools. On this server I installed the SQL Server 2008 R2 management tools, prior to this install there were no other SQL Server tools installed on this server. The majority of the functionality works and I can connect and manage multiple databases servers from SQL Server version 2000 through 2008. But when I try to bring up the Job Activity monitor I get an error ==> Can not show requested dialog. From Windows XP Windows Server 2003 SP2 this functionality works. I get this error if I connect to a SQL Server 2005 or 2008 database instance. I have tried re-installing the client tools but I still get this error..... any ideas?

Is all this activity wasted

I support a third party application that is absolutely terrible.  Most of the bad I understand, but my SQL Profiler comes back with these types of entries RPC:Starting declare @p1 int set @p1=-1 exec sp_prepare @p1 output,NULL,N'SELECT * FROM Payments',1 select @p1 SP:Statement complete SELECT * FROM Payments RPC:complete declare @p1 int set @p1=-1 exec sp_prepare @p1 output,NULL,N'SELECT * FROM Payments',1 select @p1 Even when their is an SP_sqlexecute, they don't pass the plan handle and the SQL is more select * from payments where customer = 111 What are they trying to do   Thanks for any replies   mark      
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