Click here to Skip to main content
15,886,873 members
Articles / Desktop Programming / Win32

Host and Workflow: Two Worlds to Communicate. Part V

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
4 Oct 2008CPOL7 min read 36.8K   408   23  
Part V: Intercommunications with a Workflow instance using Correlation parameter
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Reflection;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

namespace CorrelationDemo
{
	partial class MailFactory
	{
		#region Designer generated code
		
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
        [System.Diagnostics.DebuggerNonUserCode]
		private void InitializeComponent()
		{
            this.CanModifyActivities = true;
            System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.Runtime.CorrelationToken correlationtoken1 = new System.Workflow.Runtime.CorrelationToken();
            System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind6 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind7 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.Runtime.CorrelationToken correlationtoken2 = new System.Workflow.Runtime.CorrelationToken();
            System.Workflow.ComponentModel.ActivityBind activitybind8 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind9 = new System.Workflow.ComponentModel.ActivityBind();
            System.Workflow.ComponentModel.ActivityBind activitybind10 = new System.Workflow.ComponentModel.ActivityBind();
            this.sendEmailNotification2 = new CommunicationManager.SendEmailNotification();
            this.sendEmailNotification1 = new CommunicationManager.SendEmailNotification();
            this.synchronizationScopeActivity2 = new System.Workflow.ComponentModel.SynchronizationScopeActivity();
            this.sendEmailToWorkflow2 = new CommunicationManager.SendEmailToWorkflow();
            this.getEmailAddress2 = new CommunicationManager.GetEmailAddress();
            this.synchronizationScopeActivity1 = new System.Workflow.ComponentModel.SynchronizationScopeActivity();
            this.sendEmailToWorkflow1 = new CommunicationManager.SendEmailToWorkflow();
            this.getEmailAddress1 = new CommunicationManager.GetEmailAddress();
            this.seqCustomerEmail = new System.Workflow.Activities.SequenceActivity();
            this.seqProviderEmail = new System.Workflow.Activities.SequenceActivity();
            this.parallelActivity1 = new System.Workflow.Activities.ParallelActivity();
            this.codeInit = new System.Workflow.Activities.CodeActivity();
            // 
            // sendEmailNotification2
            // 
            this.sendEmailNotification2.Name = "sendEmailNotification2";
            activitybind1.Name = "MailFactory";
            activitybind1.Path = "NotificationMessageCustomer";
            activitybind2.Name = "MailFactory";
            activitybind2.Path = "idInstance";
            this.sendEmailNotification2.MethodInvoking += new System.EventHandler(this.FillCustomerNotification);
            this.sendEmailNotification2.SetBinding(CommunicationManager.SendEmailNotification.wfIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
            this.sendEmailNotification2.SetBinding(CommunicationManager.SendEmailNotification.NotificationProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
            // 
            // sendEmailNotification1
            // 
            this.sendEmailNotification1.Name = "sendEmailNotification1";
            activitybind3.Name = "MailFactory";
            activitybind3.Path = "NotificationMessageProvider";
            activitybind4.Name = "MailFactory";
            activitybind4.Path = "idInstance";
            this.sendEmailNotification1.MethodInvoking += new System.EventHandler(this.FillProviderNotification);
            this.sendEmailNotification1.SetBinding(CommunicationManager.SendEmailNotification.wfIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
            this.sendEmailNotification1.SetBinding(CommunicationManager.SendEmailNotification.NotificationProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
            // 
            // synchronizationScopeActivity2
            // 
            this.synchronizationScopeActivity2.Activities.Add(this.sendEmailNotification2);
            this.synchronizationScopeActivity2.Name = "synchronizationScopeActivity2";
            this.synchronizationScopeActivity2.SynchronizationHandles = null;
            // 
            // sendEmailToWorkflow2
            // 
            correlationtoken1.Name = "b1";
            correlationtoken1.OwnerActivityName = "seqCustomerEmail";
            this.sendEmailToWorkflow2.CorrelationToken = correlationtoken1;
            activitybind5.Name = "MailFactory";
            activitybind5.Path = "EmailAddressCustomer";
            this.sendEmailToWorkflow2.Name = "sendEmailToWorkflow2";
            this.sendEmailToWorkflow2.Sender = null;
            this.sendEmailToWorkflow2.Typo = "CUSTOMER";
            this.sendEmailToWorkflow2.SetBinding(CommunicationManager.SendEmailToWorkflow.EmailProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
            // 
            // getEmailAddress2
            // 
            this.getEmailAddress2.CorrelationToken = correlationtoken1;
            this.getEmailAddress2.Name = "getEmailAddress2";
            activitybind6.Name = "MailFactory";
            activitybind6.Path = "orderNumber";
            this.getEmailAddress2.typo = "CUSTOMER";
            activitybind7.Name = "MailFactory";
            activitybind7.Path = "idInstance";
            this.getEmailAddress2.SetBinding(CommunicationManager.GetEmailAddress.wfIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind7)));
            this.getEmailAddress2.SetBinding(CommunicationManager.GetEmailAddress.orderNumberProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind6)));
            // 
            // synchronizationScopeActivity1
            // 
            this.synchronizationScopeActivity1.Activities.Add(this.sendEmailNotification1);
            this.synchronizationScopeActivity1.Name = "synchronizationScopeActivity1";
            this.synchronizationScopeActivity1.SynchronizationHandles = null;
            // 
            // sendEmailToWorkflow1
            // 
            correlationtoken2.Name = "a1";
            correlationtoken2.OwnerActivityName = "seqProviderEmail";
            this.sendEmailToWorkflow1.CorrelationToken = correlationtoken2;
            activitybind8.Name = "MailFactory";
            activitybind8.Path = "EmailAddressProvider";
            this.sendEmailToWorkflow1.Name = "sendEmailToWorkflow1";
            this.sendEmailToWorkflow1.Sender = null;
            this.sendEmailToWorkflow1.Typo = "PROVIDER";
            this.sendEmailToWorkflow1.SetBinding(CommunicationManager.SendEmailToWorkflow.EmailProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind8)));
            // 
            // getEmailAddress1
            // 
            this.getEmailAddress1.CorrelationToken = correlationtoken2;
            this.getEmailAddress1.Name = "getEmailAddress1";
            activitybind9.Name = "MailFactory";
            activitybind9.Path = "orderNumber";
            this.getEmailAddress1.typo = "PROVIDER";
            activitybind10.Name = "MailFactory";
            activitybind10.Path = "idInstance";
            this.getEmailAddress1.SetBinding(CommunicationManager.GetEmailAddress.wfIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind10)));
            this.getEmailAddress1.SetBinding(CommunicationManager.GetEmailAddress.orderNumberProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind9)));
            // 
            // seqCustomerEmail
            // 
            this.seqCustomerEmail.Activities.Add(this.getEmailAddress2);
            this.seqCustomerEmail.Activities.Add(this.sendEmailToWorkflow2);
            this.seqCustomerEmail.Activities.Add(this.synchronizationScopeActivity2);
            this.seqCustomerEmail.Name = "seqCustomerEmail";
            // 
            // seqProviderEmail
            // 
            this.seqProviderEmail.Activities.Add(this.getEmailAddress1);
            this.seqProviderEmail.Activities.Add(this.sendEmailToWorkflow1);
            this.seqProviderEmail.Activities.Add(this.synchronizationScopeActivity1);
            this.seqProviderEmail.Name = "seqProviderEmail";
            // 
            // parallelActivity1
            // 
            this.parallelActivity1.Activities.Add(this.seqProviderEmail);
            this.parallelActivity1.Activities.Add(this.seqCustomerEmail);
            this.parallelActivity1.Name = "parallelActivity1";
            // 
            // codeInit
            // 
            this.codeInit.Name = "codeInit";
            this.codeInit.ExecuteCode += new System.EventHandler(this.InitWorkflow);
            // 
            // MailFactory
            // 
            this.Activities.Add(this.codeInit);
            this.Activities.Add(this.parallelActivity1);
            this.Name = "MailFactory";
            this.CanModifyActivities = false;

		}

		#endregion

        private CommunicationManager.SendEmailNotification sendEmailNotification2;
        private CommunicationManager.SendEmailNotification sendEmailNotification1;
        private SynchronizationScopeActivity synchronizationScopeActivity2;
        private CommunicationManager.SendEmailToWorkflow sendEmailToWorkflow2;
        private CommunicationManager.GetEmailAddress getEmailAddress2;
        private SynchronizationScopeActivity synchronizationScopeActivity1;
        private CommunicationManager.SendEmailToWorkflow sendEmailToWorkflow1;
        private CommunicationManager.GetEmailAddress getEmailAddress1;
        private SequenceActivity seqCustomerEmail;
        private SequenceActivity seqProviderEmail;
        private ParallelActivity parallelActivity1;
        private CodeActivity codeInit;
































    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Avalon Development
United States United States
Jose A. Garcia Guirado, Electronic Engineer, graduated in Havana/Cuba 1982, MCTS, MCSD.NET, MCAD.NET, MCSE. Worked in the Institute for Cybernetics and Mathematics of Academy of Science of Cuba for 8 years; since 1995 working as free software architect, developer and adviser, first in Argentina and from 2003 to 2010, in Germany as External consultant in DWS Luxembourg, AIXTRON AG and Shell Deutschland GmbH and from 2010 to 2012 in Mexico working for Twenty Century Fox, and Mexico Stock Exchange (BMV). From 2013 to now in USA, Florida, First in FAME Inc. and now as Senior Software Engineer in Spirit Airlines.

Comments and Discussions