c# can't reboot when application is running.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kate77
    New Member
    • Oct 2007
    • 14

    c# can't reboot when application is running.

    Hello,
    I have a strange problem,
    I have application running in the tray bar,
    for some reason I cant reboot the computer when it is running and i have to close
    it if i want the computer to do a reboot or shutdown.

    the application is not doing anything special,
    all it does is checking a web site every hour using timer.

    anyone saw this problem or know how to get over it so users can shutdown the computer even when the application is running ?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I have seen the same problem with a program that is running that keeps the computer from rebooting/shuttingdown. (It wasn't my program, just noticed my laptop would stay running when that software was running)

    Not sure what you can do except put an event handler on like a form_closing() event, and have it tell the timer object to Stop/Dispose itself?

    Comment

    • Kate77
      New Member
      • Oct 2007
      • 14

      #3
      im currently using form_closing to minimize the application.

      so that is what causing the computer to hang when it needs to reboot.

      ill try to continue searching for an answer.

      Thanks.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by Kate77
        im currently using form_closing to minimize the application.

        so that is what causing the computer to hang when it needs to reboot.

        ill try to continue searching for an answer.

        Thanks.
        The form_closing event has some data passed to it. One of which tells you what is trying to close it. there is an enum for it. It's like "user_close " "system_rebooti ng" "process_killed " or something like that.
        You should probably switch on that so that when you get the shuttingdown/rebooting one you can close your program.

        Comment

        Working...