How to make Add-Ins

Learn how to create Add-Ins of all types for V3-R and share your own tutorials with others.
1 post Page 1 of 1
Contributors
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

How to make Add-Ins
CodenStuff
Hello,

This is a guide on how to make an add-in for the V3-R software. This guide is intended for users of VB Express but if you use VStudio you can just create a new "Custom Control" project.

If you dont want to follow this guide you can download a blank Add-In template at the bottom of this post, BUT you will need to know which code changes to make so give this guide a read over and read the code changes.

First thing we need to do is start a new Class project so press Ctrl+N and select "Class Library" as your new project type.
sshot-24.png
Once you have done that you should have a setup that looks something like this:
sshot-25.png
Now the "Class1.vb" file should already be open in code-view but we dont want this code:
Code: Select all
Public Class Class1

End Class
So delete that and paste this code into it:
Code: Select all
Imports SlotAddIn
Imports System.Windows.Forms
Namespace Addin
    Public Class AppGlue
        Implements iAppGlue
        Public Sub New()
        End Sub
        '############################################################
        'YOU CAN CHANGE THESE OPTIONS TO DESCRIBE YOUR ADD-IN
        '############################################################
        Private iName As String = "The name of my Add-In"
        Private iDescription As String = "A description of what my add-in does and how to use it."
        Private iCreator As String = "My Name"
        Private iVersion As String = "1.0"
        Private iSupport As String = "www.MyWebsite.com"
        '############################################################
        'Change the image name to the name of an embedded resource image to use as your add-in icon
        Private iMyImage = "AddinImage.png"
        '############################################################


        '############################################################
        'UNCOMMENT THE CONTROL TYPE YOU WISH TO ADD AND YOUR CONTROLS
        'NAME AT THE END
        '############################################################
        Private FullorSidebar As UserControl '= New UserControl1
        Private ToolStripButton As ToolStripItem '= New Mybutton
        '************************************************************


        '############################################################
        'CHANGE THIS OPTION TO TELL V3 WHERE YOUR ADD-IN WILL GO
        '1 = FullScreen
        '2 = SideBar
        '3 = ToolStripbutton
        '4 = Toolbar
        '############################################################
        Private iLocation As String = 1
        '************************************************************




#Region "For Future use"
        'THESE OPTIONS WILL BE USED IN THE FUTURE
        Private iMainInterface3 As UserControl '= New UserControl1()
        Private iMainInterface4 As UserControl '= New UserControl1()
        Private iMainInterface5 As UserControl '= New UserControl1()
        Private iMainInterface6 As UserControl '= New UserControl1()
        Private iMainInterface7 As UserControl '= New UserControl1()
        Private iMainForm As Form '= Form1
        Private ToolBars As ToolStrip ' = UserControl1.t

        '#########################################################
        Private iVKey As String = Nothing
        Private iEO1 As String = Nothing
        Private iEO2 As String = Nothing
        Private iEO3 As String = Nothing
        Private iEO4 As String = Nothing
        Private iEO5 As String = Nothing
        Private iEO6 As String = Nothing
        Private iEO7 As String = Nothing
        Private iEO8 As String = Nothing
        Private iEO9 As String = Nothing
        Private iEO10 As String = Nothing
        '###############################################################################
        '///////////////////////////////////////////////////////////////////////////////
        'DO NOT EDIT ANYTHING BELOW THIS LINE OR YOUR ADD-IN MAY NOT FUNCTION CORRECTLY!
        '///////////////////////////////////////////////////////////////////////////////
        '###############################################################################
        Private iExtra1 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra2 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra3 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra4 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra5 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra6 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra7 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra8 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra9 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iExtra10 As String = "" 'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        '/////////////////////////////////////////////////////////////////////////
#End Region


#Region "Do not edit anything here"
        Private iHost As iAppGlueMain = Nothing
        '/////////////////////////////////////////////////////////////////////////
        'RESERVED FOR FUTURE USE - *DO NOT CHANGE*
        Private iAllExtras As String = iExtra1 + "|" + iExtra2 + "|" + iExtra3 + "|" + iExtra4 + "|" + iExtra5 + "|" + iExtra6 + "|" + iExtra7 + "|" + iExtra8 + "|" + iExtra9 + "|" + iExtra10
        Public Sub Initialize() Implements iAppGlue.Initialize
        End Sub
        Public Sub Dispose() Implements iAppGlue.Dispose
        End Sub
        Public ReadOnly Property Extras() As String Implements iAppGlue.ExtraOptions
            Get
                Return iAllExtras
            End Get
        End Property
        Public ReadOnly Property Description() As String Implements iAppGlue.Description
            Get
                Return iDescription
            End Get
        End Property
        Public ReadOnly Property Author() As String Implements iAppGlue.Author
            Get
                Return iCreator
            End Get
        End Property
        Public ReadOnly Property Location() As String Implements iAppGlue.Location
            Get
                Return iLocation
            End Get
        End Property
        Public Property CNS() As iAppGlueMain Implements iAppGlue.CNS
            Get
                Return iHost
            End Get
            Set(ByVal value As iAppGlueMain)
                iHost = value
            End Set
        End Property
        Public ReadOnly Property Name() As String Implements iAppGlue.Name
            Get
                Return iName
            End Get
        End Property
        Public ReadOnly Property MyIcon() As String Implements iAppGlue.MyIcon
            Get
                Return iMyImage
            End Get
        End Property
        Public ReadOnly Property MainInterface() As UserControl Implements iAppGlue.MainInterface
            Get
                Return FullorSidebar
            End Get
        End Property
        Public ReadOnly Property stripbutton() As ToolStripItem Implements iAppGlue.StripButton
            Get
                Return ToolStripButton
            End Get
        End Property
        Public ReadOnly Property Toolbar() As ToolStrip Implements iAppGlue.Toolbar
            Get
                Return ToolBars
            End Get
        End Property
        Public ReadOnly Property MainInterface3() As UserControl Implements iAppGlue.MainInterface3
            Get
                Return iMainInterface3
            End Get
        End Property
        Public ReadOnly Property MainInterface4() As UserControl Implements iAppGlue.MainInterface4
            Get
                Return iMainInterface4
            End Get
        End Property
        Public ReadOnly Property MainInterface5() As UserControl Implements iAppGlue.MainInterface5
            Get
                Return iMainInterface5
            End Get
        End Property
        Public ReadOnly Property MainInterface6() As UserControl Implements iAppGlue.MainInterface6
            Get
                Return iMainInterface6
            End Get
        End Property
        Public ReadOnly Property MainInterface7() As UserControl Implements iAppGlue.MainInterface7
            Get
                Return iMainInterface7
            End Get
        End Property
        Public ReadOnly Property MainForm() As Form Implements iAppGlue.Mainform
            Get
                Return iMainForm
            End Get
        End Property
        Public ReadOnly Property Version() As String Implements iAppGlue.Version
            Get
                Return iVersion
            End Get
        End Property
        Public ReadOnly Property Support() As String Implements iAppGlue.Support
            Get
                Return iSupport
            End Get
        End Property
        Public ReadOnly Property VKey() As String Implements iAppGlue.VKey
            Get
                Return iVKey
            End Get
        End Property
        Public ReadOnly Property EO1() As String Implements iAppGlue.EO1
            Get
                Return iEO1
            End Get
        End Property
        Public ReadOnly Property EO2() As String Implements iAppGlue.EO2
            Get
                Return iEO2
            End Get
        End Property
        Public ReadOnly Property EO3() As String Implements iAppGlue.EO3
            Get
                Return iEO3
            End Get
        End Property
        Public ReadOnly Property EO4() As String Implements iAppGlue.EO4
            Get
                Return iEO4
            End Get
        End Property
        Public ReadOnly Property EO5() As String Implements iAppGlue.EO5
            Get
                Return iEO5
            End Get
        End Property
        Public ReadOnly Property EO6() As String Implements iAppGlue.EO6
            Get
                Return iEO6
            End Get
        End Property
        Public ReadOnly Property EO7() As String Implements iAppGlue.EO7
            Get
                Return iEO7
            End Get
        End Property
        Public ReadOnly Property EO8() As String Implements iAppGlue.EO8
            Get
                Return iEO8
            End Get
        End Property
        Public ReadOnly Property EO9() As String Implements iAppGlue.EO9
            Get
                Return iEO9
            End Get
        End Property
        Public ReadOnly Property EO10() As String Implements iAppGlue.EO10
            Get
                Return iEO10
            End Get
        End Property
#End Region


    End Class

End Namespace

You will see alot of errors show up but dont panic we just need our AppGlue.dll file. Using the Menu at the top of the screen click on "Project" followed by "Add Reference" and then browse to the AppGlue.dll file and click "OK".
sshot-26.png
Most of the errors would have vanished at this point with only a few remaining but again dont panic it will all be sorted out in the following steps.

In the code you just pasted into "Class1.vb" you will notice this block of code near the very top:
Code: Select all
   '############################################################
        'YOU CAN CHANGE THESE OPTIONS TO DESCRIBE YOUR ADD-IN
        '############################################################
        Private iName As String = "The name of my Add-In"
        Private iDescription As String = "A description of what my add-in does and how to use it."
        Private iCreator As String = "My Name"
        Private iVersion As String = "1.0"
        Private iSupport As String = "www.MyWebsite.com"
        '############################################################
        'Change the image name to the name of an embedded resource image to use as your add-in icon
        Private iMyImage = "AddinImage.png"
        '############################################################


        '############################################################
        'UNCOMMENT THE CONTROL TYPE YOU WISH TO ADD AND YOUR CONTROLS
        'NAME AT THE END
        '############################################################
        Private FullorSidebar As UserControl '= New UserControl1
        Private ToolStripButton As ToolStripItem '= New Mybutton
        '************************************************************


        '############################################################
        'CHANGE THIS OPTION TO TELL V3 WHERE YOUR ADD-IN WILL GO
        '1 = FullScreen
        '2 = SideBar
        '3 = ToolStripbutton
        '4 = Toolbar
        '############################################################
        Private iLocation As String = 1
        '************************************************************
I have included a short guide with it to help you fill in some details which should be easy to follow. You just need to change a few things and fill out some information about your add-in.

Once you are happy with your settings its time to add our main control on which your add-in will be made. Click "Project" in the top menu and click "Add User Control", now I recommend leaving its name as UserControl1 because all remaining code errors will vanish if you do but if you need to rename it for any reason then you will need to change this code in "Class1.vb":
Code: Select all
'############################################################
        'UNCOMMENT THE CONTROL TYPE YOU WISH TO ADD AND YOUR CONTROLS
        'NAME AT THE END
        '############################################################
        Private FullorSidebar As UserControl '= New UserControl1
        Private ToolStripButton As ToolStripItem '= New Mybutton
        '************************************************************
Change where it says "UserControl1()" to the whatever name you gave your control.

Now that youve done that all the errors should be gone and we can start making our add-in.

The way custom controls are made is exactly the same as a standard windows form application and the only difference is it does not have a border because it is not a windows form and cannot run on its own. It is designed to be used for creating controls like the Button or Label or Textbox controls that you are use to adding to your projects but we want to use it to make full applications that sit very nicely and are run within CnS Desktop. You can even convert any of your existing applications into an add-in by simple copying your code and controls directly into your usercontrol project :).

Once you have finished making your add-in and compiled it you can go into your Project > Bin > Release folder and copy the resulting .dll file into the CnS Desktop Add-In folder and when you start CnS Desktop it will be ready loaded for you and ready to use.

So now you know how easy it is to create an add-in I hope you will make some and test them out on V3-R and share them with us.


Thank you and happy Add-In cooll;
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
1 post Page 1 of 1
Return to “Tutorials”