This assignment expands on the following assigments:
Create the following methods in the VectorCanvas class:
Public Sub SaveToFile(ByVal filename As String) Public Shared Function ReadFromFile(ByVal filename As String) as VectorCanvas
Both of these methods, should throw a new "ShapesException" that contains an appropriate error message in case any errors are encountered while reading or writing to the file.
The SaveToFile method should store the information about the VectorCanvas in the file as described in the assignment, VectorCanvas file format.
The ReadFromFile method should open the file and create a new VectorCanvas with the dimensions, backgound and shapes that are specified in the file. The method should then RETURN the newly created VectorCanvas object. Note that this method is declared as "Shared". That means that you don't actually need a VectorCanvas object to call the method. The appropriate way to use this method is as follows:
Dim vc as VectorCanvas ' this variable currently has the value of "Nothing"
Dim filename as String = "C:\myCanvasFile.mcf"
try
{
vc = VectorCanvas.ReadFromFile(filename)
vc.Display()
}
catch (e as ShapesException)
{
Console.Writeline("Error creating the canvas: " & e.message)
}
catch (e as Exception)
{
Console.Writeline("Unknown error: " & e.message)
}