|
用C#编写发手机中文短信息Windows服务(2) { // This call is required by the Windows.Forms Component Designer. InitializeComponent();
// TODO: Add any initialization after the InitComponent call }
// The main entry point for the process static void Main() { System.ServiceProcess.ServiceBase[] ServicesToRun;
// More than one user Service may run within the same process. To add // another service to this process, change the following line to // create a second service object. For example, // // ServicesToRun = New System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()}; // ServicesToRun = new System.ServiceProcess.ServiceBase[] { new SmsServer() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.SmsTimer = new System.Timers.Timer(); this.eventLog1 = new System.Diagnostics.EventLog(); ((System.ComponentModel.ISupportInitialize)(this.SmsTimer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.eventLog1)).BeginInit(); // // SmsTimer // this.SmsTimer.Enabled = true; this.SmsTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.SmsTimer_Elapsed); // // SmsServer // this.ServiceName = "SmsServer"; ((System.ComponentModel.ISupportInitialize)(this.SmsTimer)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.eventLog1)).EndInit();
}
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
/// <summary> /// Set things in motion so your service can do its work.
|