How to implement plugin?

nurmans

New member
Joined
Oct 16, 2022
Messages
1
Programming Experience
Beginner
I know this is probably a frequently asked question, but I've been spending all day trying to find a solution to this problem. Now, I am working on a project in which VB is partially used. And in a program that has been made by someone else, there is a VB class that I want to develop little a bit by implementing a plugin in it to support dynamically extendable application core.

My question is how to replace "M1065" and "M1064" by using the plugin that I created earlier?

This is the vb class.

VB.NET:
Friend Function GetWinderTrouble(ByVal lr As String) As Integer
        '左側
        If lr = Constant.YARN_WINDER_L Then
            Return Me.GetDeviceValue("M1065")
            '右側
        Else
            Return Me.GetDeviceValue("M1064")
        End If
 End Function

And this is the Plugin that I already created earlier

VB.NET:
Imports IPLCComm

Public Class PlugIn
    Implements IPLCComm.IPlugIn

Friend Const YARN_WINDER_L As String = "L"

Friend Const GET_WINDERTROUBLE_L As String = "M1065"
Friend Const GET_WINDERTROUBLE_R As String = "M1064"

Public Function GetWinderTrouble(lr As String) As Integer Implements IPlugIn.GetWinderTrouble
    If lr = YARN_WINDER_L Then
        'Left side
        Return Me.GetDeviceValue(GET_WINDERTROUBLE_L)
    Else
        'Right side
        Return Me.GetDeviceValue(GET_WINDERTROUBLE_R)
    End If
End Function
End Class

Please help and thank you in advance.
 
Back
Top