开发者

Can an app written with .net Compact Framework restart itself?

开发者 https://www.devze.com 2023-03-08 15:39 出处:网络
Can an app written with .net Co开发者_开发知识库mpact Framework restart itself? What are some of the common patterns to achieve this? I would like to have a self-updating application that restarts it

Can an app written with .net Co开发者_开发知识库mpact Framework restart itself?

What are some of the common patterns to achieve this? I would like to have a self-updating application that restarts itself if update was done.

Of course, I could have 2 .exe: one that updates and the actual app, but I would rather just have one.


Absolutely. It's actually way easier to do than on the desktop. If you're using the SDF, use this:

var thisName = Assembly.GetExecutingAssembly().GetName().CodeBase;
var time = DateTime.Now.AddSeconds(11);
Notify.RunAppAtTime(thisName, time);

If you want to do it manually, you'd p/invoke CeRunAppAtTime.

Note that you must have a launch time of > 10 (not >= 10) seconds in the future or the "launch will happen immediately (an artifact of how the default notification setup is set in the kernel).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号