Line | |
---|
1 | using System;
|
---|
2 | using System.Collections;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.ServiceProcess;
|
---|
5 |
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveWindowsService {
|
---|
8 | [RunInstaller(true)]
|
---|
9 | public partial class ProjectInstaller : System.Configuration.Install.Installer {
|
---|
10 | public ProjectInstaller() {
|
---|
11 | InitializeComponent();
|
---|
12 | }
|
---|
13 |
|
---|
14 | protected override void OnAfterInstall(IDictionary savedState) {
|
---|
15 | base.OnAfterInstall(savedState);
|
---|
16 |
|
---|
17 | //try to start the service after installation
|
---|
18 | using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) {
|
---|
19 | try {
|
---|
20 | serviceController.Start();
|
---|
21 | }
|
---|
22 | catch { }
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.