C# Class Smrf.AppLib.OpenFileDialog2

Represents a smart OpenFileDialog that knows how to get a file name from the user and open an object from the file. Abstract.
This is an abstract base class. Each class derived from this one is responsible for opening one type of file and creating an object from the file contents. A file type might be an image or an XML document, for example. A derived class must implement GetDialogTitle(), GetFilter(), and OpenObject(). It should also implement a public method called ShowDialogAndOpenXXX(), where XXX is Image or XML, for example. ShowDialogAndOpenXXX() should call ShowDialogAndOpenObject() 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_oOpenFileDialog System.Windows.Forms.OpenFileDialog

Public Methods

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

Initializes a new instance of the OpenFileDialog2 class.

Protected Methods

Method Description
GetDialogTitle ( ) : String
GetFilter ( ) : String
OnOpenError ( String sErrorDescription ) : void
OpenObject ( String sFileName, Object &oObject ) : void
ShowDialogAndOpenObject ( Object &oObject ) : DialogResult

Private Methods

Method Description
AssertValid ( ) : void

Method Details

GetDialogTitle() protected abstract method

protected abstract GetDialogTitle ( ) : String
return String

GetFilter() protected abstract method

protected abstract GetFilter ( ) : String
return String

OnOpenError() protected method

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

OpenFileDialog2() public method

Initializes a new instance of the OpenFileDialog2 class.
public OpenFileDialog2 ( 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

OpenObject() protected abstract method

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

ShowDialogAndOpenObject() protected method

protected ShowDialogAndOpenObject ( Object &oObject ) : DialogResult
oObject Object
return DialogResult

Property Details

m_oOpenFileDialog protected property

protected OpenFileDialog,System.Windows.Forms m_oOpenFileDialog
return System.Windows.Forms.OpenFileDialog