private void NewGame_Click(object sender, EventArgs e)
        {
            var inputs = new Dictionary <string, object>();

            inputs.Add("MaxNumber", Convert.ToInt32(NumberRange.SelectedItem));

            WorkflowIdentity identity = null;

            switch (WorkflowType.SelectedItem.ToString())
            {
            case "SequentialNumberGuessWorkflow":
                identity = WorkflowVersionMap.SequentialNumberGuessIdentity;
                break;

            case "StateMachineNumberGuessWorkflow":
                identity = WorkflowVersionMap.StateMachineNumberGuessIdentity;
                break;

            case "FlowchartNumberGuessWorkflow":
                identity = WorkflowVersionMap.FlowchartNumberGuessIdentity;
                break;

            case "SequentialNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.SequentialNumberGuessIdentity_v1;
                break;

            case "StateMachineNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.StateMachineNumberGuessIdentity_v1;
                break;

            case "FlowchartNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.FlowchartNumberGuessIdentity_v1;
                break;
            }
            ;

            Activity wf = WorkflowVersionMap.GetWorkflowDefinition(identity);

            WorkflowApplication wfApp = new WorkflowApplication(wf, inputs, identity);

            // Add the workflow to the list and display the version information.
            WorkflowStarting         = true;
            InstanceId.SelectedIndex = InstanceId.Items.Add(wfApp.Id);
            WorkflowVersion.Text     = identity.ToString();
            WorkflowStarting         = false;

            // Configure the instance store, extensions, and
            // workflow lifecycle handlers.
            ConfigureWorkflowApplication(wfApp);

            // Start the workflow.
            wfApp.Run();
        }
        private void NewGame_Click(object sender, EventArgs e)
        {
            var inputs = new Dictionary <string, object>
            {
                { "MaxNumber", Convert.ToInt32(NumberRange.SelectedItem) }
            };

            WorkflowIdentity identity = null;

            switch (WorkflowType.SelectedItem.ToString())
            {
            case "SequentialNumberGuessWorkflow":
                identity = WorkflowVersionMap.SequentialNumberGuessIdentity;
                break;

            case "StateMachineNumberGuessWorkflow":
                identity = WorkflowVersionMap.StateMachineNumberGuessIdentity;
                break;

            case "FlowchartNumberGuessWorkflow":
                identity = WorkflowVersionMap.FlowchartNumberGuessIdentity;
                break;

            case "SequentialNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.SequentialNumberGuessIdentity_v1;
                break;

            case "StateMachineNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.StateMachineNumberGuessIdentity_v1;
                break;

            case "FlowchartNumberGuessWorkflow v1":
                identity = WorkflowVersionMap.FlowchartNumberGuessIdentity_v1;
                break;
            }
            ;

            Activity wf = WorkflowVersionMap.GetWorkflowDefinition(identity);

            WorkflowApplication wfApp = new WorkflowApplication(wf, inputs, identity);

            WorkflowStarting         = true;
            InstanceId.SelectedIndex = InstanceId.Items.Add(wfApp.Id);
            WorkflowVersion.Text     = identity.ToString();
            WorkflowStarting         = false;

            ConfigureWorkflowApplication(wfApp);

            wfApp.Run();
        }
Exemple #3
0
 public static void PersistAndUpdate(this TestWorkflowRuntime twRuntime, WorkflowIdentity updatedIdentity)
 {
     twRuntime.PersistWorkflow();
     twRuntime.UnloadWorkflow();
     if (null != updatedIdentity)
     {
         twRuntime.LoadAndUpdateWorkflow(updatedIdentity.ToString());
     }
     else
     {
         twRuntime.LoadWorkflow();
     }
     twRuntime.ResumeWorkflow();
 }
Exemple #4
0
 public static string GetIdentityDescription(WorkflowIdentity identity)
 {
     return(identity.ToString());
 }
 public static string GetIdentityDescription(WorkflowIdentity identity)
 {
     return identity.ToString();
 }
 static Guid GetIdentityHash(WorkflowIdentity id)
 {
     byte[] identityHashBuffer = Encoding.Unicode.GetBytes(id.ToString());
     return new Guid(HashHelper.ComputeHash(identityHashBuffer));
 }
 static Guid GetIdentityHash(WorkflowIdentity id)
 {
     byte[] identityHashBuffer = Encoding.Unicode.GetBytes(id.ToString());
     return(new Guid(HashHelper.ComputeHash(identityHashBuffer)));
 }