create new tag
view all tags

Homework 3 - WPF GUI for Text-based Application

Goal To learn features of WPF and XAML and to revisit file I/O in C#
Points 40
Due October 7, 2011 @ 5 PM
Grouping To be done in groups of up to two students

Problem: WPF / XAML / C#, Lists, and File I/O [40 pts]

The basic problem you will solve begins with your previous homework. You should already be able to read a file and identify the unique WORDS that occur in it. Now you will build a useful GUI to allow the user to explore text and the words it contains.

For this assignment, create a WPF / XAML program that allows the user to open a text file, display and edit the text, and save the file. In addition, the program should identify all of the unique WORDS in the currently loaded (and possibly edited) text, count how many times each occurs, and determine where in the text each occurrence is located. You may choose whether to determine word location in terms of LINE, SENTENCE, PARAGRAPH or combination of the above. You may also decide whether your text area supports lines terminated by '\n' or wraps. Obviously, if text wraps, then you should determine WORD position based on sentences and paragraphs.

Some Details

For this assignment, a sentence ends in one of these three symbols ( . ! ? ). A new paragraph begins after a blank line.

There should be some portion of the UI devoted to display and editing of the text. A TextBox is a good choice.

There should be some other portion of the UI devoted to displaying the unique WORDS in a fashion that allows the user to select individual words. A ListBox will work nicely.

Basic File operations (Save, SaveAs, Open, Quit) and Help operations (About, Help) should be provide through Menus.

There should be a control to allow the user to Clear the text area.

You can implement the detection of unique WORDS in several ways. The simplest is to provide a menu item or button to initiate an Update of the word list. Another way would be to update the word list automatically anytime the user modifies the text, clears the text area, or opens a new text file. In this second case, the UI shuld flag the word list somehow as "out of date."

You should think a bit about our discussions of UI design, and NOT just throw any old thing together.

In some fashion that makes sense, you should use at a minimum the following UI components.

  • Menus
  • Buttons
  • A TextBox
  • A ListBox
  • Multiple Windows

The following describes the minimum set of program functions that should be provided.

  • File Open
  • File Save
  • File SaveAs
  • Quit
  • About
  • Help
  • Update Word List
  • Clear Text Area
  • Display WORD stats when word is selected
    • You could do this within the main window, or use a separate window

  • Note: Your Windows should have meaningful labels on their banners

The minimum functionality gains you 32 points (80% of the credit).

Additional capabilities that are worth another 8 points include, but are not limited to

  • Use of color in helpful way
  • Use of symbols to indicate
    • Word List out of date
    • Text has been edited and needs saving
  • Prevention of Quit without warning user to save edited text
  • Use of data binding between text and WORDS, or WORDS and theirs stats
    • (you will see that the Next button in the demo program word stats window never became functional -- you can do better, I know)

There is a sample program attached to this page. It is the effort of your humble professor, while learning about WPF & XAML. Try it out. Make your seven better.

Just as a review.

A WORD is defined simply as a sequence of letters and apostrophies ('). Sample words include (hello, Indiana, can't). Strings that would be broken into multiple words or only contain words include: "This-and-that" which would be broken into 3 words "this", "and", "that"; "ident32" which contains the word "ident"; etc. The point is that any non letter character other than the apostrophe ends or separates one word from another. Case should not matter, so "Hello" and "hello" are the same word.

You might find a C# SortedList collection class useful in this endeavor. Save your unique words in lower-case. Each time you find a word, you either add it to the collection (if it is newly found) or increment the counter for it (if it has been found earlier).


Create a stub article under this Wiki topic with the SysIF11HW3XXX where XXXX is the ND netID or last name of one of the group members. Dates and timestamps are recorded by the time on the Netscale box where this Wiki is housed. You may optionally send an e-mail to the instructor (cc'ing the TA) with the entirety of the submission.

In your stub article, include your solutions as a zip file, or provide a link to your project in the SVN repository. Include the entire Visual Studio project in your zip files. It is up to you to decide if you would like to appropriately add access control to your homework. You are on your honor to not look at the code of others before you submit but are welcome to examine code after the due date.

Last Name First Name Team Name Assignment Link
Bockstege Ben No Team Homework 3
Brady Corey No Team Homework 3
Atwood Caleb Bismark Editor Homework 3
Clark Samuel No Team Homework 3
Collard Patrick Words With Friends Homework 3
Fons Andrew No Team Homework 3
Frisch Brian No Team Homework 3
Gabreski Max Words With Friends Homework 3
Gallagher Matthew No Team Homework 3
Gonzales Michael No Team Homework 3
Hawkinson Hayley No Team HomeWork 3
Kim YongHwan No Team Homework 3
Kokoszka Brenden No Team Homework 3
LaBelle Kathryn No Team HomeWork 3
Maher Anthony No Team Homework 3
Miller Ryan No Team Homework 3
Mu Jian No Team HomeWork 3
Ofsonka Andrew No Team HomeWork 3
Rockwell Brian No Team HomeWork 3
Turner Ryan No Team Homework 3
Walker Lindsay No Team Homework 3
Yang Yang Word Elite Homework 3


Grades are posted by a unique ID known only to the professor of the class, the TA of the class, and the student to protect the identity and grades of individuals as required under the Family Educational Rights and Privacy Act. If you do not know your unique ID, you can request it from the TA. If there is an issue with the grades, please e-mail the TA or set up a time to discuss it with the TA during his office hours.

For a summary of all your current scores and class average, see http://lab.pruittlife.com/grades.html and enter your UID.


  • UI Components
    • Menus: 2 Points
    • Buttons: 2 Points
    • TextBox: 2 Points
    • ListBox: 2 Points

  • Support Functionality
    • File Open: 1 Points
    • File Save: 1 Points
    • File Save As: 1 Points
    • Quit: 1 Points
    • About: 2 Points
    • Help: 2 Points

  • Core Functionality
    • Update Word List: 6 Points
    • Clear Text Area: 4 Points
    • Display stats on selection: 6 Points

  • Aesthetics and Design
    • Open Ended: 8 Points

Raw Score

27215882 33
18746258 35
77255183 0
82107241 34
51503772 37
87225786 21
16556120 40
42518531 37
3226066 37
86664223 39
2814888 34
38770134 0
81032762 22
12268321 38
21705261 40
85412787 40
52506112 36
46202461 37
63777858 25
41855128 32
3042374 32
81882055 30
6136118 39


Topic attachments
I Attachment History Action Size Date Who Comment
Microsoft Executable fileexe concordance.exe r1 manage 19.5 K 2011-09-22 - 20:01 UnknownUser Simple Concordance WPF Program
Edit | Attach | Watch | Print version | History: r31 < r30 < r29 < r28 < r27 | Backlinks | Raw View | More topic actions
Topic revision: r31 - 2011-10-10 - MatthewPruitt
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback