private void ResignButton_Click(object sender, RoutedEventArgs e) { if (Master) { GameHost.SetMasterAsync(User, Opponent); DiceAction.SetWaiter(); } if (Opponent == Player.autoPlayer.ToString()) { DiceAction.SetMaster(); } }
public Backgammon(string user, string opponent, bool master) { User = user; Opponent = opponent; Master = master; IndexCollSelected = -5; ChatHost = ClientInstances.Instance.Chat.ChatHost; GameHost = ClientInstances.Instance.Chat.GameHost; rand = new Random(); DiceAction = new DiceAction(this); CheckerLogic = new СheckerLogic(this); Timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(10) }; UIInitialization uIInitialization = new UIInitialization(this); //Event Registration Timer.Tick += Timer_Tick; checkBoxLeftDice.Checked += CheckBoxLeftDice_Checked; checkBoxRightDice.Checked += CheckBoxRightDice_Checked; if (Master) { DiceAction.SetMaster(); } else { DiceAction.SetWaiter(); if (Opponent == Player.autoPlayer.ToString()) { rollButton.IsEnabled = true; rollButton.Content = "Start"; rollButton.Click -= RollButton_Click; rollButton.Click += StartButton_Click; resignButton.IsEnabled = false; topResighButton.IsEnabled = false; } } Closed += Backgammon_Closed; Show(); GameHost.GetGameTable(User, Opponent); }