public ResetPopup(Player[] player, Frame Mainpage, UICommandInvokedHandler resetMenu) { this._mainPage = Mainpage; this._player = player; string[] list = new string[_player.Length + 2]; for (int i = 0; i < _player.Length; i++) { list[i] = _player[i].Name + " Wins"; } list[_player.Length] = "Draw"; list[_player.Length + 1] = "Reset Score"; _pM = Class.CreateXAMLObj.CreatePopup(list); for (int i = 0; i < _player.Length+2; i++) { _pM.Commands[i].Invoked = resetMenu; } }
public PlayerArea(Player player, Grid grid, Style gridStyle ,ResourceDictionary Resources) { string dealer = ""; RoutedEventHandler rehOneMore = new RoutedEventHandler(Life_One_More_Click); RoutedEventHandler rehFiveMore = new RoutedEventHandler(Life_Five_More_Click); RoutedEventHandler rehOneLess = new RoutedEventHandler(Life_One_Less_Click); this._player = player; this._grid = grid; if (_player.Dealer == true) dealer = "D"; _areaGrid = CreateXAMLObj.CreateGrid(gridStyle, _grid); _playerTextBlock = CreateXAMLObj.CreateTextBlock(_player.Name, Resources["TextBlockPlayerNameStyle"] as Style, _areaGrid); _winTextBlock = CreateXAMLObj.CreateTextBlock(_player.Wins.ToString() + " W", Resources["TextBlockWinStyle"] as Style, _areaGrid); _dealerTextBlock = CreateXAMLObj.CreateTextBlock(dealer, Resources["TextBlockDealerStyle"] as Style, _areaGrid); _lifeButton = CreateXAMLObj.CreateButton("Life", Resources["ButtonLifeStyle"] as Style, _player.Life.ToString(), rehOneLess, _areaGrid); _addOneLifeButton = CreateXAMLObj.CreateButton("Add_One_Life", Resources["ButtonAddOneLifeStyle"] as Style, "+1", rehOneMore, _areaGrid); _addFiveLifeButton = CreateXAMLObj.CreateButton("Add_Five_Life", Resources["ButtonAddFiveLifeStyle"] as Style, "+5", rehFiveMore, _areaGrid); }
private void StartGameButton_Click_1(object sender, RoutedEventArgs e) { Class.Player[] player = new Class.Player[noPlayers]; for (int i = 0; i < noPlayers; i++) { if (textBoxPlayer[i].Text == "") player[i] = new Class.Player("Player" + (i + 1)); else player[i] = new Class.Player(textBoxPlayer[i].Text); } player[int.Parse(Class.Dice.Rnd(noPlayers))].Dealer = true; this.Frame.Navigate(typeof(MagicPage),player); }