Esempio n. 1
0
        public static Element_Word find_word(string text)
        {
            foreach (var document in current_context.vocabularies.Values)
            {
                Element_Word result = document.find_word(text);
                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }
Esempio n. 2
0
        public static void add_word_dialog(string grammar, string old_word)
        {
            string[]          split     = grammar.Split('#');
            Familiar_Document document  = Familiar_Document.find_document(split[0]);
            string            rule_name = "";

            if (split.Length > 1)
            {
                rule_name = split[1];
            }
            else
            {
                rule_name = "rule_name";
            }

            Element_Word word = null;

            if (old_word != null && old_word != "")
            {
                word = document.get_word(old_word, rule_name);
            }
            else
            {
                word = new Element_Word();
            }

            Generic_Form dialog = new Generic_Form(word, "Add New Word");

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                if (old_word == null || old_word == "")
                {
                    document.add_word(word, rule_name);
                }
                document.save();
                reload();
            }
            catch (Exception ex)
            {
                Feedback.print(ex);
            }
        }