No announcement yet.

Getting plugin working with VB.NET

  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting plugin working with VB.NET

    I've been trying to get a sample plugin working with VB.NET (VS 2005), using the sample C# code as a basis. I can get SD to register and load the plugin, but can't get it to register event handling (OnExec) and wonder if I'm missing a trick.

    I've tried both creating delegates and adding event handlers, neither of which seems to result in my event being fired.

    Imports system.runtime.InteropServices
    Imports SD = StreetDeck
    Public Class SDPlugin
        Implements StreetDeck.IDualStreetDeckAddin
        Private Const ModuleName As String = "SamplePlugin"
        Private SDApp As SD.StreetDeckApp
        Private SDModule As SD.ScriptModule
        Private SDOverlay As SD.ScriptOverlay
        Delegate Function SDOnExec(ByVal Description As String, ByVal eEM As StreetDeck.enumExecMessage, ByVal wParam As Integer) As Boolean
        Private SDOnExecDelegate As SDOnExec
        Public Sub OnConnection(ByVal Application As Object, ByVal eConnectMode As StreetDeck.enumAddinConnectMode) Implements StreetDeck.IDualStreetDeckAddin.OnConnection
            SDApp = Application
            SDModule = SDApp.CreateModule(ModuleName)
            Dim btnShowOverlay As SD.Panel = SDModule.CreatePanel(StreetDeck.enumCreatePanelType.eCPTButton, "BUTTON.LISTITEM_HIGH", "ShowOverlay", SDApp.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientX), SDApp.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericSettingsModuleClientY), 200, 200)
            btnShowOverlay.Caption = "Show Overlay"
            SDOverlay = SDApp.CreateOverlay("OverlayTest")
            SDOnExecDelegate = New SDOnExec(AddressOf On_Exec)
            SDModule.onexec = SDOnExecDelegate
            'AddHandler SDOverlay.OnExec, AddressOf On_Exec
        End Sub
        Public Sub OnDisconnect() Implements StreetDeck.IDualStreetDeckAddin.OnDisconnect
        End Sub
        Private Function On_Exec(ByVal Description As String, ByVal eEM As StreetDeck.enumExecMessage, ByVal wParam As Integer) As Boolean
            If Description.ToUpper = "SHOWOVERLAY" Then
                If eEM = StreetDeck.enumExecMessage.eEMSelect Then
                    SDOverlay.Visible = Not (SDOverlay.Visible)
                    SDOverlay.MsgBoxEx("Overlay visibility changed!", "Button Clicked", StreetDeck.enumMsgIconType.eMsgIconAlert, 1)
                End If
            End If
            Return False
        End Function
    End Class
    Can anyone shed any light as to why this isn't working?

  • #2
    Well, using the delegate approach doesn't seem to work. But if I use the right variable for the addhandler, it works fine.