Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var    b          = (Button)sender;
            string word       = b.Content.ToString().Substring(0, b.Content.ToString().Length - 1);//去除空白
            var    wordWindow = new wordExplanationWindow(word);

            wordWindow.Show();
        }
Ejemplo n.º 2
0
        /// <summary>例句英文單字按紐,點擊查詢單字</summary>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b    = (Button)sender;
            string word = b.Content.ToString().Substring(0, b.Content.ToString().Length - 1); //去除空白

            word = Regex.Replace(word, "[.']", "", RegexOptions.IgnoreCase);                  //去除'和.
            word = DataBase.getVerbRoot(word);                                                //給出動詞字根
            word = DataBase.getSingularNoun(word);                                            //給出單數名詞
            string result = DataBase.getWordExplanation(DataBase.getHTML(word));

            if (result.Equals("search error"))
            {
                MessageBox.Show("找不到該單字!");
            }
            else
            {
                wordExplanationWindow wordWindow = new wordExplanationWindow(result, word);//取得HTML並用python擷取單字解釋
                wordWindow.Show();
            }
        }