Timeout login RRS feed

  • Question

  • Hi,
    I'm making a windows form with login.
    I could make sure that the main form stays open.
    what I want is that if the program is not used for 20 minutes that they have to login again.

    Has anyone any idea how to do this.

    Tuesday, May 22, 2007 10:46 AM


All replies

  • Tuesday, May 22, 2007 12:41 PM
  • Hi, thanks for you answer.

    How would I adapt this code to have it in a separate class and call it form the main form.

    because I have many different main forms and depending on the user and the tools needed, different main forms will be opened.


    Friday, May 25, 2007 1:57 PM
  • It is a bit tricker if you don't have a designated main form.  Instead, you could let the Login form implement the message filter.  Instead of closing it after a successful login, just hide it.  The only problem you'll have is stopping your application.  You'll either have to close the Login form or call Application.Exit().
    Friday, May 25, 2007 2:08 PM
  • I will re-explain it, I think I didn't explain properly.

    I will have a start for that will let the user pick a tool
    when the user select the tool the mainform for that tool will start.
    that main form will stay open the whole time.

    the login will happen on that mainform.

    the only reason I want to build it in a class is because I have many tools, and want to be able to just include it in the code, without having the whole piece of code in each mainform.


    Friday, May 25, 2007 2:24 PM
  • There should be only one instance of a class that implements IMessageFilter.  It will see the messages of all the forms.  You should not implement IMessageFilter in every form.  Your "mainform" is of course the ideal candidate.
    Friday, May 25, 2007 2:35 PM
  • Thanks I got it working.
    I have now another problem
    I load the login form with showdialog.
    this login for is the same as when they login at start.
    I want to put a logic inside that if if the mainform is not open, it will open it, otherwise just close this login form

    Tuesday, May 29, 2007 7:00 AM