Hi,
I am facing problem in loading XAML at runtime.
Below is the code please help me.
public void ProcessRequest(Request request) { // Get the workflow instance id to use Guid instanceId = this.requestToInstanceMapping[request.Id];
// Setup the arguments that are passed to the workflow
IDictionary<string, object> input = new Dictionary<string, object>();
input.Add("Request", request);
using (FileStream fs = new FileStream(@"ProcessRequest.xaml", FileMode.Open))
{
// Load the ProcessRequest workflow
Activity wf = ActivityXamlServices.Load(fs) as Activity;
// Create the workflow instance specifying the arguments and instance id
WorkflowApplication wapp = new WorkflowApplication(wf, input);
string persistenceConnectionString = "Data Source=Dev1;Initial Catalog=InstanceStore;User id=sa;password=xxxxxxx;Asynchronous Processing=True";
SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(persistenceConnectionString);
store.CreateInstanceHandle(instanceId);
wapp.InstanceStore = store;
// When instance is idle unload and persist the isntance
wapp.Idle = delegate(WorkflowApplicationIdleEventArgs e)
{
wapp.Unload();
};
// Setup the persistance
PersistenceProvider persistenceProvider = this.CreatePersistanceProvider(instanceId);
wapp.Extensions.Add(persistenceProvider);
// Start the workflow instance
wapp.Run();
}
}