private void mniPlayersImport_Click(object sender, RoutedEventArgs e)
{
if (this.tournament.Rounds.Count > 0)
{
if (PMW.Show(StringTable.MainWindow_ResetTournament, MessageBoxButton.YesNo) != MessageBoxResult.Yes) return;
}
OpenFileDialog openDialog = new OpenFileDialog()
{
Filter = StringTable.MainWindow_PlikiGraczy + " (*.anp)|*.anp",
ValidateNames = true,
InitialDirectory = Directory.GetCurrentDirectory(),
AddExtension = true,
DefaultExt = ".anp",
CheckPathExists = true,
CheckFileExists = true,
};
if (openDialog.ShowDialog() == true)
{
this.BusyIndicator.IsBusy = true;
List<Player> playerList = Tournament.LoadPlayers(openDialog.FileName);
if (playerList == null) return;
this.tournament = new Tournament();
foreach (Player player in playerList)
{
player.Active = true;
player.Bucholz = 0;
player.CorpoWins = 0;
player.DeckCheck = false;
player.DiceCount = 0;
player.GamesDraw = 0;
player.GamesWin = 0;
player.GamesLoose = 0;
player.MBucholz = 0;
player.Place = 0;
player.Points = 0;
player.RankBeforeTournament = 0;
player.SmallPointsMinus = 0;
player.SmallPointsPlus = 0;
player.Payment = false;
player.SuperBYE = false;
this.tournament.AddPlayer(player);
}
this.tournament.RefreshPointsTable();
this.RefreshTournamentDataContexts();
this.BusyIndicator.IsBusy = false;
}
}