프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ConverterService / FinalService_Watcher / ProjectInstaller.cs @ f816dd63

이력 | 보기 | 이력해설 | 다운로드 (1.26 KB)

1 7ca218b3 KangIngu
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.ComponentModel;
5
using System.Configuration.Install;
6
using System.Linq;
7
using System.ServiceProcess;
8
9
10
namespace FinalService_Watcher
11
{
12
    [RunInstaller(true)]
13
    public partial class ProjectInstaller : System.Configuration.Install.Installer
14
    {
15
        public ProjectInstaller()
16
        {
17
            InitializeComponent();
18
        }
19
20
        public override void Install(IDictionary stateSaver)
21
        {
22
            base.Install(stateSaver);
23
24
            ServiceController controller = new ServiceController(FinalService_WatcherInstaller.ServiceName);
25
            try
26
            {
27
                controller.Start();
28
            }
29
            catch (Exception ex)
30
            {
31
                //_log.Write(ex.ToString());
32
            }
33
        }
34
35
        protected override void OnBeforeUninstall(IDictionary savedState)
36
        {
37
            base.OnBeforeUninstall(savedState);
38
39
            ServiceController controller = new ServiceController(FinalService_WatcherInstaller.ServiceName);
40
41
            try
42
            {
43
                controller.Stop();
44
            }
45
            catch (Exception ex)
46
            {
47
                //_log.Write(ex.ToString());
48
            }
49
        }
50
    }
51
}
클립보드 이미지 추가 (최대 크기: 500 MB)