markus / ConvertService / ConverterService / ConverterStation / ConverterStation.cs @ 8e5a4a6a
이력 | 보기 | 이력해설 | 다운로드 (1.51 KB)
1 | 7ca218b3 | KangIngu | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.ComponentModel; |
||
4 | using System.Data; |
||
5 | using System.Diagnostics; |
||
6 | using System.Linq; |
||
7 | using System.ServiceProcess; |
||
8 | using System.Text; |
||
9 | using System.Threading; |
||
10 | |||
11 | namespace ConverterStation |
||
12 | { |
||
13 | public partial class ConverterStation : ServiceBase |
||
14 | { |
||
15 | Service.ConverterService _remotingConverter = null; |
||
16 | ServiceEventLog _log = null; |
||
17 | System.Timers.Timer _Timer = new System.Timers.Timer(); |
||
18 | |||
19 | public ConverterStation() |
||
20 | { |
||
21 | InitializeComponent(); |
||
22 | _Timer.Interval = 60000; |
||
23 | _Timer.Elapsed += new System.Timers.ElapsedEventHandler(_Timer_Elapsed); |
||
24 | _Timer.Enabled = true; |
||
25 | _log = new ServiceEventLog(this.EventLog, this.ServiceName, "Application"); |
||
26 | } |
||
27 | |||
28 | void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) |
||
29 | { |
||
30 | //_log.Write("현재 시간 :" + DateTime.Now.ToString()); |
||
31 | } |
||
32 | |||
33 | protected override void OnStart(string[] args) |
||
34 | { |
||
35 | base.OnStart(args); |
||
36 | _log.Write("Start Service"); |
||
37 | _remotingConverter = new Service.ConverterService(_log); |
||
38 | } |
||
39 | |||
40 | protected override void OnStop() |
||
41 | { |
||
42 | _remotingConverter.Dispose(); |
||
43 | _log.Write("Shutdown Service"); |
||
44 | base.OnShutdown(); |
||
45 | } |
||
46 | |||
47 | public void onStart() |
||
48 | { |
||
49 | _log.Write("Start Service"); |
||
50 | _remotingConverter = new Service.ConverterService(_log); |
||
51 | } |
||
52 | } |
||
53 | } |