|
using System;
using HoytSoft.ServiceProcess.Attributes;
namespace HoytSoft.Example {
///<summary>A service for testing out the base service class.</summary>
[Service(
"HoytSoft_ExampleService",
DisplayName = "HoytSoft Example Service",
Description = "Isn't this just absolutely amazing?",
ServiceType = ServiceType.Default,
ServiceAccessType = ServiceAccessType.AllAccess,
ServiceStartType = ServiceStartType.AutoStart,
ServiceErrorControl = ServiceErrorControl.Normal,
ServiceControls = ServiceControls.Default
)]
public class ExampleService : HoytSoft.ServiceProcess.ServiceBase {
public static new void Main(string[] Args) {
HoytSoft.ServiceProcess.ServiceBase.RunService(Args, typeof(ExampleService));
}
protected override bool Initialize(string[] Arguments) {
this.Log("Example service initialized correctly, starting up...");
return true;
}
protected override void Start() {
this.Log("Service started");
}
protected override void Stop() {
this.Log("Service stopped");
}
protected override void Pause() {
this.Log("Service paused");
}
protected override void Continue() {
this.Log("Service continued");
}
protected override void Interrogate() {
this.Log("Service interrogated");
}
protected override void Shutdown() {
this.Log("Service shutdown");
}
protected override bool Install() {
this.Log("Service installed");
return true;
}
protected override bool Uninstall() {
this.Log("Service uninstalled");
return true;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm a recent graduate of Brigham Young University in Provo, UT and now working for Lawrence Livermore National Laboratories (LLNL). I've been programming since I was 14 and did the amazing Hoyt family website with an animated gif of a spinning globe. I've come a long way since then and now actually use pictures of people.
I've been interested in website development and Windows programming since and I haven't stopped except for two years spent in El Salvador as a religious representative for my church.
I've done lots of work with C#/C/C++/Java/Python/JavaScript/Scheme/T-SQL/PL-SQL/Visual Basic/etc., web services, windows apps, services, and web apps. It's been a lot of fun!