//wpf
 /// <summary>
 /// On click listener for "go" button -> check spelling and report results
 /// </summary>
 private void actionButton_Click(object sender, RoutedEventArgs e)
 {
     //needs some input
     if (inputBox.Text.Length > 0)
     {
         try {
             //check spelling of input box
             SpellingResult res = spellCore.CheckSpelling(inputBox.Text);
             //update displays
             inputBox.Text  = res.UserLines;
             outputBox.Text = res.MarkedLines.Length == 0 ? "All good." : res.MarkedLines;
         }
         catch (SpellCheckException sce) {
             //spell checking failed
             MessageBox.Show(this, sce.Message, "Input in wrong format");
         }
     }
 }
Ejemplo n.º 2
0
        //wpf
        private void actionButton_Click(object sender, RoutedEventArgs e)
        {
            if (inputBox.Text.Length > 0)
            {
                //verify
                SpellingResult res = CheckSpelling(inputBox.Text, ',');
                if (res.UserError)
                {
                    MessageBox.Show(this, res.UserMessage, "User Error");
                    return;
                }
                else
                {
                    inputBox.Text = string.Join(", ", res.RegLines);

                    outputBox.Text = res.MarkedLines.Length == 0 ? "All good." : string.Join("\n", res.MarkedLines);
                }
            }
        }