workflow project type

hello,

My workflow run from a win form application. which type of the workflow ( Sequential Workflow console App or sequential workflow library..) must be used.

[181 byte] By [madenci] at [2007-12-24]
# 1

Hiya

The console app includes a console application host so if you already have a windows application to host your workflow just add a workflow library project to your solution.

BabyGBear at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

thank you,

I have another question.

In the form when pressing the button, the workflow starts

I wrote the following code in the button1_click event. Is it correct. I have used a my service for work with handle external method and callexternalevent activities

privatevoid Button1_Click(object sender, EventArgs e)

if (wr != null)

{

wr = newWorkflowRuntime();

wr.StartRuntime();

}

ExternalDataExchangeService dataExchange =newExternalDataExchangeService();

workflowRuntime.AddService(dataExchange);

MyService myService =newMyService();

dataExchange.AddService(myService);

WorkflowInstance wi = wr.CreateWorkflow(typeof(WFizin.izinWorkflow));

wi.Start();

madenci at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

A couple of issues regarding your code,

1)- You dont need to add your external data service every time you create and start a workflow. What I would suggest is you create the workflow runtime and add all the services you want, only once during the application initialization and in the button click handler just create and start a workflow.

2)- Just be sure you are aware of the threading model you are using, you are using the default scheduler which will use a new thread from the thread pool to run the workflow and not your button click thread. You might wanna make sure you get notified about teh statuses of the workflow threads.

KhalidAggag at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

thanks

But I dont understand the second. what is the advantages of notification about the statuses of the workflow threads and how can ? change my code acc. to your says.

madenci at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
The advantage is knowing what your workflows are doing now and when did they finish, for example if you want to shut down the application you may want to make sure all workflow threads have completed or wait for the ones to complete yet. The way to get these notifications is by subscribing to the runtime events that the runtime engine emits the ones of interest to you would be Workflow_Completed & Workflow_Terminated. Take a look at the other events emitted by the runtime to determine which ones are of interest to you.
KhalidAggag at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified