Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Adding Functionality

In the original proof-of-concept, I created two example applications. The first example was a C# Console Application to take a word input and if needed return the suggestions for the correct spelling (Figure 9-5).

09fig05.gifFigure 9-5 Console Test Application.

The second application was a simple VB.NET application (Figure 9-6) that showed checking a single word in a text box and returning the results in a right-click context menu.

09fig06.gifFigure 9-6 VB.NET Windows Form Test Application.

While these applications tested the functionality and demonstrated the cross-language capability, they really were not real-world useable applications. There are a few things that Aspell.NET needs to support before even a quality beta cycle. First, I wanted to add Log4Net to the project, even though it is somewhat simple to support good behavior if the system starts to error. This is one example where it may be useful to associate the Logger configuration with a dll. This probably warrants some changes to the code. In the meantime, ASpell.NET should just document the Log4Net requirement in the calling executables configuration file. Second, if I want to check spelling, it usually is not a single textbox field but a whole document like email or a text file, so I decided to create an application much like WordPad that is a Rich Text Format-aware editor application. Figure 9-7 shows using SharpDevelop, which is the only Open Source editor I am aware of that has a Windows Forms designer.

09fig07.gifFigure 9-7 SharpDevelop WordpadSpell Project.

While eventually I would like all the functionality of WordPad, this example application only allows for spell checking and opening a text file for spell checking. Figure 9-8 shows WordpadSpell in action.

09fig08.jpgFigure 9-8 WordpadSpell Example.

Listing 9.5, a sample command-line application from the ASpell.NET distribution, shows that the API for ASpell.NET is fairly simple. The WordpadSpell is responsible for the logic to parse things down to a single word to pass to ASpell.NET for checking.

Example 9.5. A Simple Use of ASpell.NET

   string word = args[0].ToString();
   aspell.net.SpellChecker spellCheck = new aspell.net.SpellChecker();
   System.Collections.ArrayList suggestions = spellCheck.suggest(word);
   foreach(string suggestion in suggestions)
   Console.WriteLine(word + " is correct");
   catch(Exception ex)

Adding a NAnt build script is a simple copy and paste and a quick edit of the template file. When we add the project to Subversion (Figure 9-9), Draco.NET will be triggered to perform a build. The installation and iso file are created, and the successful result is emailed out.

09fig09.gifFigure 9-9 Adding to SVN.

  • + Share This
  • 🔖 Save To Your Account