Timer Disable SubItems of Menustrip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mylixes
    New Member
    • May 2010
    • 29

    #1

    Timer Disable SubItems of Menustrip

    In my Windows Application, I have one timer and Menu strip.
    There are 6 Items in the Menu strip and each of them has Sub items. Now, how could I be able to detect if the user doesn't do any action after 5 minutes?

    Let's say after the user logged in, He/she doesn't do any action or doesn't open any sub items in the menu strip after 5 minutes. How would I know?

    If the user doesn't do any action after 5 minutes, some menu in the menu strip will be disabled.
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    You need to more appropriately define activity in your scenario. Does activity mean mouse/keyboard, or just clicking any of the buttons?

    If the latter, you can always have those actions do.... something (ie set a flag) that counts as activity done.

    One example might be to have a timer with it's interval set to 5 minutes. Anytime an action is performed, stop, then start the timer. This will reset it to zero. Have the timer's tick method stop itself, then disable the menus.

    Another option might be to have a timer ticking every second which decrements a counter. If that counter reaches zero, disable the menus. Anytime an action is performed, set that counter to 5 minutes worth of seconds.

    etc...

    Comment

    • mylixes
      New Member
      • May 2010
      • 29

      #3
      Originally posted by GaryTexmo
      You need to more appropriately define activity in your scenario. Does activity mean mouse/keyboard, or just clicking any of the buttons?

      If the latter, you can always have those actions do.... something (ie set a flag) that counts as activity done.

      One example might be to have a timer with it's interval set to 5 minutes. Anytime an action is performed, stop, then start the timer. This will reset it to zero. Have the timer's tick method stop itself, then disable the menus.

      Another option might be to have a timer ticking every second which decrements a counter. If that counter reaches zero, disable the menus. Anytime an action is performed, set that counter to 5 minutes worth of seconds.

      etc...
      yeah right..

      What I did was reset the timer every time the user click the drop down item of the menu strip and every time the user closes the form. If the user doesn't do any action in 5 minutes the menu will disable.

      Thanks for the reply though.

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        *blink*

        Ok... well, glad you got it sorted out.

        Comment

        Working...