6 Replies Latest reply on Jul 11, 2013 2:35 PM by Lonnie Bowling

    Calling Editor window for Data Reference

    nfilatov

      Hello!

       

      I try to call Windows Form to edit settings for AF Data Reference, but when I click on Settings button I have that error:

       

      --------------------
      G:: Error
      --------------------
      Failed to load 'OSIsoft.AF.Asset.DataReference.OSIsoft.AF.Asset.DataReference.FilterForm' plugin editor: PlugIn 'Aggregate' cannot be created because the PlugIn is missing an appropriate constructor.
      >> Constructor on type 'OSIsoft.AF.Asset.DataReference.OSIsoft.AF.Asset.DataReference.FilterForm' not found.

       

      My code is: 

       
          Public Class Aggregate
              Inherits AFDataReference
              '.....
              Public Overrides ReadOnly Property EditorType() As Type
                  Get
                      Return GetType(FilterForm)
                  End Get
              End Property
      
          End Class
      
          Friend Class FilterForm
              Inherits System.Windows.Forms.Form
      
              Private components As ComponentModel.Container = Nothing
      
              Public Sub FilterForm(ByVal dataReference As Aggregate, ByVal bReadOnly As Boolean)
      
      
              End Sub
      
              Protected Overrides Sub Dispose(ByVal disposing As Boolean)
                  If disposing Then
                      If components IsNot Nothing Then
                          components.Dispose()
                      End If
      
                  End If
                  MyBase.Dispose()
              End Sub
      
          End Class
      

       I didn't use resource file and I created windows form by designer.

       

      What i need to for working?

       

      Thanks.

        • Re: Calling Editor window for Data Reference
          dtakara

          Hi Nikolay,

           

          Maybe the issue is in line 6 of your FilterForm class code:

           
          Public Sub FilterForm(ByVal dataReference As Aggregate, ByVal bReadOnly As Boolean)
          

           

           

          Could you try this and see if you get better results?

           
          Public Sub New(ByVal DataReference As OSIsoft.AF.Asset.DataReference.Aggregate, ByVal bReadOnly As Boolean)
          

           

           

           

            • Re: Calling Editor window for Data Reference
              kilgored

              Your FilterForm class needs to have a Public constructor. You only have a Friend/internal constructor which cannot be accessed by the calling code because it is external to your project.

               

              [edit]

               

              It looks like Daniel types faster than I do!

                • Re: Calling Editor window for Data Reference
                  dtakara

                  I'm not sure, Dennis. I probably just had the chance to look into Nicolay's issue a few minutes earlier than you.

                   

                  Also, you raised a good point.

                   

                  Having in mind what you said, I just wanted to share a little more about the details of the sample project setup I used in Visual Studio 2010, to look into Nikolay's issue.

                   

                  I created a class library project where the main class is named StringConcat3, which has a corresponding source file StringConcat3.vb:

                   

                  2021.StringConcat3.png

                   

                  In StringConcat3.vb I've included the definition of the ReadOnly Property EditorType:

                   
                          Public Overrides ReadOnly Property EditorType() As Type
                              'The EditorType property returns the type of the editor to be used
                              'to edit this data reference.  The editor must inherit from
                              'Windows.Forms and must have a public constructor that accepts 
                              'this data reference and a boolean read-only flag.
                              Get
                                  Return GetType(RollupConfig)
                              End Get
                          End Property
                  

                   

                   

                  Also, I created a separate form class file named RollupConfig.vb:

                   

                  3666.AR-DR-Config-Form.png

                   

                  and this is the code I've included in RollupConfig.vb:

                   
                  Friend Class RollupConfig
                      Inherits System.Windows.Forms.Form
                  
                      Public Sub New(ByVal DataReference As OSIsoft.AF.Asset.DataReference.StringConcat3, ByVal _ReadOnly As Boolean)
                          InitializeComponent()
                          '...
                      End Sub
                  
                      '...
                  End Class 
                  

                  This form actually does not do anything (I created it just as a sample for testing this specific issue), but loads ok when called by the click on the "Settings" button in PI System Explorer.

                   

                  I am attaching the sample project I used.

                   

                  @Nikolay: I just noticed that Visual Studio 2010 created a resource file (RollupConfig.resx) automatically in the project directory:

                   

                  0728.ResourceFile.png

                   

                  So, as I don't have more details about your setup, I am not sure if my comment above still applies to your specific situation, but you may want to look into it anyway.

                    • Re: Calling Editor window for Data Reference
                      vitorfarias

                      I how use your data reference in process book?

                       

                      I created my DR works fine in PI AF but when i try to use in Process Book i receive the following message :

                       

                      "Failed to load 'My DR Name' Plugin: The Plugin type 'my dll name' was not found."

                       

                      anybody knows how to solve this ?

                        • Re: Calling Editor window for Data Reference
                          mhamel

                          @Vitor: Which version of AF SDK are you using on your development machine? Can you verify that your .dll file is copied within the C:\ProgramData\OSIsoft\AF\Plugins\<version of you assembly>?

                           

                          Can you share more on how did you register your DR (plug-in) against the PI AF Server? Is it a 4.0 .Net Framework based .dll or 3.5?

                          • Re: Calling Editor window for Data Reference
                            Lonnie Bowling

                            Hi Vitor,

                             

                            You need to make sure your DR is register properly using RegPlugIn.exe.  You can find the documentation from PI System Explorer help.  Open up the AF reference document and do a search for RegPlugIn. There are also a few threads here that could help narrow down your issues. One item to look at is if you are using .Net 3.5.  I have seen ProcessBook have issues with .Net 4.0/4.5 Framework.

                             

                            Here is a YouTube video that could help also:

                             

                            http://youtu.be/Hl3ZW4CQT8c

                             

                            Hope this helps, good luck,

                             

                            Lonnie