Пример #1
0
        void searchWordWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string word = (string)e.Argument;

            //prepare result variables
            Definition definitions = null;
            string synonyms = "";
            string rhymes = "";

            //search wordnik
            try
            {
                updateStatus("Searching definitions for '" + word + "' ...");
                WordnikDefinition[] wdDefs = wordnik.GetDefinitions(word).ToArray();

                if (wdDefs.Length > 0)
                {
                    definitions = new Definition(wdDefs);
                    synonyms = findSynonyms(word);
                    rhymes = findRhymes(word);

                    e.Result = new Tuple<string, Definition, string, string>(word, definitions, synonyms, rhymes);
                }
                else
                    e.Result = word + " not found";
            }
            catch
            {
                e.Result = "error";
                MessageBox.Show("Your Internet connection might be disrupted, or the Wordnik service might be temporarily down.", "Error while finding word definition for " + word, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
 public Entry(string word, Definition def, string synList, string rhymeList, DateTime created, DateTime learned, DateTime lastTest, DateTime nextTest, int learningPhase, int nStudyAttempts, int nRecallAttempts, int nRecallSuccesses, bool archived)
 {
     this.word = word;
     this.def = def;
     synonyms = processList(synList);
     rhymes = processList(rhymeList);
     this.created = created;
     this.learned = learned;
     this.lastTest = lastTest;
     this.nextTest = nextTest;
     this.learningPhase = learningPhase;
     this.nStudyAttempts = nStudyAttempts;
     this.nRecallAttempts = nRecallAttempts;
     this.nRecallSuccesses = nRecallSuccesses;
     this.archived = archived;
 }
Пример #3
0
 public void AddNewWord(string word, Definition definitions, string synonyms, string rhymes)
 {
     GetWords().Add(new Entry(word, definitions, Entry.FormatCommas(synonyms), rhymes));
     SaveWords();
 }
Пример #4
0
        public Entry(string word, Definition def, string synList, string rhymeList)
        {
            this.word = word;
            this.def = def;

            synonyms = processList(synList);
            rhymes = processList(rhymeList);

            created = DateTime.Now;
            learned = DateTime.MinValue;
            lastTest = DateTime.Now;

            learningPhase = 1;
            nStudyAttempts = 0;
            nRecallAttempts = 0;
            nRecallSuccesses = 0;

            archived = false;
        }