Using JScript.NET to make asp.net Web page Basics Tutorial 5
Source: Internet
Author: User
JScript.NET can inherit and extend an existing class after a class declaration by adding the extends keyword using a JScript or any NET Framework language (such as C #,vb7.0). This ability allows jscript.net to easily exploit the rich resources of the NET platform. To illustrate these, a program is given. This program extends the ServiceBase class of the NET Framework.
Import the required. NET namespaces
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 SimpleService ());
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service