private void stopToolStripMenuItem1_Click(object sender, EventArgs e) { SvcController svcC = new SvcController(); int intSvcRunning = svcC.isSvcRunning(); if (intSvcRunning == 0) { AdminLogger.WriteEvent("Trying to stop service.", ZifliForm._DEBUG); try { int intSvcStop = svcC.stopSvc(); } catch { AdminLogger.WriteEvent("Exception occurred stopping service.", ZifliForm._ERR); } } else { AdminLogger.WriteEvent("Service was already stopped.", ZifliForm._ERR); } this.updateLabelsMenus(); }
private void startToolStripMenuItem1_Click(object sender, EventArgs e) { SvcController svcC = new SvcController(); int intSvcRunning = svcC.isSvcRunning(); int intSvcStart; if (intSvcRunning == 1) { AdminLogger.WriteEvent("Trying to start service.", ZifliForm._DEBUG); try { intSvcStart = svcC.startSvc(); } catch { AdminLogger.WriteEvent("Exception occurred starting service.", ZifliForm._ERR); intSvcStart = 2; } } else { AdminLogger.WriteEvent("Service was already running.", ZifliForm._WARN); intSvcStart = 0; } AdminLogger.WriteEvent("intSvcStart: " + intSvcStart.ToString(), ZifliForm._DEBUG); this.updateLabelsMenus(); }
public void updateLabelsMenus() { SvcController svcC = new SvcController(); int intSvcRunning; try { intSvcRunning = svcC.isSvcRunning(); } catch { AdminLogger.WriteEvent("Exception when trying to get service status.", ZifliForm._ERR); intSvcRunning = 2; this.cmsStrip1_disable_start(); this.cmsStrip1_disable_stop(); } AdminLogger.WriteEvent("updateLabelsMenus, intSvcRunning: " + intSvcRunning.ToString(), ZifliForm._DEBUG); if (intSvcRunning == 0) { this.labelStatus.Text = "Service Status: RUNNING"; this.cmsStrip1_disable_start(); this.cmsStrip1_enable_stop(); } else if (intSvcRunning == 1) { this.labelStatus.Text = "Service Status: STOPPED"; this.cmsStrip1_enable_start(); this.cmsStrip1_disable_stop(); } else { this.labelStatus.Text = "Service Status: UNKNOWN"; this.cmsStrip1_disable_start(); this.cmsStrip1_disable_stop(); } }