public void AssignCallToSupportPerson(Guid guid, Call aCall) { if (CallAssignedToSupportPerson != null) CallAssignedToSupportPerson(null, new CallStateChangedEventArgs(guid, aCall)); }
public CallStateChangedEventArgs(Guid guid, Call aCall) : base(guid) { _call = aCall; WaitForIdle = true; }
public void SendCallToPhoneResolution(Guid guid, Call aCall) { if (CallSentToPhoneResolution != null) CallSentToPhoneResolution(null, new CallStateChangedEventArgs(guid, aCall)); }
public void ResolveCall(Guid guid, Call aCall) { if (CallResolved != null) CallResolved(null, new CallStateChangedEventArgs(guid, aCall)); }
public void EndCallMoreInformationRequired(Guid guid, Call aCall) { if (CallEndedMoreInformationRequired != null) CallEndedMoreInformationRequired(null, new CallStateChangedEventArgs(guid, aCall)); }
static void Main(string[] args) { using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { AutoResetEvent waitHandle = new AutoResetEvent(false); workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) { waitHandle.Set(); }; workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) { Console.WriteLine(e.Exception.Message); waitHandle.Set(); }; // Add Persistence and Tracking SqlWorkflowPersistenceService persistenceService; persistenceService = new SqlWorkflowPersistenceService( ConfigurationManager. ConnectionStrings["PersistentDataStore"]. ConnectionString, true, TimeSpan.MaxValue, TimeSpan.MinValue); workflowRuntime.AddService(persistenceService); SqlTrackingService trackingService; trackingService = new SqlTrackingService( ConfigurationManager. ConnectionStrings["PersistentDataStore"]. ConnectionString); trackingService.UseDefaultProfile = true; workflowRuntime.AddService(trackingService); // Set up the data exchange ExternalDataExchangeService dataExchange; dataExchange = new ExternalDataExchangeService(); workflowRuntime.AddService(dataExchange); // Instatiate the local communication service CustomerCallService customerCallService = new CustomerCallService(); dataExchange.AddService(customerCallService); // Create a new workflow instance WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(CustomerService)); instance.Start(); // Create a new Call Call newCall = new Call(); newCall.CallersFirstName = "Alex"; newCall.Product = "Widget Number Nine"; // Change the state using the service and events customerCallService.ReceiveCall(instance.InstanceId, newCall); customerCallService.SendCallToPhoneResolution(instance.InstanceId, newCall); customerCallService.AssignCallToSupportPerson(instance.InstanceId, newCall); //Get a look at where we have wound up PrintStateMachineState(workflowRuntime, instance.InstanceId); // Change the state one last time customerCallService.ResolveCall(instance.InstanceId, newCall); // Print the history of our instance PrintHistory(workflowRuntime, instance.InstanceId); waitHandle.WaitOne(); // Keep the console open until key strokes are entered so that you can see what we did... Console.ReadLine(); } }