Exemple #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Player[] players = Archiving.ReadPlayersFromFile(archivingFile);
     if (players != null)
     {
         foreach (var player in players)
         {
             playersListBox.Items.Add(player);
         }
     }
 }
Exemple #2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            int n = playersListBox.Items.Count;

            Player[] players = null;
            if (n > 0)
            {
                players = new Player[n];
                int index = 0;
                foreach (Player player in playersListBox.Items)
                {
                    players[index++] = player;
                }
                Archiving.SavePlayersToFile(archivingFile, players);
            }
        }