コード例 #1
0
        protected override void OnStop()
        {
            DB_Jagwar.DisconnectDatabase();
            DB_JagwarPlus.DisconnectDatabase();
            timer.Stop();
            EventLogWriter("JUUL MTE Database setup service stops.", EventCategory.ServiceStop);
            // Update the service state to Stop Pending.
            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            // Update the service state to Stopped.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
            Log("The service is stopped.");
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: xinhua424/TestLogBackup
 private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     DB_Jagwar.DisconnectDatabase();
     DB_JagwarPlus.DisconnectDatabase();
 }