コード例 #1
0
ファイル: program.cs プロジェクト: mconnew/dotnet-api-docs
        static void Main()
        {
            // Same workflow as Dataflow sample
            Activity            workflow = LoadProgram("Dataflow.xaml");
            WorkflowServiceHost host     = new WorkflowServiceHost(workflow,
                                                                   new Uri("http://localhost/Dataflow.xaml"));

            WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

            CreationEndpoint creationEndpoint = new CreationEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation")));

            host.AddServiceEndpoint(controlEndpoint);
            host.AddServiceEndpoint(creationEndpoint);

            host.Open();

            Console.WriteLine("Host open...");

            IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel();

            // Start a new instance of the workflow
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint);

            controlClient.Unsuspend(instanceId);

            Console.WriteLine("Hit any key to exit Host...");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tian1ll1/WPF_Examples
        static void Main()
        {
            // Same workflow as Dataflow sample
            Activity workflow = LoadProgram("Dataflow.xaml");
            WorkflowServiceHost host = new WorkflowServiceHost(workflow,
                new Uri("http://localhost/Dataflow.xaml"));

            WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

            CreationEndpoint creationEndpoint = new CreationEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation")));

            host.AddServiceEndpoint(controlEndpoint);
            host.AddServiceEndpoint(creationEndpoint);

            host.Open();

            Console.WriteLine("Host open...");

            IWorkflowCreation creationClient = new ChannelFactory<IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel();

            // Start a new instance of the workflow
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint);
            controlClient.Unsuspend(instanceId);

            Console.WriteLine("Hit any key to exit Host...");
            Console.ReadLine();
        }
コード例 #3
0
ファイル: client.cs プロジェクト: zhimaqiao51/docs
 static void Snippet2()
 {
     // <Snippet2>
     WorkflowControlEndpoint wce           = new WorkflowControlEndpoint(new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));
     WorkflowControlClient   controlClient = new WorkflowControlClient(wce);
     // </Snippet2>
 }
コード例 #4
0
        protected void OnCancelClick(object sender, EventArgs e)
        {
            WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess")));
            controlClient.Cancel(info.WorkflowInstanceId);

            // hide all button
            this.HideAllButtons("Cancellation sent, click here to go back to the Inbox");
        }
コード例 #5
0
        protected void OnCancelClick(object sender, EventArgs e)
        {
            WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess")));

            controlClient.Cancel(info.WorkflowInstanceId);

            // hide all button
            this.HideAllButtons("Cancellation sent, click here to go back to the Inbox");
        }
コード例 #6
0
        protected void OnCancelClick(object sender, EventArgs e)
        {
            // perform cancellation
            WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess")));
            controlClient.Cancel(info.WorkflowInstanceId);

            // set UI
            this.btnCancel.Visible = false;
            this.btnBack.Width = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
            this.btnBack.Text = "Cancellation sent, click here to go back to the Inbox";
        }
コード例 #7
0
        protected void OnCancelClick(object sender, EventArgs e)
        {
            // perform cancellation
            WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess")));

            controlClient.Cancel(info.WorkflowInstanceId);

            // set UI
            this.btnCancel.Visible = false;
            this.btnBack.Width     = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
            this.btnBack.Text      = "Cancellation sent, click here to go back to the Inbox";
        }
コード例 #8
0
ファイル: client.cs プロジェクト: zhimaqiao51/docs
        static void Snippet11()
        {
            // <Snippet11>
            IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel();
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

            // ...

            controlClient.Suspend(instanceId, "Sample to suspend");
            // </Snippet11>
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: tian1ll1/WPF_Examples
        static void Main()
        {
            Console.WriteLine("Client starting...");

            IWorkflowCreation creationClient = new ChannelFactory<IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel();

            // Start a new instance of the workflow
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));
            controlClient.Unsuspend(instanceId);
            Console.WriteLine("Client exiting...");
        }
コード例 #10
0
        static void Main()
        {
            Console.WriteLine("Client starting...");

            IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel();

            // Start a new instance of the workflow
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

            controlClient.Unsuspend(instanceId);
            Console.WriteLine("Client exiting...");
        }
コード例 #11
0
        static void Main()
        {
            // Same workflow as Dataflow sample
            Activity            workflow = LoadProgram("Dataflow.xaml");
            WorkflowServiceHost host     = new WorkflowServiceHost(workflow,
                                                                   new Uri("http://localhost/Dataflow.xaml"));

            host.Description.Behaviors.Add(new SqlWorkflowInstanceStoreBehavior
            {
                ConnectionString                 = ConfigurationManager.ConnectionStrings["persistenceStore"].ConnectionString,
                InstanceEncodingOption           = InstanceEncodingOption.None,
                InstanceCompletionAction         = InstanceCompletionAction.DeleteAll,
                InstanceLockedExceptionAction    = InstanceLockedExceptionAction.NoRetry,
                HostLockRenewalPeriod            = new TimeSpan(0, 0, 30),
                RunnableInstancesDetectionPeriod = new TimeSpan(0, 0, 5)
            });

            WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

            CreationEndpoint creationEndpoint = new CreationEndpoint(
                new BasicHttpBinding(),
                new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation")));


            host.AddServiceEndpoint(controlEndpoint);
            host.AddServiceEndpoint(creationEndpoint);

            host.Open();

            Console.WriteLine("Host open...");

            IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel();

            // Start a new instance of the workflow
            Guid instanceId = creationClient.CreateSuspended(null);
            WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint);

            controlClient.Unsuspend(instanceId);

            Console.WriteLine("Hit any key to exit Host...");
            Console.ReadLine();
        }
コード例 #12
0
        static void Cancel()
        {
            try
            {
                Console.WriteLine("Enter an OrderId to cancel");
                String input           = Console.ReadLine();
                Int32  orderIdToCancel = 0;
                if (String.IsNullOrEmpty(input))
                {
                    Console.WriteLine("A value must be entered");
                    return;
                }
                Int32.TryParse(input, out orderIdToCancel);
                if (orderIdToCancel == 0)
                {
                    Console.WriteLine("OrderId must not be zero");
                    return;
                }

                Guid instanceId = Guid.Empty;
                if (!queriedInstances.TryGetValue(orderIdToCancel,
                                                  out instanceId))
                {
                    Console.WriteLine("Instance not found");
                    return;
                }

                using (WorkflowControlClient client =
                           new WorkflowControlClient("ClientControlEndpoint"))
                {
                    client.Cancel(instanceId);
                }
            }
            catch (Exception exception)
            {
                lastOrderId = 0;
                Console.WriteLine("Cancel Unhandled exception: {0}",
                                  exception.Message);
            }
        }
コード例 #13
0
        static void Main()
        {
            Console.WriteLine("Client starting...");

            try
            {
                IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel();

                // Start a new instance of the workflow
                Guid instanceId = creationClient.CreateSuspended(null);

                // initialize workflow control client
                WorkflowControlClient controlClient = new WorkflowControlClient(
                    new BasicHttpBinding(),
                    new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));

                controlClient.Unsuspend(instanceId);
                Console.WriteLine($"Client exiting...");

                // you should have an instance persisted by now

                Thread.Sleep(10000);
                // if cancel, goes in executing, suspended -> idle, not-suspended
                // if abandon, goes in executing, suspended and stays there
                // if terminate, clears the instance from database
                controlClient.Terminate(instanceId);
                Console.WriteLine($"instance terminated...");

                // you should have the persistence workflow instance removed from database by now
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
コード例 #14
0
ファイル: client.cs プロジェクト: zhimaqiao51/docs
 static void Snippet4()
 {
     // <Snippet4>
     WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName", new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml")));
     // </Snippet4>
 }
コード例 #15
0
ファイル: client.cs プロジェクト: zhimaqiao51/docs
 static void Snippet5()
 {
     // <Snippet5>
     WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName", "http://localhost/DataflowControl.xaml");
     // </Snippet5>
 }
コード例 #16
0
ファイル: client.cs プロジェクト: zhimaqiao51/docs
 static void Snippet3()
 {
     // <Snippet3>
     WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName");
     // </Snippet3>
 }
コード例 #17
0
ファイル: FlowTasksControl.cs プロジェクト: pgava/FlowTasks
 public FlowTasksControl(string clientControlEndPoint)
 {
     _controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(clientControlEndPoint));
 }