srvinsaller.cs

来自「c#精彩编程百例(源代码)」· CS 代码 · 共 46 行

CS
46
字号
// 程序srvInsaller.cs
namespace srvDownload
{
    using System;
    using System.Collections;
    using System.Core;
    using System.ComponentModel;
    using System.Configuration.Install;
     using System.ServiceProcess;
    /// <summary>
    ///     Summary description for srvInstaller.
    /// </summary>
    [RunInstaller(true)]
    public class srvInstaller:System.Configuration.Install.Installer
    {
        /// <summary>
        ///    Required designer variable.
        /// </summary>
        private System.ServiceProcess.ServiceProcessInstaller srvProcessInstall;
	private System.ServiceProcess.ServiceInstaller srvInstall;
        public srvInstaller()
        {
            // This call is required by the Designer.
            InitializeComponent();
   	    srvInstall=new System.ServiceProcess.ServiceInstaller();
	    srvProcessInstall=new System.ServiceProcess.ServiceProcessInstaller();
	    // TODO: Add any initialization after the InitComponent call
	    //create service installer
	    srvInstall.StartType=System.ServiceProcess.ServiceStart.Automatic;
	    srvInstall.ServiceName=  "srvDownload";
	    srvInstall.DisplayName="DownloadUtility";
	    Installers.Add(srvInstall);
	    //create process installer
	    srvProcessInstall.RunUnderSystemAccount=true;
	   Installers.Add(srvProcessInstall);
         }
         /// <summary>
         /// Required method for Designer support - do not modify
        ///  the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?