469,647 Members | 1,815 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Restarting an application ...

Could anybody help me to write proper
code to restart my application?

public static void OnRestartRequest()
{
...
}

Restart is needed after exception handled and
may occur anytime in application life time ...
Nov 16 '05 #1
2 3663
Jacek,

In this case, you would probably need another application monitoring the
original application. Of course, you run into the problem of what happens
if the application monitoring the application that originally was running
breaks down.

All in all, you should probably not do this, and let the user restart
the app, logging all information necessary to track down the issue at a
later date.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jacek Jurkowski" <jj********@datacomp.szczecin.pl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Could anybody help me to write proper
code to restart my application?

public static void OnRestartRequest()
{
...
}

Restart is needed after exception handled and
may occur anytime in application life time ...

Nov 16 '05 #2


Alternatively you could write an application that starts up and only runs
the original application...

So you call in your orginal app:

// in the Main Form
public static void OnRestartRequest()
{
Process.Start ( "Restarter.exe" );
Close(); // or Application.Exit() ??
}
Then have the Restarter app simply call your original app, wait a few secs
maybe, before it closes...

public static void Main()
{
System.Threading.Thread.Sleep ( 3000 ); // time for old app to shut
down
Process.Start ("FirstApp.exe" );
}
Not very neat though... You should probably look at the reasons your wanting
to restart the application in the first place.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ur**************@tk2msftngp13.phx.gbl...
Jacek,

In this case, you would probably need another application monitoring
the original application. Of course, you run into the problem of what
happens if the application monitoring the application that originally was
running breaks down.

All in all, you should probably not do this, and let the user restart
the app, logging all information necessary to track down the issue at a
later date.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jacek Jurkowski" <jj********@datacomp.szczecin.pl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Could anybody help me to write proper
code to restart my application?

public static void OnRestartRequest()
{
...
}

Restart is needed after exception handled and
may occur anytime in application life time ...


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jerry Boone | last post: by
1 post views Thread by Scott Lezberg | last post: by
7 posts views Thread by GTi | last post: by
9 posts views Thread by woolley.dean | last post: by
9 posts views Thread by walterbyrd | last post: by
7 posts views Thread by John | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.