COP4226, Text Assignment
This application will draw text instead of using text box controls. It will use
a thread to find text elements in the file system. It will use data binding
to exchange data between the main form and the text options dialog.
Create a multi-document application that will use a separate class for a document. The document will
contain a list of text objects. Define a separate class for the text information. Be sure
to encapsulate operations in the class they work on.
Avoid long methods. Each method that you create should be short, to promote
encapsulation. If you have a method that is longer than 25 lines, then it
probably needs to be divided into smaller methods.
General Guidelines
Create an accessible user interface with many of the features covered in this course.
- Use the control library for this course as needed.
-
Use interfaces to encapsulate implementation details. Design code so that the
implementation details of data could be changed in the future without having to
rewrite all the code that accesses that data.
- Create Oath and About dialogs as in other assignments.
-
Create enumerations as needed.
-
A thread may only access objects it creates. It may pass
ownership of an object to another thread, but it may not share variables with another thread.
- Add a status bar, tooltips, help information, error checking, menus, etc.
Text Class
Create a class that will hold data for text. The text class will have text, color, background color, location, font,
and rotation.
Add properties to improve encapsulation. Add more properties and helper methods that contain
operations that work on text. Encapsulate text processes in this class.
Document Class
Create a document class that will store text classes. Use a container class to hold the text objects.
Add properties and helper methods to encapsulate document processes in this class.
Text Options Dialog
Create a dialog in the main application that will allow the user to modify information for text.
- Allow the user to change any of the text properties.
- The dialog may not access any members from the main form, application settings or user settings.
- Use data binding to exchange data between the main form and the dialog.
- Add buttons to the dialog that allow the user to cycle through the properties for each text object.
- The current text should be displayed with some theme that indicates that the current properties will change that text.
- Add buttons to change the Z-order of the text object. Include bring-to-front and send-to-back options.
Main Form
The main form will display text objects.
- Add appropriate UI features. In particular, show the status of the CapsLock key in the status bar.
- Allow serialization and deserialization of each document.
- Allow a text object to be moved to a new location by using the mouse.
- Allow the current text object to be moved with the arrow keys.
-
When a text object is right-clicked, open the options dialog modelessly.
- When the user clicks apply, the main form will retrieve the updated properties and redraw itself.
- Be sure the dialog can still be opened after the text object has been modified.
- Allow plain text to be added to the main form. Split the text into words and add a
new text object for each word. Set the initial values as you choose, but set the location so that text elements
do not all start in the same location.
- Allow plain text documents to be imported into the main form. Use an OpenFileDialog
to select a text file.
- Allow plain text to be copied from the clipboard.
-
Search Menu Item
-
Open a modeless dialog containing the following:
-
A list box that will display all the files found.
-
Buttons for starting, stopping and pausing a search. Enabled/disable these
buttons as appropriate.
-
A combo box with drop down style of drop down list, containing the different
extensions for text files. Include .txt, .html and .htm at the least. You
may add other extensions if you choose.
-
The search should be run in a separate thread.
Interact with the thread using a BackgroundWorker or with delegates.
The thread may only access objects it creates. It may pass
ownership of an object to another thread, but it may not share variables with another thread.
-
When the search is paused, change the name on the pause button to continue.
If clicked, this button will continue the search.
-
Search for all files with specific extension on the current computer.
-
Find all files with the extension selected from the drop down list.
-
If the drop down list is changed during the search, then the file extension
that the search is seeking will also change.
-
I have provided a text file with methods
that will search your hard drive for .txt files.
-
You will need to modify the code to work in a thread.
-
You will need to test for cancellation and pause at several places, to guarantee
a fast response to the command.
-
Every time a file is found, add its full path to the list box.
-
Double-clicking the name in the list box should open a new window and import the selected
file into the form.
-
Only allow one search dialog to be open at a time.
-
Only allow one search to proceed at any time.
-
If the dialog is closed before the search ends, be sure that the search is
cancelled before the dialog closes.
-
When the search is complete, display a message box stating how many files
were found.
Submitting the Assignment
Zip your entire project and upload via the Assignment Dropbox on Canvas.
Exclude the Debug and Release directories.
Be sure to include your control library in your uploaded file.
Upload your video to me using the upload via the Assignment Dropbox on Canvas.