コード例 #1
0
        private void DisplayLevel2Suggestions()
        {
            if (string.IsNullOrEmpty(Level2Original()))
            {
                // display an empty list
                cboLevel2Suggestion.DataSource = null;
            }
            else
            {
                //based on the suggested level 1 and the original level2
                string level1 = SelectedValue(cboLevel1Suggestion);
                string level2 = Level2Original();

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

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

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

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