使用JScript.NET创建asp.net页面(五)
点击次数:22 次 发布日期:2008-11-26 17:38:55 作者:源代码网
|
// 导入需要的.net命名空间 import System; import System.ServiceProcess; import System.Diagnostics; import System.Timers; class SimpleService extends ServiceBase { private var timer : Timer; function SimpleService() { CanPauseAndContinue = true; ServiceName = "JScript Service"; timer = new Timer(); timer.Interval = 1000; timer.AddOnTimer(OnTimer); } protected override function OnStart(args : String[]) { EventLog.WriteEntry("JScript Service started"); timer.Enabled = true; } protected override function OnStop() { EventLog.WriteEntry("JScript Service stopped"); timer.Enabled = false; } protected override function OnPause() { EventLog.WriteEntry("JScript Service paused"); timer.Enabled = false; } protected override function OnContinue() { EventLog.WriteEntry("JScript Service continued"); timer.Enabled = true; } function OnTimer(source : Object, e : EventArgs) { EventLog.WriteEntry("Hello World from JScript!"); } } ServiceBase.Run(new SimpleServic 源代码网供稿. |
