10-152-312 - Object-Oriented Programming 2

3.1 ShortcutManager Assignment

Getting started

  1. Create all classes as specified in the class diagram
  2. Create the window as specified in the wireframe

ShortcutProfile

  1. Following the example, use an object initializer to populate the shortcuts List with data
  2. Add XmlInclude attribute for each shortcut type, e.g. [XmlInclude(typeof(XxxShortcut))] (all four should be added to the profile, not to the individual classes)

MainWindow

  1. PopulateListBox should behave as the similar methods do in the Zoo Scenario
  2. Call PopulateListBox() from the window's loaded event handler
  3. In the list box's double click event handler:
    1. Get the selected item from the list box
    2. Create a new Process
    3. Set the process' StartInfo properties as follows:
      1. Set the FileName to the shortcut's Path
      2. Set the Arguments to the shortcut's Arguments (if a document shortcut)
      3. Set the UseShellExecute to true (if an application shortcut)
      4. Set the WorkingDirectory to the shortcut's WorkingFolder (if an application shortcut)
    4. Start the process
    5. If the process does not start, show the user an error message
    6. Add type-checking where appropriate
    7. Add error handling where appropriate
  4. Serialize the shortcut profile to a file called ShortcutManager.xml in the save button's click event handler
    1. Use an XmlSerializer, which behaves similarly to a BinaryFormatter
    2. Research XmlSerializer as needed
  5. Add using directives as needed

Run the application

  1. Start the application and click the save button
  2. Examine the ShortcutManager.xml file
    1. The file should be stored in the bin/Debug folder
    2. Notice the new xsi:type attributes on each shortcut element. These are automatically when serializing descendant objects.
  3. Deserialize the ShortcutManager.xml file in the window's loaded event handler
    1. Use an XmlSerializer, which behaves similarly to a BinaryFormatter
    2. Research XmlSerializer as needed
  4. Comment out the ShortcutProfile's object initializer

Finishing up

  1. Remove the save button from the MainWindow
  2. Copy the ShortcutManager.xml file to the root folder of the solution before zipping and submitting it
  3. When you want to add a shortcut to the manager, simply add it to the existing xml file in the same way as the other shortcuts

3.1 ShortcutManager Assignment: Class Diagram

Create/modify the classes as specified in the following UML class diagram.

PNG image of 3.1 ShortcutManager UML class diagram

3.1 ShortcutManager Assignment: Wireframe

Design the user interface per the following diagram.

PNG image of 3.1 ShortcutManager wireframe

Grading and Submission

  1. Build/compile your program
  2. Debug/test your program against the following rubric:
  3. PNG image of 3.1 ShortcutManager rubric
  4. Make your code StyleCop-compliant
  5. Close your Visual Studio solution
  6. Compress your Visual Studio solution to a zip file
  7. Submit the zip file via Blackboard