Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Navigational Workflows Unleashed in WWF/ASP.NET 3.5

, 21 Oct 2008
Case-study on the internals of a Navigational Workflow engine for a fictional dating website called “World Wide Dating”.
datesite.zip
DateSite
App_Data
bin
database setup procedure
DateSite.csproj.user
Global.asax
images
complete.png
critical.png
logo2.png
warning.png
Profile.dbml
Profile.dbml.layout
Properties
Service References
NavigationWorkflow
bin
NavigationWorkflow.layout
Properties
Settings.settings
using System;
using System.Workflow.Activities;

namespace DateSiteNavigation
{
    /// <summary>
    /// A local service that exposes events used by both the host application
    /// and the navigational workflow to communicate with each other.
    /// </summary>
	public class NavigationService : INavigationService 
	{
        /// <summary>
        /// Sent to the host application indicating the page to go to.
        /// </summary>
        public event EventHandler<PageToGoToEventArgs> PageToGoToReceived;

        /// <summary>
        /// Sent to the host application indicating if the navigational workflow is in sync,
        /// and if not it contains the information necessary to synchronize it.
        /// </summary>
        public event EventHandler<OutgoingSynchronizeEventArgs> OutgoingSynchronizeReceived;

        #region INavigationService Members

        public event EventHandler<ExternalDataEventArgs> Previous;
        public event EventHandler<ExternalDataEventArgs> Next;
        public event EventHandler<ExternalDataEventArgs> Rehydrated;
        public event EventHandler<IncomingSynchronizeEventArgs> IncomingSynchronize;
        public event EventHandler<ErrorEventArgs> Error;
        public event EventHandler<ExternalDataEventArgs> SkipToBasics;
        public event EventHandler<ExternalDataEventArgs> SkipToAppearance;
        public event EventHandler<ExternalDataEventArgs> SkipToLifestyle;
        public event EventHandler<ExternalDataEventArgs> SkipToInterests;
        public event EventHandler<ExternalDataEventArgs> SkipToComplete;

        public void OnPageToGoTo(PageToGoToEventArgs args)
        {
            if (PageToGoToReceived != null)
            {
                PageToGoToReceived(this, args);
            }
        }

        public void OnOutgoingSynchronize(OutgoingSynchronizeEventArgs args)
        {
            if (OutgoingSynchronizeReceived != null)
            {
                OutgoingSynchronizeReceived(this, args);
            }
        }

        #endregion

        /// <summary>
        /// Wrapper for the host app to call the Previous event.
        /// </summary>
        /// <param name="args"></param>
        public void OnPrevious(ExternalDataEventArgs args)
        {
            if (Previous != null)
            {
                Previous(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the Next event.
        /// </summary>
        /// <param name="args"></param>
        public void OnNext(ExternalDataEventArgs args)
        {
            if (Next != null)
            {
                Next(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the Rehydrated event.
        /// </summary>
        /// <param name="args"></param>
        public void OnRehydrated(ExternalDataEventArgs args)
        {
            if (Rehydrated != null)
            {
                Rehydrated(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the IncomingSynchronize event.
        /// </summary>
        /// <param name="args"></param>
        public void OnIncomingSynchronize(IncomingSynchronizeEventArgs args)
        {
            if (IncomingSynchronize != null)
            {
                IncomingSynchronize(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the Error event.
        /// </summary>
        /// <param name="args"></param>
        public void OnError(ErrorEventArgs args)
        {
            if (Error != null)
            {
                Error(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the SkipToBasics event.
        /// </summary>
        /// <param name="args"></param>
        public void OnSkipToBasics(ExternalDataEventArgs args)
        {
            if (SkipToBasics != null)
            {
                SkipToBasics(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the SkipToAppearance event.
        /// </summary>
        /// <param name="args"></param>
        public void OnSkipToAppearance(ExternalDataEventArgs args)
        {
            if (SkipToAppearance != null)
            {
                SkipToAppearance(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the SkipToLifestyle event.
        /// </summary>
        /// <param name="args"></param>
        public void OnSkipToLifestyle(ExternalDataEventArgs args)
        {
            if (SkipToLifestyle != null)
            {
                SkipToLifestyle(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the SkipToInterests event.
        /// </summary>
        /// <param name="args"></param>
        public void OnSkipToInterests(ExternalDataEventArgs args)
        {
            if (SkipToInterests != null)
            {
                SkipToInterests(null, args);
            }
        }

        /// <summary>
        /// Wrapper for the host app to call the SkipToComplete event.
        /// </summary>
        /// <param name="args"></param>
        public void OnSkipToComplete(ExternalDataEventArgs args)
        {
            if (SkipToComplete != null)
            {
                SkipToComplete(null, args);
            }
        }
    }
}

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)

About the Author

Pero Matić
Software Developer (Senior) Plan A Software
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 21 Oct 2008
Article Copyright 2008 by Pero Matić
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid