private void Add_Click(object sender, RoutedEventArgs e) { _localPawnList = Settings.PawnList; if (_players.Count <= 4) { StartButton.IsDefault = false; AddPlayer.IsDefault = true; PlayerName.Focus(); if (_players.ToList().Find(x => x.Name == PlayerName.Text) == null) { if (PlayerName.Text == "") { return; } _players.Add(new Player(PlayerName.Text, 0) { PlayerPawn = new PlayerPawn(_localPawnList[0]) { OffsetX = (int)(2 * _players.ToList().Count), OffsetY = (int)(2 * _players.ToList().Count - 615), PlayerLocation = new Location() { X = Locations.List[0].X + 3 * _players.ToList().Count, Y = Locations.List[0].Y } } }); _localPawnList.RemoveAt(0); PlayerName.Text = ""; if (_players.Count == 4) { AddPlayer.IsEnabled = false; } if (_players.Count > 1) { StartButton.IsEnabled = true; } } else { MessageBox.Show("Duplicate PlayerName"); PlayerName.Focus(); } } else { StartButton.IsDefault = true; AddPlayer.IsDefault = false; } }
private void button_Click(object sender, RoutedEventArgs e) { PlayerName.Focus(); if (_players.Count > 1) { foreach (IPlayer player in Settings.Players) { Settings.PawnList.Add(player.PlayerPawn.PawnImage); } this.Close(); } }
public EnterPlayers() { InitializeComponent(); PlayerList.ItemsSource = _players; foreach (IPlayer player in _players) { player.PlayerPawn.PlayerLocation = Locations.List[0]; player.Position = 0; player.PlayerPawn.Move(0); } _players.Clear(); PlayerName.Focus(); CenterWindowOnScreen(); }
private void Remove_Click(object sender, RoutedEventArgs e) { PlayerName.Focus(); if (PlayerList.SelectedIndex != -1) { _localPawnList.Add(_players[PlayerList.SelectedIndex].PlayerPawn.PawnImage); _players.RemoveAt(PlayerList.SelectedIndex); } if (_players.Count < 4) { AddPlayer.IsEnabled = true; } if (_players.Count < 1) { StartButton.IsEnabled = false; } }
private void AddPlayer_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(PlayerName.Text) || string.IsNullOrEmpty(CustomTeam.Text)) { MessageBox.Show("Gibt einen gültigen Spielernamen oder Teamnamen ein"); return; } this.addCustomTeam(); CustomTeam.Clear(); int i = Int32.Parse(SpielerCount.Text); i++; SpielerCount.Text = i.ToString(); Array.Resize(ref Spieler, Spieler.Length + 1); Spieler[Spieler.Length - 1] = PlayerName.Text; string[] row = { PlayerName.Text }; dataGridView1.Rows.Add(row); PlayerName.Focus(); PlayerName.Clear(); dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1; int SpielerZahl = 5; if (turn.tennis) { SpielerZahl = 2; } if (Spieler.Length % SpielerZahl == 1) { this.addteam(); } }
public void AddPlayer(object sender, EventArgs args) { try { string name = PlayerName.Text.Trim(); if (string.IsNullOrEmpty(name)) { throw new Exception(); } PlayerName.Text = string.Empty; players.Add(new Player { Id = Guid.NewGuid(), Name = name }); RefreshList(); PlayerName.Focus(); } catch { DisplayAlert("Atenção", "Preencha um nome!", "Ok"); } }
private void playerPlaceHolder_MouseDown(object sender, MouseButtonEventArgs e) { PlayerName.Focus(); }