Windows Mobile 6 Standard上的后台服务 [英] background service on windows mobile 6 standard

查看:105
本文介绍了Windows Mobile 6 Standard上的后台服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个无需表格即可在后台运行的应用程序.

我正在开发MOBILE TRACKER应用程序,它将随着时间间隔将GPS信息发送到我们的服务器.
该应用程序将在Windows启动时运行,并且只能在Windows Mobile Task Manager中停止.

我可以构建一个在窗体上运行的应用程序,但是当我关闭此窗体时,该应用程序将停止,并且在最小化此应用程序时,我的设备将挂起.

有人可以帮我吗?
如何构建此应用程序,或向我发送参考或线索以解决此问题.


谢谢B4.
对不起,不好的解释,这是我在该论坛上的第一篇帖子:)

I want to build an application that will run in the background without form.

I am developing MOBILE TRACKER application which will send GPS information with time interval to our server.
The application will run when the windows starts and only can stop with windows mobile task manager.

I can build an application which run on the form but when I closed this form the application will stop and when I minimize this application my device will hang.

Can anybody help me?
How do I build this application, or send me reference or clue to resolved this problem.


thanks B4.
sorry for bad explaination, it''s my first post in this forum :)

推荐答案

使用窗口服务并尝试添加此代码

在这里,侦听器是我使用过的套接字的对象,并且
tsocket是
System.Threading.Thread tSocket =新线程(新ThreadStart(StartListening));

......所以您可以根据您的代码使用此启动和停止服务.

受保护的重写void OnStart(string [] args)
{

试试
{
//线程的开始.
tSocket.Priority = ThreadPriority.Highest;
tSocket.Name = Constants.Message.socketName;
tSocket.Start();
}
捕获(ObjectDisposedException ode)
{


}
catch(ex ex例外)
{

}

}
use window service and try adding this code

Here Listener is object of socket i have used and
tsocket is
System.Threading.Thread tSocket = new Thread(new ThreadStart(StartListening));

......so u can use this start and stop service according to your code.

protected override void OnStart(string[] args)
{

try
{
//Start of thread.
tSocket.Priority = ThreadPriority.Highest;
tSocket.Name = Constants.Message.socketName;
tSocket.Start();
}
catch (ObjectDisposedException ode)
{


}
catch (Exception ex)
{

}

}


这篇关于Windows Mobile 6 Standard上的后台服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆