designing a system to disable UI?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Z2lkZHk=?=

    designing a system to disable UI?

    hi,

    I've finished all the base code to my App. Tested it and everything, now I
    need to make a UI.

    Its not going to be overly complex but it could get complex later on, so I
    want to design it well.

    I want a proper way to enable/disable UI but later being able to change
    maybe the real control, so far i've come up with.

    interface IMainForm
    {
    IUIController GetUIController (string name);
    }
    interface IUIController
    {
    bool Enabled
    { get;set;}
    }
    The default implementation would be:
    class DefUIController : IUIController
    {
    DefUIController (Control cntrl);
    {
    }//return the Controls enabled state.
    }

    And then in the main form I could search for the control and create a new
    UIController and return it!?

    Is this design good enough or is there a method out there, I don't need
    something complex like CAB or something, its not such a big app.

    Thanks so much.

    Gideon
  • rajesh

    #2
    Re: designing a system to disable UI?

    Looks like a too complex way just to Enable\Disable UI. How are you
    planning to return the controls enabled state in DefUIController
    constructor?

    Comment

    • =?Utf-8?B?Z2lkZHk=?=

      #3
      Re: designing a system to disable UI?

      Looks like a too complex way just to Enable\Disable UI. How are you
      planning to return the controls enabled state in DefUIController
      constructor?
      Its the only way I can think of to separate the disabling/enabling and being
      able to change the control later on.
      This is how I plan to implement in the *main form*:
      IUIController GetUIController (string name)
      {
      foreach(Control crt in this.Controls)
      {
      if(crt.Name== name)
      {
      return DefUIController (crt);
      }
      return null;
      }
      }

      My only concern here is that its a little stupid looping through every
      control,
      there aren't going to be SO many though.

      Thanks so much.

      Comment

      • Family Tree Mike

        #4
        Re: designing a system to disable UI?

        What does a windows forms app with a disabled UI mean to you? I think you
        may be describing running your application in a "no GUI" mode, but I'm not
        sure. Doing that is much simpler than what you are describing. You simply
        trap the command arguments and don't make the main form visible in such
        case.

        "giddy" <giddy@discussi ons.microsoft.c omwrote in message
        news:1D32D685-5A51-4E7C-AAEB-4FEA0797006E@mi crosoft.com...
        hi,
        >
        I've finished all the base code to my App. Tested it and everything, now I
        need to make a UI.
        >
        Its not going to be overly complex but it could get complex later on, so I
        want to design it well.
        >
        I want a proper way to enable/disable UI but later being able to change
        maybe the real control, so far i've come up with.
        >
        interface IMainForm
        {
        IUIController GetUIController (string name);
        }
        interface IUIController
        {
        bool Enabled
        { get;set;}
        }
        The default implementation would be:
        class DefUIController : IUIController
        {
        DefUIController (Control cntrl);
        {
        }//return the Controls enabled state.
        }
        >
        And then in the main form I could search for the control and create a new
        UIController and return it!?
        >
        Is this design good enough or is there a method out there, I don't need
        something complex like CAB or something, its not such a big app.
        >
        Thanks so much.
        >
        Gideon

        Comment

        • =?Utf-8?B?Z2lkZHk=?=

          #5
          Re: designing a system to disable UI?

          "Family Tree Mike" wrote:
          What does a windows forms app with a disabled UI mean to you? I think you
          may be describing running your application in a "no GUI" mode, but I'm not
          sure. Doing that is much simpler than what you are describing. You simply
          trap the command arguments and don't make the main form visible in such
          case.
          I'm sorry for the crappy title, I meant Enable/Disable UI Controls based on
          stuff like users, situations etc.

          Like, if the selected Customer in the CustomerGridVie w UserControl doesn't
          have a bill yet, _within_ the usercontrol i could do this:
          IUIController ui = _mainform.GetUI Controller("mnu PrintBill");//Menu
          ui.Enabled = false;

          How this kind of thing done in other apps, I need to enable or disable UI
          from many sub UserControls etc, now Each of them will have a Property
          IMainForm that allows them to interact with the MainForm, so they call easily
          call the right method and control the right UI Control.

          Thanks so much

          Comment

          Working...