|Deliverable 7: Object Persistence||
Objectives: Complete the reference program.
Description: Finalize the reference program by saving the references to a binary file, and then open the file, format the references, and write them to a doc file for future use.
In the last deliverable you saved your references to an ArrayList as each one was entered. However, when you closed your program you lost the reference objects so you can never choose an alternate format in which to display them.
In this program you will achieve object persistence through the use of Object I/O.
As with previous programs the user will have the option of entering references, with the difference being the new capability of saving the objects to a file. As in the previous program, the user will also have the option of saving the formatted reference list to a rtf file. This program also introduces menus
A menu item should be provided to allow a user to open the reference input form and add new references. When all references have been entered, the entire ArrayList can be written to a binary file with a .dat extension. Note that you are writing the unformatted data to a file, not the formatted output.
Keep in mind that the user may enter his references one day, but not use them again for several days or weeks. Therefore, the form should include a menu option that will allow the user to open, via an OpenFileDialog, the dat file of references that was created and saved in the previous step and store them in an ArrayList. The user can then add to that list of references.
You should provide a menu option to preview the formatted output in a RichTextBox control. The user will also want to specify the reference format that is desired. Thus, the form should also have submenus to allow the user to select the format desired (MLA, APA, Chicago). Then the array should be sorted by first author's last name, each element in the sorted array should have the proper formatting method (formatMLA, formatAPA, formatChicago) called, and the resulting string should be written to a RichTextBox.
You should provide a menu option to save the formatted output to an rtf file. The user should be allowed to specify the reference format that is desired via submenus providing choices of MLA, APA, Chicago. Then the formatted reference list will be written to a RichTextBox as in the preview option, the user will be allowed to select or specify an rtf file in which to save the formatted data via a SaveFileDialog, and the contents of the RichTextBox will be written to an rtf file for later use in a paper.
In the screens below the buttons perform the following functions:
To open one form from another use code like the following:
frmReferences myForm2 = new frmReferences();
If your program has variables that must be accessible to multiple forms, simply add a static class to your program and declare the variables within it. Here is an example:
static class clsGlobals