Ejemplo n.º 1
0
        public ServiceInstaller()
        {
            ServiceNameDescription[] services = {
                new ServiceNameDescription( SystemMailMessageService.Name, SystemMailMessageService.Description ),
                new ServiceNameDescription( SystemReminderService.Name, SystemReminderService.Description ),
                new ServiceNameDescription( SystemSMTPMessageService.Name, SystemSMTPMessageService.Description ),
                new ServiceNameDescription( SystemTagWordService.Name, SystemTagWordService.Description ),
                new ServiceNameDescription( SystemSyndicationService.Name, SystemSyndicationService.Description ),
                new ServiceNameDescription( SystemThumbnailService.Name, SystemThumbnailService.Description )
            };

            foreach (ServiceNameDescription service in services)
            {
                System.ServiceProcess.ServiceInstaller serviceInstaller = new System.ServiceProcess.ServiceInstaller();
                serviceInstaller.ServiceName = service.name;
                serviceInstaller.DisplayName = service.name;
                serviceInstaller.Description = service.description;
                serviceInstaller.StartType = ServiceStartMode.Automatic;

                SnCoreServiceProcessInstaller serviceProcessInstaller = new SnCoreServiceProcessInstaller(service.name);
                serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
                serviceProcessInstaller.Username = null;
                serviceProcessInstaller.Password = null;
                serviceProcessInstaller.Installers.Add(serviceInstaller);

                Installers.Add(serviceProcessInstaller);
            }
        }