Application closes, but process stays alive

Oct 2 2007 12:52 PM
Hey,
I have the following problem. I programmed myself a backup program which runs good in Console Mode. Now I'd love to make it a bit more user friedly - I dont like those console applications so I wanted to build a TrayIcon Application. Because I am still new in C# programming I used a Example Script which actually runs very good. (Example Script)

In the Main() function I start my backup routine before I start my TrayApp with Application.Run(). That works out fine.

C#-Code:
p.backup.Backup.Start(astrArg);
Application.Run();

But by now I am not sure if this is the right point to do so. Actually I would like to run the backup script in its own thread. But I am not well informed about its functionallity, so I'd do it later (anyways - would that be a good idea?)

But actually, I have another problem.
When I start my TrayApp without the backup routine and afterwords I stop it like this....

C#-Code:
public static void ProgramExit()
    {
        notico.Dispose();
        Application.Exit();
    }

... everything is fine.

But, I dont want to close the process on my own, it is supposed to close after the backup process is done. So I have put at the end of my backup function a call to ProgramExit(). The TrayIcon in the Taskbar shuts down, the backup runs through properly but the process of the exe stays alive. When I open the Task-Manager, I can see the process which is running idle.
How could I solve this problem because I dont want the process to keep alive! I tried searching for similar issues, but there were no chance.

Hope there is somebody that can help me out.
Greetings
pabera