views:

202

answers:

4

Hi

How to reset my program (close.. and Open again)

in C# windows-mobile ?

A: 

The only way it can be done is making an exit in program after placing a request in some task-scheduler to start it again

Umair Ahmed
Can I get sample code for this ?
Gold
A: 

You need to have scheduler for that. Then Perform cocreateinstence, then set the parameters, then save the task.. application triggers when the scheduler runs..

Shadow
A: 

P/Invoke CeRunAppAtTime with yourself as the target and 11 seconds in the future as a time, then exit the app.

ctacke
Interesting downvote. How else would you propose to do this?
ctacke
+1  A: 

Create a WinMo cmdline project in your solution and use Process.Start(appPath + @"\yourprogram.exe", String.Empty); (you can use Thread.sleep too before the Process.Start) in your main program use Application.Exit and after that use a Process.Start to the loader application. Maybe pass bye a parameter too then from the loader application cannot start your app only if you do it from your code and pass that "key" to the other app.

I hope it helps

Alex