Exforsys
+ Reply to Thread
Results 1 to 4 of 4

Is the Mediator the best pattern for a Wizard?

This is a discussion on Is the Mediator the best pattern for a Wizard? within the Software Patterns forums, part of the Testing category; Hello, I need to build a windows wizard (winform in C#) that has 4 - 5 steps depending on the ...

  1. #1
    myjunkbuster Guest

    Is the Mediator the best pattern for a Wizard?

    Hello,

    I need to build a windows wizard (winform in C#) that has 4 - 5 steps
    depending on the values the user enters. From my research so far it looks
    like the Mediator pattern may be the best solution. However it looks like
    the main form would have to create the controller and all the step forms.
    This would mean the initial start up would be slow (and costly if they exit
    before reaching the final step), the workflow is hardcoded so changing the
    flow or adding a new step would mean recoding the controller. Granted in
    this case it wouldn't necessarily be the end of the world if that happened
    but is there a better pattern for implementing a Wizard?

    thanks,
    Scott





  2. #2
    William Stacey Guest

    Re: Is the Mediator the best pattern for a Wizard?

    I don't know what pattern this would be, but I built a nice looking wizard
    pretty easy like so:
    1) Create you 1 form.
    2) Add a tab control to it and add number of tabs as you have different
    pages in the wizard. Each tab will display your next step in the wizard.
    You can also skip tabs based on prior input, etc. Use tabs on top
    horizontal.
    3) The tabs allow you to work very easily with your different controls and
    wizard pages.
    4) Each tab page will have a Next and/or Prev buttons that you can
    disable/enable based on input.
    5) When your happy with the wizard, cover up the top tabs with a pic box
    using a graphic, etc. Most MS wizards have some kind of gif on top for
    examples.

    This works very well actually. Please post back if you have other questions
    or if I missed something. Cheers!
    --
    William Stacey, MVP

    "myjunkbuster" <myjunkbuster@hotmail.com> wrote in message
    news:OI2dnZoY8rM7Am6i4p2dnA@comcast.com...
    > Hello,
    >
    > I need to build a windows wizard (winform in C#) that has 4 - 5 steps
    > depending on the values the user enters. From my research so far it looks
    > like the Mediator pattern may be the best solution. However it looks like
    > the main form would have to create the controller and all the step forms.
    > This would mean the initial start up would be slow (and costly if they

    exit
    > before reaching the final step), the workflow is hardcoded so changing the
    > flow or adding a new step would mean recoding the controller. Granted in
    > this case it wouldn't necessarily be the end of the world if that happened
    > but is there a better pattern for implementing a Wizard?
    >
    > thanks,
    > Scott
    >
    >






  3. #3
    myjunkbuster Guest

    Re: Is the Mediator the best pattern for a Wizard?

    Just an FYI here is a link to the Mediator pattern:
    http://www.dofactory.com/Patterns/PatternMediator.aspx I believe Fowler
    refers to this as an application controller. I'm fiddling around with it and
    am making use of .net's visual inheritance. I'm thinking about having the
    mediator determine the flow via a config file so that it will be a little
    more flexible. Granted this is probably way overkill for a wizard but this
    is just a learning exercise.

    Thanks for your comment and I will give it a shot too :-)
    Scott

    "William Stacey" <staceywREMOVE@mvps.org> wrote in message
    news:vvi04vgk3s9r7d@corp.supernews.com...
    > I don't know what pattern this would be, but I built a nice looking wizard
    > pretty easy like so:
    > 1) Create you 1 form.
    > 2) Add a tab control to it and add number of tabs as you have different
    > pages in the wizard. Each tab will display your next step in the wizard.
    > You can also skip tabs based on prior input, etc. Use tabs on top
    > horizontal.
    > 3) The tabs allow you to work very easily with your different controls and
    > wizard pages.
    > 4) Each tab page will have a Next and/or Prev buttons that you can
    > disable/enable based on input.
    > 5) When your happy with the wizard, cover up the top tabs with a pic box
    > using a graphic, etc. Most MS wizards have some kind of gif on top for
    > examples.
    >
    > This works very well actually. Please post back if you have other

    questions
    > or if I missed something. Cheers!
    > --
    > William Stacey, MVP
    >
    > "myjunkbuster" <myjunkbuster@hotmail.com> wrote in message
    > news:OI2dnZoY8rM7Am6i4p2dnA@comcast.com...
    > > Hello,
    > >
    > > I need to build a windows wizard (winform in C#) that has 4 - 5 steps
    > > depending on the values the user enters. From my research so far it

    looks
    > > like the Mediator pattern may be the best solution. However it looks

    like
    > > the main form would have to create the controller and all the step

    forms.
    > > This would mean the initial start up would be slow (and costly if they

    > exit
    > > before reaching the final step), the workflow is hardcoded so changing

    the
    > > flow or adding a new step would mean recoding the controller. Granted in
    > > this case it wouldn't necessarily be the end of the world if that

    happened
    > > but is there a better pattern for implementing a Wizard?
    > >
    > > thanks,
    > > Scott
    > >
    > >

    >
    >






  4. #4
    EdUarDo Guest

    Re: Is the Mediator the best pattern for a Wizard?

    I think you need to use State pattern to make a wizard.




    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...