- 1、本文档共2页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
5of6_ProjectWindowsServiceswithoutInteractionbetweenUserandServer
六之五: Project4 Windows Services without Interaction between User and Server ZHAN, Shuhao 无人机互动视窗程序构件的设计指要 (典型程序示例4) --在监视器的屏幕上适时刷新大区域内购货订单的变化 《摘要》在包装发货车间工作的工人,需要在监视器的屏幕上,及时地看到购货订单的变化。面临的开发任务是,使监视器屏幕上显示的购货订单,每30秒刷新一次。本文目的是用这个例子指明,开发应用程序.NET Windows Services的要点和步骤。
SUMMARY Workers in Shipping Handling need to see order update on monitors in a timely fashion. This project enables a real-time every 30 seconds refresh of orders on monitors for those workers in SH. Compared to using C++ in MFC, programming Windows Service in .NET environment is significantly easier. This document illustrates a generic application solution model based on Windows Services.
KEY WORDS Windows Services, SCM Windows Service Control Manager , IIS Internet Information Services
$1 Model and Algorithm of Solution Architecture (总体解决方案的模型和算法)
The existing Windows Service named TCService requires an order table in Microsoft SQL server.
We want to see all new orders on top of the order table every 30 seconds.
$2 Two Major Coding Steps (编程的二大步骤)
Step 1
We create the method ProcessOrder in TCService below,
Private Sub ProcessOrders ByVal source As Object, Byval _eventArguments As Timers.Elapsed EvantArgs
- - - - - - Code to process orders goes here - - - - - -
End Sub
Step 2
To invoke ProcessOrders method every 30 seconds, we need additional code for overriding OnStart in TCService. //Override OnStart to enable the timer
Dim TCTimer As New Timers.Timer AddHandler TCTimer.Elapsed, AddressOf ProcessOrders
//AddHandler allows program to call the ProcessOrder after 30 seconds.
TCTime.Interval 3000
TCTimer.Enabled True
//After configuration of the timer, we must start it by raising the enabled event.
$3 Technical Notes (技术性提示)
What are Windows Services?
Windows services are long-running program process and run in the windows background usually without user interaction. And a Windows service must conform to the interface provided by the Windows Service Control Manager SCM
文档评论(0)