Exemplo n.º 1
0
 static void Main(string[] args)
 {
     Sequence workflow;
     WorkflowServiceHost host = null;
     try
     {
         workflow = CreateWorkflow();
         host = new WorkflowServiceHost(workflow, new Uri("net.pipe://localhost"));
         ResumeBookmarkEndpoint endpoint = new ResumeBookmarkEndpoint(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress("net.pipe://localhost/workflowCreationEndpoint"));
         host.AddServiceEndpoint(endpoint);
         host.Open();
         IWorkflowCreation client = new ChannelFactory<IWorkflowCreation>(endpoint.Binding, endpoint.Address).CreateChannel();
         //create an instance
         Guid id = client.Create(null);
         Console.WriteLine("Workflow instance {0} created",id);
         //resume bookmark
         client.ResumeBookmark(id, "hello","Hello World!");
         Console.WriteLine("Press return to exit ...");
         Console.ReadLine();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     finally
     {
         if (host != null)
         {
             host.Close();
         }
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Sequence            workflow;
            WorkflowServiceHost host = null;

            try
            {
                workflow = CreateWorkflow();
                host     = new WorkflowServiceHost(workflow, new Uri("net.pipe://localhost"));
                ResumeBookmarkEndpoint endpoint = new ResumeBookmarkEndpoint(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress("net.pipe://localhost/workflowCreationEndpoint"));
                host.AddServiceEndpoint(endpoint);
                host.Open();
                IWorkflowCreation client = new ChannelFactory <IWorkflowCreation>(endpoint.Binding, endpoint.Address).CreateChannel();
                //create an instance
                Guid id = client.Create(null);
                Console.WriteLine("Workflow instance {0} created", id);
                //resume bookmark
                client.ResumeBookmark(id, "hello", "Hello World!");
                Console.WriteLine("Press return to exit ...");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                if (host != null)
                {
                    host.Close();
                }
            }
        }