I read many forums and links like:
How do I restart my C# WinForm Application?
but all this are for windows not for mobile. How can i restart my mobile application when i catch unhandled exception. Now app is closed when i catch unhandled exception but i do not want to close it so i want to restart it.
This not working:
ProcessStartInfo s = new ProcessStartInfo();
s.FileName = Assembly.GetExecutingAssembly().GetName().CodeBase;
s.UseShellExecute = false;
Process.Start(s);
i am uisng windows mobile 6.1 and CF 3.5
WinMo has a mechanism baked in to prevent multiple instances of an app from running, so calling yourself with the Process class will simply launch an instance that the shell terminates. You have to work around that, P/Invoke CeRunAppAtTime
or create a separate watchdog process that makes sure your app process is always running, launching a new instance if it detects it is ever gone.. Be forewarned that CeRunAppAtTime
can't schedule an app for less than 11 seconds into the future, so there will be a delay.