Exemplo n.º 1
0
        private void DisplayLevel3Suggestions()
        {
            if (string.IsNullOrEmpty(Level3Original()))
            {
                // display an empty list
                cboLevel3Suggestion.DataSource = null;
            }
            else
            {
                //based on the suggested level 1 and 2 and the original level3
                string level1 = SelectedValue(cboLevel1Suggestion);
                string level2 = SelectedValue(cboLevel2Suggestion);
                string level3 = Level3Original();

                if (level2 == null)
                {
                    // display an empty list
                    cboLevel3Suggestion.DataSource = null;
                }
                else
                {
                    // get any saved matched name
                    MatchResult savedMatch =
                        geoCoder.GetSavedMatchLevel3(level3, level1, level2);

                    // get suggestions
                    List <MatchResult> suggestions = suggestedMatch.Level3Suggestions(
                        level1,
                        level2,
                        level3);

                    // format
                    const bool addBlank = true;
                    List <KeyValuePair <string, string> > suggestionList =
                        FormatSuggestionList(savedMatch, suggestions, addBlank);

                    cboLevel3Suggestion.DisplayMember = "Value";
                    cboLevel3Suggestion.ValueMember   = "Key";
                    cboLevel3Suggestion.DataSource    = suggestionList;
                }
            }
        }