Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFPlugIn.CreateFormInstance Method

  • Last UpdatedJan 12, 2026
  • 3 minute read
AFPlugIn.CreateFormInstance Method
Create an instance of a plugin editor form.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7

Syntax

public Form CreateFormInstance(
	Type type,
	Object plugIn,
	bool readOnly
)
Public Function CreateFormInstance ( 
	type As Type,
	plugIn As Object,
	readOnly As Boolean
) As Form

Dim instance As AFPlugIn
Dim type As Type
Dim plugIn As Object
Dim readOnly As Boolean
Dim returnValue As Form

returnValue = instance.CreateFormInstance(type, 
	plugIn, readOnly)
public:
Form^ CreateFormInstance(
	Type^ type, 
	Object^ plugIn, 
	bool readOnly
)
member CreateFormInstance : 
        type : Type * 
        plugIn : Object * 
        readOnly : bool -> Form 

Parameters

type
Type: SystemType
The Type of the editor form to create.
plugIn
Type: SystemObject
The plugin instance being configured by the editor form.
readOnly
Type: SystemBoolean
If , then the editor form will be read-only. If , then the values can be modified.

Return Value

Type: Form
Returns the newly created plugin editor form instance.

Remarks

Typically, it is not necessary to invoke this method. This method is used internally by the AFPlugInEditor.

Examples

// This example demonstrates how to create a model analysis and display the
// configuration dialog for the Analysis Rule and Time Rule plugins.
// Note: This example assumes that there is a database called "Chocolate Milk Tutorial"
// containing a Model named "ChocolateMilkModel", and the default ConfigString
// for an "Imbalance" analysis rule is set

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases["Chocolate Milk Tutorial"];

// Set the Model
AFModel myModel = myDB.Elements["ChocolateMilkModel"] as AFModel;

// Add an Analysis to the model
AFModelAnalysis myAnalysis = new AFModelAnalysis(myDB, "MyModelAnalysis");
myAnalysis.Description = "This is a model analysis example";
myAnalysis.Target = myModel;

// Set the Analysis Rule and Time Rule
myAnalysis.AnalysisRulePlugIn = myPISystem.AnalysisRulePlugIns["Imbalance"];
myAnalysis.TimeRulePlugIn = myPISystem.TimeRulePlugIns["Periodic"];

// Display the Time Rule Configuration Dialog
AFPlugIn plugin = myAnalysis.TimeRulePlugIn;
AFTimeRule timeRule = myAnalysis.TimeRule;
if (plugin != null)
{
    using (Form configDlg = plugin.CreateFormInstance(timeRule.EditorType, timeRule, false))
    {
        if (configDlg != null)
            configDlg.ShowDialog();
    }
}

// Display the Analysis Rule Configuration Dialog
plugin = myAnalysis.AnalysisRulePlugIn;
AFAnalysisRule analysisRule = myAnalysis.AnalysisRule;
if (plugin != null)
{
    using (Form configDlg = plugin.CreateFormInstance(analysisRule.EditorType, analysisRule, false))
    {
        if (configDlg != null)
            configDlg.ShowDialog();
    }
}

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in