none
User control, Provider Pattern, Interfaces, etc. RRS feed

  • Question

  • I am developing a user control for an application, but this user control will probably be used in other applications.  I am interested in the best way to make the user control as generic as possible.  For example, one piece of the user control will login to a back end server.  Application1 may utilize logon procedures that are much different that those of Application2, but both application 1 and 2 use the user control, so I want to require that a Logon method is present.

     

    What is the best way to "define" the methods that should be implemented by anyone using the user control, similar to the Logon method described above?

     

    Can a UI component provide no code implementation, just an Interface?  If so, in this scenario how would an acti

    on event fired from the UI be implemented by the application which consumes the user control?  For example, the buttonLogin_Click event?

     

    Or should the UI functionality be defined solely in an abstract class that is then overridden by the implementer?  If so, then same question from before, how would the an action even (e.g., buttonLogin_Click) be processed by the implementer?

     

    Is this a case which would necessitate the Provider Pattern?

     

     

    I appreciate any and all feedback.

    Friday, November 2, 2007 8:41 PM

All replies

  • A few questions for you.

     

    1. What is the purpose of the user control?
    2. Using your example, if the user control will login to a back end server and Application 1 and Appliation 2 uses it, do you plain on hard coding the connection and server name?
    3. What are your ideas if they happen to be different back end servers?

    Yes a UI component can provide no code implemenation (if I understand what you mean by implementation) other than calling a delegate or firing an event as an example. This type of architecture gets into the MVC/MVP pattern.

     

    I would need more information in order to help.

     

    Michael

     

    Thursday, November 8, 2007 12:19 AM
  • Hi Michael.  thanks for your help!  Here are some answers to your questions:

     

    1. "What is the purpose...?"  This control acts as a front end UI providing a search interface for archived data.  Users can search for documents, emails, files, etc., based on criterial provided in the controls of this UI.
    2. "Using your example, if the user control....."  This control won't be using a connection, at least in the traditional sense.  Logon info will be passed to the back end API via Single Sign-On, and if that fails, login data would be passed to the API via https GET requests.  The back end URL to communicate with will be configured when the application is installed by the user of the software, so it will exist in a settings file somewhere or registry setting; something along those lines.
    3. "What are your ideas...?"  I think the answer to #2 answers this question.

    Thanks again for your help.  Let me know if you need more info.

    Thursday, November 8, 2007 4:46 PM