private void newGameViaDispatchThread(CallbackInfo info) { if ((info.isNewGame) && (lstPlayers.Items.Count > 0)) { let1.Content = info.letters[0]; let2.Content = info.letters[1]; let3.Content = info.letters[2]; let4.Content = info.letters[3]; let5.Content = info.letters[4]; let6.Content = info.letters[5]; charList = info.letters; txtTotWords.Text = info.numWords.ToString(); _countdownTimer.Start(); wordList = info.words; } txtInfo.AppendText(info.details + '\n'); lstPlayers.Items.Clear(); foreach (Player player in words.PStats) { lstPlayers.Items.Add(player.Nickname + " - " + player.Score); } }
public void UpdateGui(CallbackInfo info) { // Only the main (dispatch) thread can change the GUI txtTotWords.Dispatcher.BeginInvoke(new ClientUpdateDelegate(newGameViaDispatchThread), info); }
private void newEvent(CallbackInfo info) { txtInfo.AppendText(info.details + '\n'); }
/* * Call this to update ALL clients */ private void updateAllClients(bool refresh) { CallbackInfo info = new CallbackInfo(numwords_, letters, refresh, details, isNewGame, pStats_, words_, secondsLeft_); foreach (ICallback callback in clientCallbacks.Values) callback.UpdateGui(info); }