For those interested...below is the simple 'Example1' that Chuck wrote in C# transposed into Visual BASIC 2005.
Code:
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Namespace StreetDeckVBAddin
<GuidAttribute("0304F473-515A-45ab-BE2E-E93419F21CB8"), ProgId("StreetDeckVBAddin.Class1")> _
Public Class Class1
Implements StreetDeck.IDualStreetDeckAddin
Public app As StreetDeck.StreetDeckApp
Dim MyModule As StreetDeck.ScriptModule
Dim overlay As StreetDeck.ScriptOverlay
Dim btnShowOverlay As StreetDeck.Panel
Public Sub OnConnection(ByVal Application As Object, ByVal eConnectMode As StreetDeck.enumAddinConnectMode) Implements StreetDeck.IDualStreetDeckAddin.OnConnection
app = Application ' setup local reference to Object
MyModule = app.CreateModule("ModuleName")
btnShowOverlay = MyModule.CreatePanel(StreetDeck.enumCreatePanelType.eCPTButton, _
"BUTTON.LISTITEM_HIGH", "ShowOverlay", _
app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientX), _
app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientY), _
200, 200)
btnShowOverlay.Caption = "Show Overlay"
overlay = app.CreateOverlay("OverlayTest")
' Register for events
AddHandler MyModule.OnExec, AddressOf module_OnExec
End Sub
Public Sub OnDisconnect() Implements StreetDeck.IDualStreetDeckAddin.OnDisconnect
RemoveHandler MyModule.OnExec, AddressOf module_OnExec
End Sub
Public Function module_OnExec(ByVal Description As String, ByVal eEM As StreetDeck.enumExecMessage, ByVal wParam As Int32) As Boolean
If (Description = "ShowOverlay") Then
If (eEM = StreetDeck.enumExecMessage.eEMSelect) Then
overlay.Visible = Not (overlay.Visible)
overlay.MsgBox("Overlay Visibility Changed!", "Button Clicked")
Return True
End If
End If
Return False
End Function
End Class
End Namespace
I first wrote this using the free 'Express' version of Visual BASIC, which is good enough except it does not allow you to run an external program (StreetDeck) for debugging purposes. I downloaded the 90 day trial of Visual Studio, which allowed me to trace through the execution of the .dll and find a couple of bugs/issues -- a really neat capability not available in the Express version.
At any rate, I hope the above snippet helps those of you looking to write something in Visual BASIC as a .NET addin - I have learned a lot about object oriented programming and will now move on to creating a 'real' app.
Bookmarks