private void PrintOutput(string msg) { if (OutputTb.InvokeRequired) { PrintOutputDelegate d = new PrintOutputDelegate(PrintOutput); Invoke(d, new object[] { msg }); } else { OutputTb.Text += string.Format("{0}\r\n", msg); } }
private void PlayersChanged() { if (outputTextBox.InvokeRequired) { ResetOutputDelegate d = ResetOutput; Invoke(d); } foreach (var player in _discoveryService.Players) { if (outputTextBox.InvokeRequired) { PrintOutputDelegate d = PrintOutput; Invoke(d, player.FriendlyName); } } }