public void UpdateStatus(AgentStatus status) { if (lbStatus.InvokeRequired) { var refresh = new RefreshAgentStatus(UpdateStatus); this.Invoke(refresh, new object[] { status }); } else { if (status == AgentStatus.ONLINE) { if (!string.Equals(lbStatus.Text, status.ToString())) { lbStatus.Text = status.ToString(); lbStatus.BackColor = System.Drawing.Color.LimeGreen; lbStatus.ForeColor = System.Drawing.Color.Black; } } else { if (status == AgentStatus.ERROR || status == AgentStatus.OFFLINE) { if (!string.Equals(lbStatus.Text, status.ToString())) { lbStatus.Text = status.ToString(); lbStatus.BackColor = System.Drawing.Color.Red; lbStatus.ForeColor = System.Drawing.Color.White; } } } } }
public void UpdateManagerUI(MainForm mf) { mf.lblManagerGreed.Text = "GRD: " + Greed.ToString(); mf.lblManagerIQ.Text = "INT: " + Intelligence.ToString(); mf.lblManagerNegotiate.Text = "NEG: " + Negotiating.ToString(); mf.lblManagerPower.Text = "POW: " + Power.ToString(); mf.lblManagerScouting.Text = "SCT: " + Scouting.ToString(); mf.lblManagerEfficiency.Text = "EFF: " + CurrentEfficiency.ToString(); mf.lblManagerStatus.Text = "Status: " + Status.ToString(); }
/// <summary> /// Updates the agent status. /// </summary> /// <param name="agentStatus">The agent status.</param> private void UpdateAgentStatus(AgentStatus agentStatus) { _agent.Status = agentStatus.ToString(); Task task = Task.Run(async() => { await _apiClient.AgentProcessor.Update(_agent); }, _mainCancellationToken); task.Wait(_mainCancellationToken); }
private int GetStatusIdx(AgentStatus status) { return(this.cmbStatus.FindStringExact(status.ToString())); }