468,242 Members | 1,728 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

host a windows workflow problem

Hi

I was using a console application to host the windows workflow and when
I change to winforms, I don't know how to do it...

I pass the parameters into the workflow from the winform and is work
fine, but I try to output something from my workflow to the winform
that's when the problem arise...

I know that I can write this code line in my workflow code so I can
display a message box in the winform:

System.Windows.Forms.MessageBox.Show("Hello");

but is it possible for write a code in workflow to add something inside
the listBox?

I want something like listBox1.Items.Add(variablename);
Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Apr 12 '07 #1
3 2278
Hello Claudia,

It's possible, everything you need to do is to set your form to the workflow
- and I think you should never do this.
What's wrong with the event-based approache?!
WF is another level of abstraction, which shound know nothing about your
UI, it's the business logic which works with entities - not the UI controls.

It's directly the UI job to get the info from WF and show it

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

CFHi
CF>
CFI was using a console application to host the windows workflow and
CFwhen I change to winforms, I don't know how to do it...
CF>
CFI pass the parameters into the workflow from the winform and is work
CFfine, but I try to output something from my workflow to the winform
CFthat's when the problem arise...
CF>
CFI know that I can write this code line in my workflow code so I can
CFdisplay a message box in the winform:
CF>
CFSystem.Windows.Forms.MessageBox.Show("Hello");
CF>
CFbut is it possible for write a code in workflow to add something
CFinside the listBox?
CF>
CFI want something like listBox1.Items.Add(variablename);
CF>
Apr 12 '07 #2
Claudia,

The workflow is being processed on a thread that is not the UI thread.
When you receive a notification from the workflow and you want to interact
with the UI, you will need to call the Invoke method on a form/control in
the UI and then pass a delegate that will do the work that you want to have
performed on the UI thread.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Claudia Fong" <cd********@yahoo.co.ukwrote in message
news:Oc**************@TK2MSFTNGP03.phx.gbl...
Hi

I was using a console application to host the windows workflow and when
I change to winforms, I don't know how to do it...

I pass the parameters into the workflow from the winform and is work
fine, but I try to output something from my workflow to the winform
that's when the problem arise...

I know that I can write this code line in my workflow code so I can
display a message box in the winform:

System.Windows.Forms.MessageBox.Show("Hello");

but is it possible for write a code in workflow to add something inside
the listBox?

I want something like listBox1.Items.Add(variablename);
Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***

Apr 12 '07 #3
On Apr 12, 6:42 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Claudia,

The workflow is being processed on a thread that is not the UI thread.
When you receive a notification from the workflow and you want to interact
with the UI, you will need to call theInvokemethod on a form/control in
the UI and then pass a delegate that will do the work that you want to have
performed on the UI thread.

It's even better to call the 'BeginInvoke'-method because the 'Invoke'-
method may lead to deadlocks.

See here: http://kristofverbiest.blogspot.com/...gininvoke.html

regards,

Kristof Verbiest

Apr 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Paolo Losi | last post: by
4 posts views Thread by danths | last post: by
1 post views Thread by Sanjay Poria | last post: by
11 posts views Thread by Grzegorz Staniak | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.