Plugin Newbie - Simply Trying to Replicate the First Example Error (1 Viewer)

ZippyRainbow

Portal Member
January 13, 2011
7
0
Home Country
Hi All,

I am new at creating Plugins, and I have tried replicating the steps from the How to write a plugin for MediaPortal in Visual Basic (.Net) page.. But I just must be missing something. Is there another step I have missed?

I have just installed MediaPortal onto my Work Machine, I have just logged in once to check if it is working, which it is.

The Errors I get are all similar to the following...
Class 'Class1' must implement 'Function Author() As String' for interface 'MediaPortal.GUI.Library.ISetupForm'. C:\Dev\MPPlugin\MPInsertDVD\MPInsertDVD\Class1.vb

Is there something extra I need to do which I have not included. I could copy the code down here, but it is the same as what is on the sample page.

If anyone has some extra info that would be good.

Regards,
Paul
 

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    The error suggests you have not copied the full code.

    It is saying that
    Code:
    Public Function Author() As String
      Return "YourNameHere"
    End Function
    has not been implemented in class1
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Is there a reason to why you chose Visual Basic and not C#?

    Most plugins are in C#. So unless you have a preference for Visual Basic, you should probably go for C#...makes it a lot easier to use existing code or duplicate features implemented in other plugins :)
     

    ZippyRainbow

    Portal Member
    January 13, 2011
    7
    0
    Home Country
    Thanks Jameson_Uk, But I am pretty sure I have... I will copy and paste my code directly here.. Maybe I have mistyped something, but I checked it a couple of times.


    Code:
    Imports System
    Imports System.Windows.Forms
    Imports MediaPortal.GUI.Library
    Imports MediaPortal.Dialogs
    
    Namespace MPInsertDVD
        Public Class Class1
            Inherits GUIWindow
            Implements ISetupForm
    
    
    
            Public Sub New()
            End Sub
    
            ' With GetID it will be an window-plugin / otherwise a process-plugin
            ' Enter the id number here again
            Public Overrides Property GetID() As Integer
                Get
                    Return 551
                End Get
                Set(ByVal value As Integer)
                End Set
            End Property
            ' Returns the name of the plugin which is shown in the plugin menu
            Public Function PluginName() As String
                Return "MP DVD Insert"
            End Function
            ' Returns the description of the plugin is shown in the plugin menu
            Public Function Description() As String
                Return "Media Portal - DVD Insert - Create Default Video File for DVD/BluRay Collection"
            End Function
            ' Returns the author of the plugin which is shown in the plugin menu
            Public Function Author() As String
                Return "Paul Rainbow"
            End Function
    
            ' show the setup dialog
            Public Sub ShowPlugin()
                MessageBox.Show("Nothing to configure, this is just an example")
            End Sub
    
            ' Indicates whether plugin can be enabled/disabled
            Public Function CanEnable() As Boolean
                Return True
            End Function
    
            ' Get Windows-ID
            Public Function GetWindowId() As Integer
                ' WindowID of windowplugin belonging to this setup
                ' enter your own unique code
                Return 551
            End Function
    
            ' Indicates if plugin is enabled by default;
            Public Function DefaultEnabled() As Boolean
                Return True
            End Function
    
            ' indicates if a plugin has it's own setup screen
            Public Function HasSetup() As Boolean
                Return True
            End Function
    
    
    
            ''' <summary>
            ''' If the plugin should have it's own button on the main menu of MediaPortal then it
            ''' should return true to this method, otherwise if it should not be on home
            ''' it should return false
            ''' </summary>
            ''' <param name="strButtonText">text the button should have</param>
            ''' <param name="strButtonImage">image for the button, or empty for default</param>
            ''' <param name="strButtonImageFocus">image for the button, or empty for default</param>
            ''' <param name="strPictureImage">subpicture for the button or empty for none</param>
            ''' <returns>true : plugin needs it's own button on home
            ''' false : plugin does not need it's own button on home</returns>
    
            Public Function GetHome(ByRef strButtonText As String, _
            ByRef strButtonImage As String, _
            ByRef strButtonImageFocus As String, _
            ByRef strPictureImage As String) As Boolean
                strButtonText = String.Empty
                strButtonImage = String.Empty
                strButtonImageFocus = String.Empty
                strPictureImage = String.Empty
                Return False
            End Function
    
        End Class
    End Namespace

    The other main thing I could see by the References... but they look fine to me.
    MediaPortalReferences.png



    Is there a reason to why you chose Visual Basic and not C#?
    Pilehave, I am just used to VB as it is the mainformat I have learnt.. I guess I just find it easier to ready/understand.
     

    charli181

    Retired Team Member
  • Premium Supporter
  • August 3, 2007
    800
    111
    Sydney
    Home Country
    Australia Australia
    Not sure if you resolved this yet, but the answer I found was to do add the implements to the end.

    Public Function Author() As String Implements ISetupForm.Author
    Return "Charli181"
    End Function
     

    ZippyRainbow

    Portal Member
    January 13, 2011
    7
    0
    Home Country
    No I hadn't resolved it. I will try your suggestion soon Charli

    Yes Charli, that was the fix.. I just needed to add " Implements ISetupForm.XYZ" to the end of each Function in the list. Maybe I don't understand VB.Net too much, but I am not sure why that isn't in the sample code.

    Now to actual test/change this function... might need to clone myself to find the time.
     

    Users who are viewing this thread

    Top Bottom