I have been looking at the WF Wizard examples on endpoint.tv and here: http://stevenalexander.posterous.com/integrating-a-persisted-wf40-workflow-with-mv
I want to be able to use a WF to drive the wizard, but also to act as a temporary store for incomplete wizards. This means that for each step of the wizard I dont persist the data, until the end of the workflow, when all data has been entered.
I have a basic example which is almost working, based on the link above that works by:
However, the problem is that although the WF is saving data, I cannot see a way to retrieve the data mid way. i.e. if the user reloads step 1, I dont know how I can get that persisted model back to the user.
Any suggestions?
ok.. for anyone else..
I resolved this by using my own "Notification" extension, which has a Notification event handler as such:
public class HostEventNotifier : IHostNotification
{
public event EventHandler<HostNotifyEventArgs> Notification;
public void Notify(object model)
{
if(Notification != null)
{
Notification(this, new HostNotifyEventArgs(model));
}
}
}
The extension was added to the WF application and could be called in my wizard eventsteps as:
var ext = context.GetExtension<IHostNotification>();
var parentModel = context.GetValue(ParentModel);
if(ext!=null && parentModel !=null)
{
if(parentModel.ContainsKey(bookmarkName))
{
ext.Notify(parentModel[bookmarkName]);
Thread.Sleep(500);
}
}
Finaly the extension event handler was set to a method that knew how to handle my data.
This is still incomplete - I havent worked out the threading model (hence the uglt Thread.Sleep) but I wanted to give an answer to anyone else looking.
The idea for this came from "Pro WF 4/ Bukovics", apress