Last change
on this file since 8169 was
7215,
checked in by spimming, 13 years ago
|
#1680:
- merged changes from trunk into branch
' removed pre-build event for multiple app.configs
|
File size:
1.4 KB
|
Rev | Line | |
---|
[6983] | 1 | using System;
|
---|
| 2 | using System.Collections;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.ServiceProcess;
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Clients.Hive.SlaveCore.WindowsService {
|
---|
| 8 | [RunInstaller(true)]
|
---|
| 9 | public partial class ProjectInstaller : System.Configuration.Install.Installer {
|
---|
| 10 | public ProjectInstaller() {
|
---|
| 11 | InitializeComponent();
|
---|
| 12 | }
|
---|
| 13 |
|
---|
[7215] | 14 | protected override void OnBeforeUninstall(IDictionary savedState) {
|
---|
| 15 | base.OnBeforeUninstall(savedState);
|
---|
| 16 |
|
---|
| 17 | //try to shutdown the service before uninstalling it
|
---|
| 18 | using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) {
|
---|
| 19 | try {
|
---|
| 20 | serviceController.Stop();
|
---|
| 21 | }
|
---|
| 22 | catch { }
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[6983] | 26 | protected override void OnAfterInstall(IDictionary savedState) {
|
---|
| 27 | base.OnAfterInstall(savedState);
|
---|
| 28 |
|
---|
| 29 | //try to create an event log
|
---|
| 30 | try {
|
---|
| 31 | if (!System.Diagnostics.EventLog.SourceExists("HLHive")) {
|
---|
| 32 | System.Diagnostics.EventLog.CreateEventSource("HLHive", "HiveSlave");
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 | catch { }
|
---|
| 36 |
|
---|
| 37 | //try to start the service after installation
|
---|
| 38 | using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) {
|
---|
| 39 | try {
|
---|
| 40 | serviceController.Start();
|
---|
| 41 | }
|
---|
| 42 | catch { }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.