Plugin Newbie - Simply Trying to Replicate the First Example Error

Discussion in 'General Development (no feature request here!)' started by ZippyRainbow, January 18, 2011.

  1. ZippyRainbow

    ZippyRainbow Portal Member

    Joined:
    January 13, 2011
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 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
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. jameson_uk
    • Team MediaPortal

    jameson_uk Retired Team Member

    Joined:
    January 27, 2005
    Messages:
    7,258
    Likes Received:
    2,228
    Gender:
    Male
    Occupation:
    Data Warehousing Consultant
    Location:
    Birmingham
    Ratings:
    +2,403 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    The error suggests you have not copied the full code.

    It is saying that
    Code (Text):
    1. Public Function Author() As String
    2.   Return "YourNameHere"
    3. End Function
    has not been implemented in class1
     
  4. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    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 :)
     
  5. ZippyRainbow

    ZippyRainbow Portal Member

    Joined:
    January 13, 2011
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 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 (Text):
    1. Imports System
    2. Imports System.Windows.Forms
    3. Imports MediaPortal.GUI.Library
    4. Imports MediaPortal.Dialogs
    5.  
    6. Namespace MPInsertDVD
    7.     Public Class Class1
    8.         Inherits GUIWindow
    9.         Implements ISetupForm
    10.  
    11.  
    12.  
    13.         Public Sub New()
    14.         End Sub
    15.  
    16.         ' With GetID it will be an window-plugin / otherwise a process-plugin
    17.         ' Enter the id number here again
    18.         Public Overrides Property GetID() As Integer
    19.             Get
    20.                 Return 551
    21.             End Get
    22.             Set(ByVal value As Integer)
    23.             End Set
    24.         End Property
    25.         ' Returns the name of the plugin which is shown in the plugin menu
    26.         Public Function PluginName() As String
    27.             Return "MP DVD Insert"
    28.         End Function
    29.         ' Returns the description of the plugin is shown in the plugin menu
    30.         Public Function Description() As String
    31.             Return "Media Portal - DVD Insert - Create Default Video File for DVD/BluRay Collection"
    32.         End Function
    33.         ' Returns the author of the plugin which is shown in the plugin menu
    34.         Public Function Author() As String
    35.             Return "Paul Rainbow"
    36.         End Function
    37.  
    38.         ' show the setup dialog
    39.         Public Sub ShowPlugin()
    40.             MessageBox.Show("Nothing to configure, this is just an example")
    41.         End Sub
    42.  
    43.         ' Indicates whether plugin can be enabled/disabled
    44.         Public Function CanEnable() As Boolean
    45.             Return True
    46.         End Function
    47.  
    48.         ' Get Windows-ID
    49.         Public Function GetWindowId() As Integer
    50.             ' WindowID of windowplugin belonging to this setup
    51.             ' enter your own unique code
    52.             Return 551
    53.         End Function
    54.  
    55.         ' Indicates if plugin is enabled by default;
    56.         Public Function DefaultEnabled() As Boolean
    57.             Return True
    58.         End Function
    59.  
    60.         ' indicates if a plugin has it's own setup screen
    61.         Public Function HasSetup() As Boolean
    62.             Return True
    63.         End Function
    64.  
    65.  
    66.  
    67.         ''' <summary>
    68.         ''' If the plugin should have it's own button on the main menu of MediaPortal then it
    69.         ''' should return true to this method, otherwise if it should not be on home
    70.         ''' it should return false
    71.         ''' </summary>
    72.         ''' <param name="strButtonText">text the button should have</param>
    73.         ''' <param name="strButtonImage">image for the button, or empty for default</param>
    74.         ''' <param name="strButtonImageFocus">image for the button, or empty for default</param>
    75.         ''' <param name="strPictureImage">subpicture for the button or empty for none</param>
    76.         ''' <returns>true : plugin needs it's own button on home
    77.         ''' false : plugin does not need it's own button on home</returns>
    78.  
    79.         Public Function GetHome(ByRef strButtonText As String, _
    80.         ByRef strButtonImage As String, _
    81.         ByRef strButtonImageFocus As String, _
    82.         ByRef strPictureImage As String) As Boolean
    83.             strButtonText = String.Empty
    84.             strButtonImage = String.Empty
    85.             strButtonImageFocus = String.Empty
    86.             strPictureImage = String.Empty
    87.             Return False
    88.         End Function
    89.  
    90.     End Class
    91. End Namespace
    The other main thing I could see by the References... but they look fine to me.
    [​IMG]


    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.
     
  6. charli181
    • Team MediaPortal

    charli181 Retired Team Member

    Joined:
    August 3, 2007
    Messages:
    794
    Likes Received:
    53
    Gender:
    Male
    Occupation:
    computer telephony integration senior specialist
    Location:
    Sydney
    Ratings:
    +54 / 0
    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
     
  7. ZippyRainbow

    ZippyRainbow Portal Member

    Joined:
    January 13, 2011
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 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 Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!