Load the add-in programatically

1537
1
01-22-2014 02:54 AM
NarenR
by
New Contributor
I've created an addin with button and dockable window in it. I've added a utility class to access instance of each control.
For e.g. one of my function has some thing like this :
UIDClass uid = new UIDClass()
uid.Value = "MyDockableWindowID"
"return ArcMap.DockableWindowManager.GetDockableWindow(uid)"

Now wanted to write unit test case (in a different assembly) on this utility class.
When I call this function, it throws error for 'uid.Value' saying that its an incorrect identifier.

I suspect I need to have the add-in loaded into my environment. Can someone suggest a way out of this?
0 Kudos
1 Reply
swapnabhide
New Contributor
Hi Naren,

I guess the error is thrown because you are inputing wrong value to 'IUID.Value'. The value should be ClassID (CLSID) or ProgID with project name and class name of the coclass.
Using CLSID
dim pUID as New UID 
pUID.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}"

Using ProgID
pUID.Value = "esriArcMapUI.AddDataCommand"

Also, following example may be useful in your case:
Public Class ToggleDockWinBtn
    Inherits ESRI.ArcGIS.Desktop.AddIns.Button
   
    Public Sub New()
       
    End Sub
   
    Protected Overrides Sub OnClick()
   
    'Get dockable window.
    Dim dockWinID As UID = New UIDClass()
    dockWinID.Value = "ESRI_SelectionSample_SelCountDockWin"
    s_dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID)
End Sub
--------------
Here, I guess 'ESRI_SelectionSample' is the project name or category in which they want their add to be. Hope this helps.

Regards,
Swapna.
0 Kudos