public void UpdateControls(IMyEvent message) { if (InvokeRequired) { var d = new UpdateControlsCallback(UpdateControls); Invoke(d, new object[] { message }); } else { richTextBoxReceivedMessages.DeselectAll(); richTextBoxReceivedMessages.SelectionFont = new Font("Letter Gothic", 9f, FontStyle.Bold); richTextBoxReceivedMessages.AppendText(string.Format("[{0}] ", DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff"))); richTextBoxReceivedMessages.SelectionFont = new Font(richTextBoxReceivedMessages.SelectionFont, FontStyle.Italic); richTextBoxReceivedMessages.AppendText(" from " + message.Publisher); richTextBoxReceivedMessages.SelectionFont = new Font(richTextBoxReceivedMessages.SelectionFont, FontStyle.Bold); richTextBoxReceivedMessages.AppendText("\r\n ID:\t\t"); richTextBoxReceivedMessages.SelectionFont = new Font(richTextBoxReceivedMessages.SelectionFont, FontStyle.Italic); richTextBoxReceivedMessages.AppendText(message.ID.ToString(CultureInfo.InvariantCulture)); richTextBoxReceivedMessages.SelectionFont = new Font(richTextBoxReceivedMessages.SelectionFont, FontStyle.Bold); richTextBoxReceivedMessages.AppendText("\r\n Message:\t"); richTextBoxReceivedMessages.SelectionFont = new Font(richTextBoxReceivedMessages.SelectionFont, FontStyle.Italic); richTextBoxReceivedMessages.AppendText(message.Message + "\r\n\r\n"); richTextBoxReceivedMessages.SelectionStart = richTextBoxReceivedMessages.Text.Length; richTextBoxReceivedMessages.ScrollToCaret(); } }
private void UpdateControls(bool status) { if (btnConnect.InvokeRequired) { UpdateControlsCallback d = new UpdateControlsCallback(UpdateControls); this.Invoke(d, new object[] { status }); } else { btnConnect.Enabled = !status; btnDisconnect.Enabled = status; btnRdy.Enabled = status; } }
private void UpdateControls(bool listening) { if (btnCloseGame.InvokeRequired) { UpdateControlsCallback d = new UpdateControlsCallback(UpdateControls); this.Invoke(d, new object[] { listening }); } else { btnHostGame.Enabled = !listening; btnCloseGame.Enabled = listening; btnRdy.Enabled = listening; } }