One way to do this would be:
Have a boolean value that keeps track wether the parent form is "closed" or not. Then have booleans to determine wether any child forms are open or not.
Whenever a user decides to close the main window, instead of closing it, just hide the window, adjust the boolean value and cancel the closing action.
something like:
Code:
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
this.mainWindowOpen = false;
this.Hide();
e.Cancel = true;
}
Every other window also has this windowOpen boolean. If it is false its closed , else its up and running.
One minor catch, if you launch a second window, close the main window, close the second window... the main window will still be running but it is hidden.
To overcome this: on each closing of a child window, go over all the booleans, if all booleans are set to false then this means you should really close the application ( killing the main window ).