Exemple #1
0
        protected override void OnStart(string[] args) //服务承载的主体,开机自动运行的部分
        {
            Detect_info infoNet   = new Detect_info(); //初始化Start.cs的类,获得账户密码的字段
            Net_work    Net_Drive = new Net_work();    //初始话NET.cs的方法

            Net_Drive.Network(infoNet.User1, infoNet.Password1);
        }
Exemple #2
0
        static void Main()
        {
            Detect_info test_ins = new Detect_info();//使用之前导入的参数判断是以windows服务启动还是启动安装程序;*/*/在Start.cs内的类

            if (test_ins.Detect() == "installed")
            {//这一段是判断是否输入过用户密码,有则会成为服务的形式运行,否则执行else,将会变为控制台程序获取输入*/
                ServiceBase[] ServicesToRun = new ServiceBase[]
                {
                    new Service1()
                };
                ServiceBase.Run(ServicesToRun);
            }//到这里为服务本体,在OnStart方法启动---------------------------------------------------------------*/
            else
            {
                Ride_info test_ins2 = new Ride_info();//Start.cs内的类
            }
        }