Service Enabling Workflows
- Posted: Apr 28, 2008 at 2:53 PM
- 4,852 Views
- 8 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- High Quality WMV (PC, Xbox, MCE)
- Mid Quality WMV (Lo-band, Mobile)
Part three in my short series on Workflow Foundation covers service enabling workflows. Service enabling a workflow doesn’t necessarily mean WCF, though WCF is certainly an option. In this screencast we look at leveraging services to enable activities that can run in various host environments.
This is a continuation from part 2, so you may want to view that screencast first if you haven’t seen it.
Part 1: From Code Activity to Custom Activity
Part 2: Activity Defaults and Validation
Files: Service Enabled Sample Files [Updated]
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Chris
The link to the code seems to be broken!
Cheers,
indyfromoz
The link to the code for the Service Enabled Sample files does not work. Are they posted?
ron.garlit@gmail.com
The biggest problem is to route the the message from the Service Object to the UI Control. This has to be done by invoking a delegate on the form or the control itself, gently asking it do display someting for you. I usually do it with events exposed by the service class:
// IMessageService.cs:
[ExternalDataExchange]
public interface IMessageService
{
void SendMessage(string message);
}
//MessageService.cs
public class MessageService : IMessageService
{
public event EventHandler<MessageReceivedEventArgs> MessageReceived;
public void SendMessage(string message)
{
if (MessageReceived != null)
MessageReceived(this,
new MessageReceivedEventArgs(
WorkflowEnvironment.WorkflowInstanceId,
message));
}
}
The EventArgs object for this Event is a simple class derived from ExternalDataEventArgs, that contains a string property for the message. To identify the sender the ExternalDataEventArgs Ctor always requires a Guid.
Now you can instantiate the service from the host application, then register to the MessageReceived Event. When received you can build a delegate that will be invoked on the form to change properties of the controls to display the message
// in form load:
ExternalDataExchangeService service = new ExternalDataExchangeService();
_runtime.AddService(service);
_messageService = new GuessingGameService();
service.AddService(_gameService);
_messageService.MessageReceived += new EventHandler<MessageReceivedEventArgs>(_messageService_MessageReceived);
// the delegate
private delegate void UpdateDelegate();
void _messageService_MessageReceived(object sender, MessageReceivedEventArgs e)
{
UpdateDelegate theDelegate = delegate()
{
lblMessage.Text = e.Message;
};
_instanceId = e.InstanceId;
this.Invoke(theDelegate); // invokes the delegate on the form updating the control.
}
-----
As there has no example been distributed so far - link still broken - i decided to do it on my own, and i hope this helps. if your want my sample code (very similar to this) just message me.
Remove this comment
Remove this thread
close