コード例 #1
0
ファイル: uHome.xaml.cs プロジェクト: arslanberk/Dictionary
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string sWord = "";

            sWord = SearchWord.Text;
            if (word.check(sWord))
            {
                for (int i = 0; i < word.index; i++)
                {
                    if (word.word[i] == sWord)
                    {
                        FlowDocument doc = new FlowDocument();

                        // Add paragraphs to the FlowDocument.
                        doc.Blocks.Add(new Paragraph(new Run(word.word[i] + "  " + "(" + word.status[i] + ")")));
                        doc.Blocks.Add(new Paragraph(new Run("- - - - - - - - - - - - - - - - - - - -")));
                        doc.Blocks.Add(new Paragraph(new Run(word.translation[i])));
                        Translation.Document = doc;
                    }
                }
            }
            else if (!word.check(sWord))
            {
                FlowDocument doc = new FlowDocument();
                // Add paragraphs to the FlowDocument.
                doc.Blocks.Add(new Paragraph(new Run("system cannot find . . .")));
                Translation.Document = doc;
            }
        }