C# Class SIL.FieldWorks.Common.Controls.Persistence

Inheritance: System.ComponentModel.Component, ISupportInitialize, IFWDisposable
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
OnLoadSettings void
OnMoveResize void
OnSaveSettings void
SaveWindowState void

Public Methods

Method Description
BeginInit ( ) : void

Required to implement ISupportInitialize.

CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

DeserializeFromBinary ( Stream stream ) : Object

Deserializes an object from binary.

EndInit ( ) : void

When all properties have been initialized, this will be called. This is where we can load the window state.

LoadWindowPosition ( ) : void

Load the top, left, width, and height of the window from the registry, use default application parameters if not present in registry. This should be called from OnLayout; it takes effect in the first call AFTER EndInit.

Persistence ( ) : System

Initializes a new instance of the Persistence class

Persistence ( Control parent, Settings loadFunct, Settings saveFunct ) : System

Initializes a new instance of the Persistence class

Persistence ( System container ) : System

Initializes a new instance of the Persistence class

Persistence ( System container, Control parent ) : System

Initializes a new instance of the Persistence class

SaveSettingsNow ( Control ctrl ) : void

Initiate saving all the settings for the specified control, and for all of the control's owned controls which implement ISettings.

Note: A parent's ISettings::SaveSettingsNow should call this method (Persistence::SaveSettingsNow).

SaveWindowPosition ( RegistryKey key ) : void

Save the top, left, width, and height of the window to the registry.

SerializeToBinary ( object obj ) : MemoryStream

Serializes to binary an object.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the resources used by Persistence

Private Methods

Method Description
OnLoadSettings ( object obj, System e ) : void

Tasks needing to be done when Window is being created: Load window position. Load settings.

OnMoveResize ( object sender, System e ) : void
OnSaveSettings ( object obj, System e ) : void

Tasks needing to be done when Window is being closed: Save window position. Save window state. Save settings.

SaveWindowState ( RegistryKey key ) : void

Method Details

BeginInit() public method

Required to implement ISupportInitialize.
public BeginInit ( ) : void
return void

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

DeserializeFromBinary() public static method

Deserializes an object from binary.
public static DeserializeFromBinary ( Stream stream ) : Object
stream Stream The stream from which to deserialize
return Object

Dispose() protected method

Releases the resources used by Persistence
protected Dispose ( bool disposing ) : void
disposing bool
return void

EndInit() public method

When all properties have been initialized, this will be called. This is where we can load the window state.
public EndInit ( ) : void
return void

LoadWindowPosition() public method

Load the top, left, width, and height of the window from the registry, use default application parameters if not present in registry. This should be called from OnLayout; it takes effect in the first call AFTER EndInit.
public LoadWindowPosition ( ) : void
return void

Persistence() public method

Initializes a new instance of the Persistence class
public Persistence ( ) : System
return System

Persistence() public method

Initializes a new instance of the Persistence class
public Persistence ( Control parent, Settings loadFunct, Settings saveFunct ) : System
parent System.Windows.Forms.Control
loadFunct Settings
saveFunct Settings
return System

Persistence() public method

Initializes a new instance of the Persistence class
public Persistence ( System container ) : System
container System
return System

Persistence() public method

Initializes a new instance of the Persistence class
public Persistence ( System container, Control parent ) : System
container System
parent System.Windows.Forms.Control
return System

SaveSettingsNow() public method

Initiate saving all the settings for the specified control, and for all of the control's owned controls which implement ISettings.
Note: A parent's ISettings::SaveSettingsNow should call this method (Persistence::SaveSettingsNow).
public SaveSettingsNow ( Control ctrl ) : void
ctrl System.Windows.Forms.Control Control or form whose settings should be saved.
return void

SaveWindowPosition() public method

Save the top, left, width, and height of the window to the registry.
public SaveWindowPosition ( RegistryKey key ) : void
key Microsoft.Win32.RegistryKey The Registry Key.
return void

SerializeToBinary() public static method

Serializes to binary an object.
public static SerializeToBinary ( object obj ) : MemoryStream
obj object The object to be serialized.
return System.IO.MemoryStream