예제 #1
0
        static void Main(string[] args)
        {
            // The following code allows a client to use a non-fully qualified name and resolves https issues such as:
            // System.Net.WebException: The underlying connection was closed: Could not establish trust
            // relationship for the SSL/TLS secure channel
            // NOT for production, only for limited local development.
            //System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (object sender,
            //    System.Security.Cryptography.X509Certificates.X509Certificate certificate,
            //    System.Security.Cryptography.X509Certificates.X509Chain chain,
            //    System.Net.Security.SslPolicyErrors sslPolicyErrors)
            //{
            //    return true;
            //};

            Console.Write("Setting up scope...");
            WorkflowManagementClient client = WorkflowUtils.CreateForSample(baseAddress, "WFMgrGettingStarted");

            WorkflowUtils.PrintDone();

            Console.Write("Publishing GetProducts activity...");
            client.PublishActivity("GetProducts", @"..\..\..\GetProductsActivities\GetProducts.xaml");
            WorkflowUtils.PrintDone();

            Console.Write("Publishing Workflow...");
            client.PublishWorkflow(workflowName, @"..\..\..\GetProductsActivities\GetProductsWorkflow.xaml");
            WorkflowUtils.PrintDone();

            Console.Write("Enter a search keyword: ");
            string SearchKeyword = Console.ReadLine();

            Console.Write("Starting workflow instance...");
            WorkflowStartParameters startParameters = new WorkflowStartParameters();

            startParameters.Content.Add("SearchKeyword", SearchKeyword);
            string instanceId = client.Workflows.Start(workflowName, startParameters);

            WorkflowUtils.PrintDone();

            Console.WriteLine("\nPolling UserStatus...\n");
            string finalUserStatus = client.WaitForWorkflowCompletion(workflowName, instanceId);

            WorkflowUtils.Print("Completed with status: " + finalUserStatus, ConsoleColor.Green);

            Console.WriteLine("Press any key to clean up scope.");
            Console.ReadKey();

            client.CleanUp();

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            // Check test settings - you can deploy to the test host to attach visual studio to it.
            bool test = false;

            Console.WriteLine("Press t to deploy to test host");
            test = Console.ReadLine().ToLower() == "t";
            string baseAddress = string.Format("https://{0}:12290/", machineName);

            if (test)
            {
                baseAddress = string.Format("http://{0}:12292/", machineName);
            }


            // Create scope
            Console.Write("Setting up scope...");
            WorkflowManagementClient client = WorkflowUtils.CreateForSample(baseAddress, scopeName);

            WorkflowUtils.PrintDone();

            // Deploy all activities
            Console.Write("Publishing Phone activities...");
            client.PublishActivity("ReceiveCallerInput", @"..\..\..\PhoneMenuWorkflows\ReceiveCallerInput.xaml");
            client.PublishActivity("RetrieveUserFlights", @"..\..\..\PhoneMenuWorkflows\RetrieveUserFlights.xaml");
            client.PublishActivity("SetNextOptions", @"..\..\..\PhoneMenuWorkflows\SetNextOptions.xaml");
            client.PublishActivity("SayGoodbye", @"..\..\..\PhoneMenuWorkflows\SayGoodbye.xaml");

            WorkflowUtils.PrintDone();

            // Deploy actual workflow, by specifying the external variables
            Console.Write("Publishing Workflow...");
            Collection <ExternalVariable> externalVariables = new Collection <ExternalVariable>
            {
                new ExternalVariable <string> {
                    Name = "UserOptions", Default = "", Modifiers = VariableModifiers.Mapped
                },
                new ExternalVariable <string> {
                    Name = "PhoneNr", Default = "", Modifiers = VariableModifiers.Mapped
                },
                new ExternalVariable <string> {
                    Name = "GoodbyeStatement", Default = "", Modifiers = VariableModifiers.Mapped
                }
            };

            client.PublishWorkflow(workflowName, @"..\..\..\PhoneMenuWorkflows\FlightMenuStateMachine.xaml", externalVariables);

            WorkflowUtils.PrintDone();
        }