LoadState(Reader: IXmlDomElement);
LoadState(Reader: Prognoz.Platform.Interop.MsXml2.IXmlDomElement);
Reader. XML element, from which the state of component elements is loaded.
The LoadState method loads a state of the component elements.
As the value of the Reader parameter, specify the XML element to which the elements' state was previously saved using the SaveState method.
Executing the example requires a form that contains the MetaAttributesBreadcrumb component with the MetaAttributesBreadcrumb1 identifier and two buttons with the Button1 and Button2 identifiers. The repository includes the time series database with the DB_RUBR identifier.
To execute the example, add links to the Stat, Cubes, and Xml system assemblies.
Class TestForm: Form
Button1: Button;
Button2: Button;
MetaAttributesBreadcrumb1: MetaAttributesBreadcrumb;
Doc: FreeThreadedDOMDocument60;
Element: IXmlDomElement;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
mb: IMetabase;
rubinst: IRubricatorInstance;
Begin
mb := MetabaseClass.Active;
rubinst := mb.ItemById("DB_RUBR").Open(Null) As IRubricatorInstance;
Doc := New FreeThreadedDOMDocument60.Create;
MetaAttributesBreadcrumb1.Rubricator := rubinst;
MetaAttributesBreadcrumb1.MetaAttributes := rubinst.Facts.Dictionary.Attributes;
Element := Doc.createElement("BreadcrumbState");
MetaAttributesBreadcrumb1.SaveState(Element);
End Sub Button1OnClick;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
MetaAttributesBreadcrumb1.LoadState(Element);
End Sub Button2OnClick;
End Class TestForm;
After executing the example pressing the first button saves the state of elements to the BreadcrumbState XML element. On pressing the second button, the saved state of elements is loaded from the same XML element.
See also: