示例#1
0
        /// <summary>
        /// Filtert die Teamliste basierend auf Kontinent und Staat
        /// </summary>
        private void FilterTeamList()
        {
            SimpleLog.Info(String.Format("Filter Teamlist: Continent={0} State={1}", SelectedContinent, SelectedState?.Name));

            FilteredTeamList = new FootballTeamCollection(Settings.FootballTeams);
            if (SelectedContinent != EContinent.Unknown)
            {
                FilteredTeamList = new FootballTeamCollection(FilteredTeamList.Where(x => x.State.Continent == SelectedContinent));
            }
            if (SelectedState != null && SelectedState != State.NoneState)
            {
                FilteredTeamList = new FootballTeamCollection(FilteredTeamList.Where(x => x.State == SelectedState));
            }
        }
        //Constructor
        public ViewModelViewEditWedstrijdSchema()
        {
            this.WedstrijdSecretariaat = new WedstrijdSecretariaat(DataBaseRepository);
            this.TeamListCombobox      = new CommuncatingCombobox <VoetbalTeam>(FilteredTeamList.ToList());
            this.ResetUI();
            this.SaveNieuweWedstrijd = new Command(this.SaveNieuweWedstrijdExecute, () => !InEditingMode);
            this.PasWedstrijdAan     = new Command(this.PasWedstrijdAanExecute, () => InEditingMode);
            this.Delete           = new Command(this.DeleteWedstrijdExecute, () => InEditingMode);
            this.Cancel           = new Command(this.CancelExecute, () => true);
            this.SpeelWedstrijden = new Command(this.SpeelWedstrijdenExecute, () => true);

            //TeamListCombobox laat de teams in de dropdown zien na keuze van een team voor bijv
            //ThuisTeam is dit Team niet meer beschikbaar in de lijst van UitTeam
            this.TeamListCombobox.InputLeftChanged  += () => TeamListCombobox.UpdateListRight(TeamListCombobox.InputLeft);
            this.TeamListCombobox.InputLeftChanged  += UpdateComboBox;
            this.TeamListCombobox.InputRightChanged += () => TeamListCombobox.UpdateListLeft(TeamListCombobox.InputRight);
            this.TeamListCombobox.InputRightChanged += UpdateComboBox;
            this.TeamListCombobox.SourceListChanged += () => TeamListCombobox.UpdateListLeft(TeamListCombobox.InputRight);
            this.TeamListCombobox.SourceListChanged += () => TeamListCombobox.UpdateListRight(TeamListCombobox.InputLeft);
            this.TeamListCombobox.SourceListChanged += UpdateComboBox;
        }