Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            File.Copy(CLUBS_FILE, CLUBS_FILE_COPY, true);
            File.Copy(NATIONAL_TEAMS_FILE, NATIONAL_TEAMS_FILE_COPY, true);

            loadTeamsFromFileToCollection();
            currentCollectionOnScreen = clubsCollection;
            refreshListOnScreen();
        }
Esempio n. 2
0
        private void rbNationalTeams_CheckedChanged(object sender, EventArgs e)
        {
            if (rbNationalTeams.Checked)
            {
                currentCollectionOnScreen = nationalTeamsCollection;
            }
            else
            {
                currentCollectionOnScreen = clubsCollection;
            }

            refreshListOnScreen();
        }
Esempio n. 3
0
        private void loadTeamsFromFileToCollection()
        {
            File.Copy(CLUBS_FILE, CLUBS_FILE_COPY, true);
            File.Copy(NATIONAL_TEAMS_FILE, NATIONAL_TEAMS_FILE_COPY, true);

            XmlSerializer serializer = new XmlSerializer(typeof(LeagueCollection));

            // Clubs
            string       path   = CLUBS_FILE_COPY;
            StreamReader reader = new StreamReader(path);

            clubsCollection = (LeagueCollection)serializer.Deserialize(reader);
            reader.Close();

            // National Teams
            path   = NATIONAL_TEAMS_FILE_COPY;
            reader = new StreamReader(path);
            nationalTeamsCollection = (LeagueCollection)serializer.Deserialize(reader);
            reader.Close();
        }