CreateCopy(Laner: ILaner): IMetabaseObjectDescriptor;
CreateCopy(Laner: Prognoz.Platform.Interop.Laner.ILaner): Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;
Laner. A workbook.
The CreateCopy method creates a copy of the specified workbook.
A workbook can be used only in one context. To register a workbook in several contexts, use its copies.
During copying of a workbook within one context all formulas that use series from other workbooks are saved. During copying of a workbook between different contexts the formulas that contain dependences on other workbooks are lost.
Executing this example requires a form containing:
A button with the Button1 identifier.
The LanerBox component.
The UiErAnalyzer component with the UiErAnalyzer1 identifier that is used as data source for LanerBox. Workbook of the time series database must be loaded to UiErAnalyzer1.
There should also be the pContext variable that contains context.
Add a link to the Metabase system assembly. Example is a handler of the OnClick event for the button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
pContext: ILanerContext;
Laner: ILaner;
LanerObject: IMetabaseObjectDescriptor;
Begin
pContext.BeginLoad;
Laner := UiErAnalyzer1.ErAnalyzer.Laner;
If Not Laner.IsInContext Then
pContext.Register(Laner);
Else
LanerObject := pContext.CreateCopy(Laner);
pContext.Register((LanerObject As IEaxAnalyzer).Laner);
pContext.EndLoad;
End If;
End Sub Button1OnClick;
After executing the example, a workbook is registered in a context. If it is already in the context, then its copy is registered.
Executing the example requires a .NET form containing:
A button with the button1 identifier.
The LanerBoxNet component.
The UiErAnalyzerNet component with the uiErAnalyzerNet1 identifier that is a data source for LanerBoxNet. Workbook of the time series database must be loaded to uiErAnalyzerNet1.
Example is a handler of the Click event for the button.
Imports Prognoz.Platform.Interop.Laner;
Imports Prognoz.Platform.Interop.Express;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
pContext: ILanerContext;
Laner: ILaner;
LanerObject: IMetabaseObjectDescriptor;
Begin
pContext.BeginLoad();
Laner := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer.Laner;
If Not Laner.IsInContext Then
pContext.Register(Laner As LanerFactory);
Else
LanerObject := pContext.CreateCopy(Laner As LanerFactory);
pContext.Register((LanerObject As IEaxAnalyzer).Laner);
pContext.EndLoad();
End If;
End Sub;
After executing the example, a workbook is registered in a context. If it is already in the context, then its copy is registered.
See also: