Exemplo n.º 1
0
        private void PopulateWordList(String query)
        {
            wordResultList.Clear();

            if (query != "")
            {
                service.BeginDefine(query, (ar) => {
                    WordDefinition wd = service.EndDefine(ar);
                    //WordDefinition wd = service.Define(query);

                    foreach (Definition d in wd.Definitions)
                    {
                        wordResultList.Add(new WordResult {
                            Id         = wordResultList.Count,
                            DictId     = d.Dictionary.Id,
                            Dictionary = d.Dictionary.Name,
                            Definition = d.WordDefinition
                        });
                    }

                    if (wordResultList.Count == 1)
                    {
                        searchInfo.Text = "Found 1 definition in 1 dictionary for “" + query + "”";
                    }
                    else if (wordResultList.Count == 0)
                    {
                        searchInfo.Text = "Found no definitions for “" + query + "”";
                    }
                    else
                    {
                        searchInfo.Text = "Found " + wordResultList.Count + " definitions in X dictionaries for “" + query + "”";
                    }

                    //adapter.NotifyDataSetChanged();
                }, null);
            }
            else
            {
                searchInfo.Text = " ";
            }
        }