Ejemplo n.º 1
0
        private void RegisteredPlayersEnterTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            foundPlayers.Clear();

            using (StringReader reader = new StringReader(RegisteredPlayersEnterTextBox.Text))
            {
                string line = null;
                while ((line = reader.ReadLine()) != null)
                {
                    PlayerRanking player      = new PlayerRanking();
                    bool          bExactMatch = false;
                    if (NameFinder.GetClosestName(playerRankingData.playerRankings, line, ref player, ref bExactMatch))
                    {
                        if (bExactMatch)
                        {
                            foundPlayers.Add(new PotentialPlayer(player, true));
                        }
                        else
                        {
                            foundPlayers.Add(new PotentialPlayer(line));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public PotentialPlayer(string nameLine)
        {
            string f = "", l = "";

            NameFinder.GetValidNames(nameLine, ref f, ref l);
            firstName = f;
            lastName  = l;
        }
        private void TeamsFixBoxName_TextChanged(object sender, TextChangedEventArgs e)
        {
            teamsPartialMatches.Clear();

            ObservableCollection <RegisteredPlayer> potentialPlayerMatches =
                NameFinder.GetFilteredNames(registeredPlayers, TeamsFixBoxFirstName, TeamsFixBoxLastName);

            foreach (RegisteredPlayer rp in potentialPlayerMatches)
            {
                teamsPartialMatches.Add(rp);
            }
        }
        private void FillRankingsTextBox()
        {
            LastUpdatedLabel.Content = "Last Updated: " + playerRankingData.time.ToString();

            TournamentData.filteredPlayerRankings =
                NameFinder.GetFilteredNames(playerRankingData.playerRankings, PlayerRankingsFilterTextBox.Text);

            foreach (PlayerRanking pr in TournamentData.filteredPlayerRankings)
            {
                pr.IsRegistered = IsPlayerRegistered(pr.firstName, pr.lastName);
            }

            PlayerRankingsItemsControl.ItemsSource = null;
            PlayerRankingsItemsControl.ItemsSource = TournamentData.filteredPlayerRankings;
        }
Ejemplo n.º 5
0
        private void FixBoxName_TextChanged(object sender, TextChangedEventArgs e)
        {
            partialMatches.Clear();

            ObservableCollection <PlayerRanking> potentialPlayerMatches =
                NameFinder.GetFilteredNames(playerRankingData.playerRankings, FixBoxFirstName, FixBoxLastName);

            foreach (PlayerRanking pr in potentialPlayerMatches)
            {
                if (!IsPlayerRegistered(pr.firstName, pr.lastName))
                {
                    partialMatches.Add(new PotentialPlayer(pr, false));
                }
            }
        }
Ejemplo n.º 6
0
        private void UpdateJudgeInventory()
        {
            if (SelectedDivision == EDivisionDisplay.None || SelectedRound == ERoundJudgeDisplay.None)
            {
                return;
            }

            judgeInventoryItems.Clear();

            bool bUseFilter = FilterText != null && FilterText != "";
            ObservableCollection <RegisteredPlayer> playerList;

            if (bUseFilter)
            {
                playerList = NameFinder.GetFilteredNames(parentWindow.RegisteredPlayers, FilterText);
            }
            else
            {
                playerList = parentWindow.RegisteredPlayers;
            }

            // Create all the judge inventory items
            List <JudgeInventoryItemData> judgeItems = new List <JudgeInventoryItemData>();

            foreach (RegisteredPlayer rp in playerList)
            {
                judgeItems.Add(parentWindow.CreateJudgeInventoryItemData(rp));
            }

            UpdateAddJudgeButtons(judgeItems);

            if (!bUseFilter)
            {
                // Sort
                judgeItems.Sort();
            }

            foreach (JudgeInventoryItemData jid in judgeItems)
            {
                judgeInventoryItems.Add(jid);
            }

            // Set the judge counts and compete times
        }
        private void TeamsEnterTeamsTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            foundTeams.Clear();

            using (StringReader reader = new StringReader(TeamsEnterTeamsTextBox.Text))
            {
                string line = null;
                while ((line = reader.ReadLine()) != null)
                {
                    PotentialTeam newTeam = new PotentialTeam();

                    string[] names = line.Split(NameFinder.splitPlayerChars);
                    foreach (string nameLine in names)
                    {
                        PlayerRanking player      = new PlayerRanking();
                        bool          bExactMatch = false;
                        if (NameFinder.GetClosestName(playerRankingData.playerRankings, nameLine, ref player, ref bExactMatch))
                        {
                            if (bExactMatch)
                            {
                                newTeam.registeredPlayers.Add(new RegisteredPlayer(new PotentialPlayer(player, true)));
                            }
                            else
                            {
                                newTeam.potentialPlayers.Add(new PotentialPlayer(nameLine));
                            }
                        }
                    }

                    if (newTeam.potentialPlayers.Count > 0 || newTeam.RegisteredPlayers.Count > 0)
                    {
                        foundTeams.Add(newTeam);
                    }
                }
            }
        }