That's a good way to think about it. Here's a couple of things to watch out that come to mind:
- Make sure you've unsubscribed from SpeakCompleted before invoking the workflow, otherwise your handler will be invoked if the workflow contains a Statement. The same goes for other event handlers to which you might have subscribed.
- Following on from (1), the safest thing to do is to ensure that your core app doesn't try to interact with the CoreAPI whilst the workflow is running. This applies particularly to SpeechRecognizer et al; e.g. you'll confuse QuestionAnswerActivity if you start a recognition in parallel. However this doesn't stop you doing things in parallel to the workflow that are unrelated to the workflow activities, e.g. a database lookup, and using IApplicationHost.QueueEvent is safe.
- Watch out for property changes when the workflow completes. E.g. if QuestionAnswerActivity changes ISynthesizer.InitialSilenceTimeout, I think the new value persists for the rest of that call.
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm