Esempio n. 1
0
        private void lst_NFC_DoubleClick(object sender, EventArgs e)
        {
            //Instantiated new form
            AddTeamForm newTeam = new AddTeamForm();

            // subscribe to the event handler method
            PopulateAddTeamForm      += newTeam.MainForm_PopulateAddTeamForm;
            newTeam.AddToMainForm    += AddToDivisionsLists;
            newTeam.AddButtonChecker += AddTeamForm_AddButtonChecker;

            // cast the object as a Character
            FootballTeam team = (FootballTeam)lst_NFC.SelectedItem;

            // create the CharEventArgs to be sent
            TeamEventArgs args = new TeamEventArgs();

            args.TeamName = team.TeamName;
            args.City     = team.City;
            args.Division = team.Division;

            // invoke the custom EventHandler
            PopulateAddTeamForm(this, args);

            // present the AddTeamForm
            newTeam.ShowDialog();

            lst_NFC.SelectedIndex = -1;
        }
Esempio n. 2
0
        //-----------------------------------------------------------------------


        //------------------------------BUTTON CLICKS----------------------------
        private void btn_NewTeam_Click(object sender, EventArgs e)
        {
            //Instantiated new form
            AddTeamForm newTeam = new AddTeamForm();

            // subscribe to the event handler method
            newTeam.AddToMainForm += AddToDivisionsLists;

            // present the AddTeamForm
            newTeam.ShowDialog();

            // if there is any selected index reverts it to -1
            lst_AFC.SelectedIndex = -1;
            lst_NFC.SelectedIndex = -1;
        }