private void SetServerStatus_Proc(ServerStatus value) { if (lbl_StatusValue.InvokeRequired) { SetServerStatusCallback cb = new SetServerStatusCallback(SetServerStatus_Proc); BeginInvoke(cb, new object[] { value }); } else { status = value; lbl_StatusValue.Text = status.ToString(); notifyIcon.Text = "JIRA Webhook Server: " + status.ToString(); } }
private void SetServerStatus() { if (Disposing || IsDisposed) { return; } if (InvokeRequired) { try { SetServerStatusCallback d = SetServerStatus; Invoke(d); } catch (Exception ex) { _logger.Error(ex, "An exception occurred while attempting to set the server status."); } } else { switch (_server.Status) { case HTTPServer.Steward.RunStatus.Stopped: cmdStartStop.Image = Resources.Play; cmdStartStop.Enabled = true; lblStatus.Image = Resources.Dot_Grey; break; case HTTPServer.Steward.RunStatus.Running: cmdStartStop.Image = Resources.Stop; cmdStartStop.Enabled = true; lblStatus.Image = Resources.Dot_Green; break; case HTTPServer.Steward.RunStatus.Starting: case HTTPServer.Steward.RunStatus.Stopping: cmdStartStop.Enabled = false; lblStatus.Image = Resources.Dot_Purple; break; } } }