C# Class Smrf.AppLib.SaveFileDialog2

Represents a smart SaveFileDialog that knows how to get a file name from the user and save an object to the file. Abstract.
This is an abstract base class. Each class derived from this one is responsible for saving one type of object, such as an image or an XML document. A derived class must implement GetDialogTitle(), GetFilter(), and SaveObject(). It should also implement a public method called ShowDialogAndSaveXXX(), where XXX is Image or XML, for example. ShowDialogAndSaveXXX() should call ShowDialogAndSaveObject() in this base class to do most of the work.
Show file Open project: 2014-sed-team3/term-project

Protected Properties

Property Type Description
m_oSaveFileDialog System.Windows.Forms.SaveFileDialog

Public Methods

Method Description
SaveFileDialog2 ( String sInitialDirectory, String sInitialFileName ) : System

Initializes a new instance of the SaveFileDialog2 class.

Protected Methods

Method Description
GetDialogTitle ( Object oObjectBeingSaved ) : String
GetFilter ( ) : String
GetInitialFilterIndex ( ) : Int32
GetNameOfFileToSave ( ) : String
OnSaveError ( String sErrorDescription ) : void
SaveObject ( Object oObject, String sFileName ) : void
ShowDialogAndSaveObject ( Object oObject ) : DialogResult

Private Methods

Method Description
AssertValid ( ) : void

Method Details

GetDialogTitle() protected abstract method

protected abstract GetDialogTitle ( Object oObjectBeingSaved ) : String
oObjectBeingSaved Object
return String

GetFilter() protected abstract method

protected abstract GetFilter ( ) : String
return String

GetInitialFilterIndex() protected method

protected GetInitialFilterIndex ( ) : Int32
return System.Int32

GetNameOfFileToSave() protected method

protected GetNameOfFileToSave ( ) : String
return String

OnSaveError() protected method

protected OnSaveError ( String sErrorDescription ) : void
sErrorDescription String
return void

SaveFileDialog2() public method

Initializes a new instance of the SaveFileDialog2 class.
public SaveFileDialog2 ( String sInitialDirectory, String sInitialFileName ) : System
sInitialDirectory String /// Initial directory the dialog will display. Use an empty string to let /// the dialog select an initial directory. ///
sInitialFileName String /// Initial file name. Can be a complete path, a path without an /// extension, a file name, or a file name without an extension. ///
return System

SaveObject() protected abstract method

protected abstract SaveObject ( Object oObject, String sFileName ) : void
oObject Object
sFileName String
return void

ShowDialogAndSaveObject() protected method

protected ShowDialogAndSaveObject ( Object oObject ) : DialogResult
oObject Object
return DialogResult

Property Details

m_oSaveFileDialog protected property

protected SaveFileDialog,System.Windows.Forms m_oSaveFileDialog
return System.Windows.Forms.SaveFileDialog