C# Class Kajabity.Tools.Forms.SDIForm

Description of SDIForm.
Inheritance: System.Windows.Forms.Form
Mostrar archivo Open project: Kajabity/Kajabity-Tools

Protected Properties

Property Type Description
backup bool
manager DocumentManager

Public Methods

Method Description
DocumentChanged ( ) : void

Called whenever a document is created or loaded (or closed). Override to provide specific Forms handling when the document is changed.

FileCloseClick ( object sender, EventArgs e ) : void

A handler for the File->Close command. Closes any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.

FileExitClick ( object sender, EventArgs e ) : void

A handler for the File->Exit command. Exits the application, closing any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.

FileNewClick ( object sender, System e ) : void

A handler for the File->New command. Closes any currently open document (prompting the user to save it if modified). Creates a new instance of the managed document type. Call this method your form's 'OnClick()' handler.

FileOpenClick ( object sender, System e ) : void

A handler for the File->Open command. Uses the OpenFileDialog to select and open a file. Closes any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.

FileSaveAsClick ( object sender, EventArgs e ) : void

A handler for the File->Save As command. Prompts the user for a filename and path and saves the document to it. Call this method your form's 'OnClick()' handler.

FileSaveClick ( object sender, EventArgs e ) : void

A handler for the File->Save command. Saves the currently open document - prompting for a filename if it is a new document. Call this method your form's 'OnClick()' handler.

SDIForm ( ) : System

Default constructor - required to enable the Visual Editor for Forms in Visual Studio to work.

SDIForm ( DocumentManager manager ) : System

Construct an SDIForm providing an instance of a document manager.

Protected Methods

Method Description
canCloseDocument ( object sender, System e ) : bool

A "helper" menu action to try to close the currently loaded file if there is one. The method will display a prompt to the user to save the file if modified.

loadDocument ( string filename ) : void

Helper to load a document - triggers DocumentChanged().

Private Methods

Method Description
SDIForm_Load ( object sender, System e ) : void
closeDocument ( ) : void

Helper to close any currently open document - triggers DocumentChanged().

newDocument ( ) : void

Helper to create a new document - triggers DocumentChanged().

saveDocument ( string filename ) : void

Helper to save a document - triggers DocumentChanged().

Method Details

DocumentChanged() public method

Called whenever a document is created or loaded (or closed). Override to provide specific Forms handling when the document is changed.
public DocumentChanged ( ) : void
return void

FileCloseClick() public method

A handler for the File->Close command. Closes any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.
public FileCloseClick ( object sender, EventArgs e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System.EventArgs Any additional arguments to the event.
return void

FileExitClick() public method

A handler for the File->Exit command. Exits the application, closing any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.
public FileExitClick ( object sender, EventArgs e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System.EventArgs Any additional arguments to the event.
return void

FileNewClick() public method

A handler for the File->New command. Closes any currently open document (prompting the user to save it if modified). Creates a new instance of the managed document type. Call this method your form's 'OnClick()' handler.
public FileNewClick ( object sender, System e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System Any additional arguments to the event.
return void

FileOpenClick() public method

A handler for the File->Open command. Uses the OpenFileDialog to select and open a file. Closes any currently open document (prompting the user to save it if modified). Call this method your form's 'OnClick()' handler.
public FileOpenClick ( object sender, System e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System Any additional arguments to the event.
return void

FileSaveAsClick() public method

A handler for the File->Save As command. Prompts the user for a filename and path and saves the document to it. Call this method your form's 'OnClick()' handler.
public FileSaveAsClick ( object sender, EventArgs e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System.EventArgs Any additional arguments to the event.
return void

FileSaveClick() public method

A handler for the File->Save command. Saves the currently open document - prompting for a filename if it is a new document. Call this method your form's 'OnClick()' handler.
public FileSaveClick ( object sender, EventArgs e ) : void
sender object the object that sent the event - e.g. menu item or tool bar button.
e System.EventArgs Any additional arguments to the event.
return void

SDIForm() public method

Default constructor - required to enable the Visual Editor for Forms in Visual Studio to work.
public SDIForm ( ) : System
return System

SDIForm() public method

Construct an SDIForm providing an instance of a document manager.
public SDIForm ( DocumentManager manager ) : System
manager DocumentManager the DocumentManager to be used by this form.
return System

canCloseDocument() protected method

A "helper" menu action to try to close the currently loaded file if there is one. The method will display a prompt to the user to save the file if modified.
protected canCloseDocument ( object sender, System e ) : bool
sender object the object that sent the event - e.g. menu item or tool bar button.
e System Any additional arguments to the event.
return bool

loadDocument() protected method

Helper to load a document - triggers DocumentChanged().
protected loadDocument ( string filename ) : void
filename string
return void

Property Details

backup protected_oe property

If true, when saving a document any existing file with the same name will be renamed with a trailing '~' character as a backup. Any previous backup (i.e. with the same backup filename) will be deleted.
protected bool backup
return bool

manager protected_oe property

A reference to an instance of the DocumentManager used to load and save documents for the application.
protected DocumentManager,Kajabity.Tools.Forms manager
return DocumentManager