コード例 #1
0
        /// <summary>
        /// This method updates the winning data for each client 
        /// through the server. 
        /// </summary>
        /// <param name="info"></param>
        public void UpdateWinnings(CallbackInfo info) {
            if (this.Dispatcher.Thread == System.Threading.Thread.CurrentThread) {
                try {
                    foreach (Gambler g in info.PlayerList) {
                        if (g.PlayerID == myCallbackKey) {

                            Window1 winningWindow = new Window1(dealer.WinningData.Number, dealer.WinningData.Color, g.Winnings);
                            winningWindow.Show();

                            if (g.Money <= 0) {
                                MessageBox.Show("You suck!", "YOU SUCK!!!", MessageBoxButton.OK);
                                dealer.PlayerLeave(myCallbackKey);
                                this.Close();
                            }
                            else {
                                lblMoney.Content = g.Money;
                                runningPayout += g.Winnings;
                                lblPayout.Content = runningPayout;
                            }
                            break;
                        }
                    }
                    resetBoxes();
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
            else
                // Send the method call to the GUI's main thread
                this.Dispatcher.BeginInvoke(new ClientUpdateDelegate(
                    UpdateWinnings), new object[] { info });
        }
コード例 #2
0
ファイル: Dealer.cs プロジェクト: Ceberon/furry-adventure
        /// <summary>
        /// This funtion updates the winning information for all 
        /// players in the dealers player list. 
        /// </summary>
        private void updateAllClients() {
            CallbackInfo info = new CallbackInfo(WinningData, PlayerList);

            foreach (ICallback cb in clientCallbacks.Values)
                cb.UpdateWinnings(info);
        }