MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Community Skins and Plugins » Plugins


Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here.

Reply
 
Thread Tools Display Modes
Old 2006-05-23, 02:23   #1 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default VB.net

Ok, this is probably a stupid question but I did search and couldn't find an answer.

Is there a sample for developing a plugin in VB.net, is it even possible to do this?

I sure would appreciate to push in the right direction....

Thanks,
Richard
reverson1 is online now   Reply With Quote
Old 2006-05-23, 15:12   #2 (permalink)
Portal Member
 
Join Date: Jun 2005
Location: Norway
Posts: 199
Thanks: 1
Thanked 0 Times in 0 Posts


Default

I am pretty shure you can use any .net langue, but there is just a developing guide for c# that I know of.

http://www.team-mediaportal.com/arti..._a_plugin.html

pherhaps this plugin could be useful?
http://forum.team-mediaportal.com/viewtopic.php?t=9749
__________________
htpc- all in one.
aasmund Nordal is offline   Reply With Quote
Old 2006-05-23, 15:48   #3 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default

Thanks, got another question that I'm sure has already been answered. But I'm gonna ask it anyways

Do I have to compile Mediaportal in order to write a plugin for it or can I just use the current release and reference it that way?

Thanks
Richard
reverson1 is online now   Reply With Quote
Old 2006-05-23, 15:59   #4 (permalink)
Portal Developer
 
Join Date: Jan 2005
Age: 30
Posts: 3,451
Thanks: 90
Thanked 114 Times in 92 Posts


Default

Quote:
Originally Posted by reverson1
Thanks, got another question that I'm sure has already been answered. But I'm gonna ask it anyways

Do I have to compile Mediaportal in order to write a plugin for it or can I just use the current release and reference it that way?
No need to compile the MediaPortal.
__________________
http://day2.no-ip.org/

"Commy64 - The problem there is that Oprah was on. MP tried to save you by blanking the screen"
tourettes is offline   Reply With Quote
Old 2006-05-23, 21:00   #5 (permalink)
Portal Member
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


Default

I believe you should be able to write a plugin in any dot net enabled language. I started to create a vb.net version of the C# sample, but got side tracked.
slapout is offline   Reply With Quote
Old 2006-05-24, 01:28   #6 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default

I started working on converting the sample as well this morning. Hopefully I'll get to finish that part up when I get home tonight.

Considering I'm a vb6 kind of guy I'm sure I'll end up with some more questions along the way.

Thanks for the help so far, I really do appreciate it.
reverson1 is online now   Reply With Quote
Old 2006-05-24, 15:36   #7 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default

I've tried my best at converting the sample to vb.net. I'm no longer receiving any error messages, however the plugin still doesn't show up in MediaPortal. Can someone give me a clue as what is wrong with the following code?

Thanks,
Richard

Code:
Public Class Class1
    Inherits MediaPortal.GUI.Library.GUIWindow
    Implements MediaPortal.GUI.Library.ISetupForm
    Public Function PluginName() As String Implements MediaPortal.GUI.Library.ISetupForm.PluginName

        Return "MyFirstPlugin"

    End Function


    Public Function Description() As String Implements MediaPortal.GUI.Library.ISetupForm.Description

        Return "My First plugin tutorial"

    End Function


    Public Function Author() As String Implements MediaPortal.GUI.Library.ISetupForm.Author

        Return "Frodo"

    End Function



    Public Sub ShowPlugin() Implements MediaPortal.GUI.Library.ISetupForm.ShowPlugin

        MsgBox("Nothing to configure, this is just an example")

    End Sub


    Public Function CanEnable() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.CanEnable

        Return True

    End Function


    Public Function GetWindowId() As Integer Implements MediaPortal.GUI.Library.ISetupForm.GetWindowId

        Return 5678

    End Function


    Public Function DefaultEnabled() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.DefaultEnabled

        Return True

    End Function



    Public Function HasSetup() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.HasSetup

        Return True

    End Function



    Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements MediaPortal.GUI.Library.ISetupForm.GetHome

        strButtonText = String.Empty

        strButtonImage = String.Empty

        strButtonImageFocus = String.Empty

        strPictureImage = String.Empty

        Return False

    End Function
End Class
reverson1 is online now   Reply With Quote
Old 2006-05-25, 09:02   #8 (permalink)
Portal Member
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts


Default

Also implement MediaPortal.GUI.Library.IShowPlugin.

You also need these methods:
Code:
    Public Overrides Function Init() As Boolean
        Return Load(MediaPortal.GUI.Library.GUIGraphicsContext.Skin & "\<filename of skin xml file>")
    End Function

    Public Overrides Sub OnAction(ByVal action As MediaPortal.GUI.Library.Action)
        If action.wID = MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU Then
            MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow(MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_HOME)
            Exit Sub
        End If

        MyBase.OnAction(action)
    End Sub

    Public Overrides Function OnMessage(ByVal message As MediaPortal.GUI.Library.GUIMessage) As Boolean
        Select Case message.Message
            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_INIT
                'load any settings here and anything else that needs to be done when screen is shown
                MyBase.OnMessage(message)

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT
                'save any settings here

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED
'this is triggered when focus has changed on screen, use message.SenderControlId to find out which control

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_CLICKED
'this is triggered when a control on screen has been clicked, use message.SenderControlId to find out which control


            Case Else
                Return MyBase.OnMessage(message)
        End Select
    End Function
HTH

Sam
samuel337 is offline   Reply With Quote
Old 2006-05-25, 09:58   #9 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default

Thanks I'll check that out....
reverson1 is online now   Reply With Quote
Old 2006-05-25, 15:56   #10 (permalink)
Portal Member
 
Join Date: May 2006
Location: Williamsburg,VA
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post


Default

That worked like a champ, thanks!

And just to make this thread complete so maybe someone else who is looking for this can find it a little easier, here's the complete sample class for vb.net:

Code:
Public Class MediaPortalInterface
    Inherits MediaPortal.GUI.Library.GUIWindow
    Implements MediaPortal.GUI.Library.ISetupForm
    Public Function PluginName() As String _
	     Implements MediaPortal.GUI.Library.ISetupForm.PluginName

        Return "myFirstPlugin"

    End Function


    Public Function Description() As String _
	     Implements MediaPortal.GUI.Library.ISetupForm.Description

        Return "VB.net Sample Code"

    End Function


    Public Function Author() As String _
	     Implements MediaPortal.GUI.Library.ISetupForm.Author

        Return "SampleCoder"

    End Function



    Public Sub ShowPlugin() _
	     Implements MediaPortal.GUI.Library.ISetupForm.ShowPlugin

        msgbox "Nothing to configure."

    End Sub


    Public Function CanEnable() As Boolean _
	     Implements MediaPortal.GUI.Library.ISetupForm.CanEnable

        Return True

    End Function


    Public Function GetWindowId() As Integer _
	     Implements MediaPortal.GUI.Library.ISetupForm.GetWindowId

        Return 5678

    End Function

    Public Overrides Property GetID() As Integer
        Get
            Return GetWindowId()
        End Get
        Set(ByVal value As Integer)
        End Set
    End Property

    Public Function DefaultEnabled() As Boolean _
	     Implements MediaPortal.GUI.Library.ISetupForm.DefaultEnabled

        Return True

    End Function



    Public Function HasSetup() As Boolean _
	     Implements MediaPortal.GUI.Library.ISetupForm.HasSetup

        Return True

    End Function



    Public Function GetHome(ByRef strButtonText As String, _
	     ByRef strButtonImage As String, _
	     ByRef strButtonImageFocus As String, _
	     ByRef strPictureImage As String) As Boolean _
	     Implements MediaPortal.GUI.Library.ISetupForm.GetHome

        strButtonText = String.Empty

        strButtonImage = String.Empty

        strButtonImageFocus = String.Empty

        strPictureImage = String.Empty

        Return False

    End Function

    Public Overrides Function Init() As Boolean
        Return Load(MediaPortal.GUI.Library.GUIGraphicsContext.Skin & _
		        "\<filename>")
    End Function

    Public Overrides Sub OnAction(ByVal action As MediaPortal.GUI.Library.Action)

        If action.wID = _
            MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU Then
            MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow( _
		      MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_HOME)
            Exit Sub
        End If

        MyBase.OnAction(action)
    End Sub

    Public Overrides Function OnMessage( _
	      ByVal message As MediaPortal.GUI.Library.GUIMessage) As Boolean

        Select Case message.Message
            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_INIT
                'load any settings here and anything else 
                'that needs to be done when screen is shown 
                MyBase.OnMessage(message)

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT
                'save any settings here 

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED
                'this is triggered when focus has changed on screen, 
		          'use message.SenderControlId to find out which control 

            Case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_CLICKED
                'this is triggered when a control on screen has been clicked, 
		          'use message.SenderControlId to find out which control 


            Case Else
                Return MyBase.OnMessage(message)
        End Select
    End Function
End Class
reverson1 is online now   Reply With Quote
Reply

Bookmarks

Tags
vbnet

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to start writing your own plugin part 1 available frodo Plugins 61 2008-05-01 22:38
VB.NET Plugin Writing Tutorial samuel337 Plugins 6 2008-04-30 22:23
VB.Net PlugIn shrek Plugins 2 2005-11-09 00:30
Plugin for Napster with SOAP Anonymous Plugins 6 2004-11-04 15:18
NON-GUI plugin problem in MediaPortal interface - VB.NET Anonymous Plugins 3 2004-10-28 13:29


All times are GMT +1. The time now is 06:26.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress
Advertisement System V2.6 By   Branden