Ejemplo n.º 1
0
        private void AddSynonyms()
        {
            Console.WriteLine("Input synonyms in a comma-separated list (ex 'cat,feline,kitty'):");

            var synonyms = GetCommaSeperatedListFromUser();

            if (synonyms.Length < 2)
            {
                Console.WriteLine("Input 2 or more words");
                AddSynonyms();
                return;
            }

            thesaurus.AddSynonyms(synonyms);
        }
Ejemplo n.º 2
0
        private void Button3_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tb3_addNew.Text))
            {
                MessageBox.Show("Write your word, please.");
            }
            else if (string.IsNullOrWhiteSpace(tb2_viewRes.Text))
            {
                MessageBox.Show("Write synonyms for presented word, please.");
            }
            else
            {
                List <string> newWords = new List <string> {
                    tb3_addNew.Text
                };
                int tb2lines = tb2_viewRes.Lines.Length;
                for (int i = 0; i < tb2lines; i++)
                {
                    newWords.Add(tb2_viewRes.Lines[i]);
                }

                thesaurus.AddSynonyms(newWords);

                tb3_addNew.Text  = "";
                tb2_viewRes.Text = "";
                System.Threading.Thread.Sleep(500);

                IEnumerable <string> words = thesaurus.GetWords();
                foreach (var item in words)
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        tb2_viewRes.Text += item + Environment.NewLine;
                    }
                }
            }
        }
        public void Post(IEnumerable <string> value)
        {
            Debug.WriteLine("post Value " + value);

            thesaurusService.AddSynonyms(value);
        }