예제 #1
0
        private void btnStoreEntry_Click(object sender, EventArgs e)
        {
            if (lstWords.SelectedIndex > -1)
            {
                ThesaurusEntry entry = thesaurusEntries.Single(te => te.Query == ((string)lstWords.SelectedItem));

                foreach (ThesaurusResult result in entry.GetResults((string)lstResults.SelectedItem))
                {
                    foreach (ThesaurusDefinition tDef in result.Definitions)
                    {
                        Definition def = DataConverter.GetDefinitionObject(tDef, languageID);
                        def = Definition.InsertDefinition(def);

                        if (lstSynonyms.Items.Count > 0)
                        {
                            foreach (string synonym in lstSynonyms.Items)
                            {
                                ritchard.InsertSynonym(new Synonym {
                                    DefinitionID = def.DefinitionID, SynonymID = Definition.GetDefinitionIDForString(synonym)
                                });
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void PopulateLstResults()
        {
            if (lstWords.SelectedItem != null)
            {
                string         query = ((string)lstWords.SelectedItem).Split(" ".ToCharArray())[0];
                ThesaurusEntry entry = thesaurusEntries.Single(ent => ent.Query == query);
                foreach (ThesaurusResult result in entry.GetResults())
                {
                    lstResults.Items.Add(result.Word);
                }

                if (entry.GetResults().Count > 0)
                {
                    lstResults.Enabled       = true;
                    lstResults.SelectedIndex = 0;
                }
                else
                {
                    lstResults.Items.Add("<no results>");
                    lstResults.Enabled = false;
                }
            }
        }