SIL.FieldWorks.Common.Controls.Persistence.SaveSettingsNow C# (CSharp) Method

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
		public void SaveSettingsNow(Control ctrl)
		{
			CheckDisposed();

			OnSaveSettings(ctrl, null);

			foreach (Control control in ctrl.Controls)
			{
				if (control is ISettings)
					((ISettings)control).SaveSettingsNow();
			}
		}
		#endregion

Usage Example

Example #1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Implement this method to save the persistent settings for your class. Normally, this
 /// should also result in recursively calling SaveSettingsNow for all children which
 /// also implement ISettings.
 /// </summary>
 /// <remarks>Note: A form's implementation of <see cref="M:SIL.FieldWorks.Common.Controls.ISettings.SaveSettingsNow"/> normally
 /// calls <see cref="M:SIL.FieldWorks.Common.Controls.Persistence.SaveSettingsNow(System.Windows.Forms.Control)"/> (after optionally saving any
 /// class-specific properties).</remarks>
 /// ------------------------------------------------------------------------------------
 public void SaveSettingsNow()
 {
     CheckDisposed();
     if (m_persistence != null)
     {
         m_persistence.SaveSettingsNow(this);
         // Since Panel1 and Panel2 don't implement ISettings, we have to call
         // SaveSettingsNow explicitly so that our grand-children get a chance to save
         // their information!
         m_persistence.SaveSettingsNow(Panel1);
         m_persistence.SaveSettingsNow(Panel2);
     }
 }
All Usage Examples Of SIL.FieldWorks.Common.Controls.Persistence::SaveSettingsNow