Q: Clear and Append or Set?
statementActivity1.MainPrompt.ClearContent();
statementActivity1.MainPrompt.AppendText("This is a prompt");
or
statementActivity1.MainPrompt.SetText("This is a prompt");
A: I've used both, and it doesn't make that big of a difference. I've decided on the SetText as a primary method, as it is one call vs two. As the PromptBuilder really acts a string builder, you probably won't notice a performance difference.
Q: What's the difference between setting it in the TurnStarting event and via the IDE?
A: We've seen this in all of the samples, post etc..
sayGreeting_TurnStarting(...)
{
this.sayGreeting.MainPrompt.SetText("Welcome to whatever application");
}
It's typically good for samples to get to the point, but you really shouldn't do this in a real application. If you set this text via the Workflow IDE instead, your application sets it once, not once per turn! Again you won't notice much of a performance difference, but it adds up!
Q: Should you load inline grammar in the TurnStarting event?
A: Like the previous question, if you need to change the grammar once per turn instead of once per session, the change it in the TurnStarting otherwise set it via the IDE. If you need something in between, you can use the Executing event instead...
Q: What is the order of Event execution - Workflow & Activity?
A: Workflow execution is as follows:
1.) Designer code is called via the Constructor InitializeComponent()
2.) InitializeProperties
3.) Initialize
4.) Execute
5.) Your Code
6.) Uninitialize
7.) Dispose
Activity:
1.) StatusChanged
2.) Executing
3.) TurnStarting
4.) Closed
It will help you tremendously to figure out how each of these works, and will help make the right decision of where to set your prompts and grammars.
I didn't answer all of the questions, but count on reading about them shortly. Look over and learn the execution order and what exactly happens in each event.