Project 2

Due Date: Tue 14 Dec (firm!)

Objectives

An understanding of
  • Concurrency
  • Background threads for time-consuming activities
  • Thread cancellation
  • Event-based notification (for progress reporting by background activities)

Description

Your job is to write a console application for initiating and managing concurrent web downloads.

Functional Requirements (70%)

In summary, this application allows the user to enter complete URLs of files to be downloaded. Multiple downloads can be active at the same time, and the user can control each one independently. Because GUI programming would exceed the scope of this course, we are limiting ourselves to a console-based application.

The application should prompt the user for input and supports the following input choices:
  • q -> quit the application
  • URL of the form http://... -> the application starts downloading the resource at the given URL
  • l -> the application shows a numbered list of active downloads with bytes read, total bytes, and percentage for each download
  • c number -> the application cancels the download with the given number
The application notifies the user when any of the following events occurs:
  • download completed
  • download failed
The application should handle errors gracefully by printing a concise error message and re-prompting the user. In particular, your application should handle the following possible errors:
  • invalid input choice
  • invalid URL
  • resource not found at given URL

Implementation/Nonfunctional Requirements (20%)

The nonfunctional requirements are as follows:
  • Please follow the Spinners and DownloadProgress examples.
  • Use async workflows (as opposed to explicit threads) for all background activities.
  • Use events for tracking the progress of background activities (DownloadProgressChanged and Download*Completed).
  • Be sure strictly to separate the application functionality from the console-based user interface in your application architecture. In particular, each of the two layers should be defined in a separate module with its own source file.

Documentation (10%)

Provide concise XMLDocs (///) and inline (// or (*...*)) comments where appropriate.

Extra credit (20%)

Add the capability to suspend and resume ongoing downloads. A C#-based example of this capability is documented here.

Submission

Comments