Hey im new to plugin development and trying to just get to grips with it but im having some issues displaying a list (other controls work fine..), See below for the skin xml, the class.cs file and the attached screenshot of it in action. The button works and displays the alert fine. I also checked the log files and there are no errors (well not related to me anyway some weather error). Please help
skin xml file:
Class file code:
skin xml file:
Code:
<window>
<id>1289</id>
<defaultcontrol>2</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<controls>
<control>
<description>an Image</description>
<type>image</type>
<id>5</id>
<posX>75</posX>
<posY>370</posY>
<texture>hover_my videos.png</texture>
</control>
<control>
<description>text label</description>
<type>label</type>
<id>1</id>
<posX>250</posX>
<posY>70</posY>
<label>Some text</label>
<font>font16</font>
<align>right</align>
<textcolor>ffffffff</textcolor>
</control>
<control>
<description>Try Me</description>
<type>button</type>
<id>2</id>
<posX>60</posX>
<posY>97</posY>
<label>Try Me</label>
<onleft>2</onleft>
<onright>2</onright>
<onup>2</onup>
<ondown>3</ondown>
</control>
<control>
<description>listing</description>
<type>listcontrol</type>
<id>400</id>
<posX>60</posX>
<posY>131</posY>
<height>500</height>
<width>100</width>
<onleft>2</onleft>
</control>
</controls>
</window>
Class file code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;
using MediaPortal.Common.Utils;
[assembly: CompatibleVersion("1.1.6.27644")]
[assembly: UsesSubsystem("MP.SkinEngine")]
[assembly: UsesSubsystem("MP.Config")]
namespace MPTest
{
public class MPTest : GUIWindow, ISetupForm
{
[SkinControlAttribute(2)]
protected GUIButtonControl buttonOne = null;
[SkinControlAttribute(400)]
protected GUIListControl guiList = null;
public override bool Init()
{
return Load(GUIGraphicsContext.Skin + @"\MPTest.xml");
}
public virtual void OnPageLoad()
{
GUIListItem itemOne = new GUIListItem("Hello 1");
GUIListItem itemTwo = new GUIListItem("Hello 2");
GUIListItem itemThree = new GUIListItem("Hello 3");
guiList.ListItems.Add(itemOne);
guiList.ListItems.Add(itemTwo);
guiList.ListItems.Add(itemThree);
}
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
{
if (control == buttonOne)
OnButtonOne();
base.OnClicked(controlId, control, actionType);
}
private void OnButtonOne()
{
GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading("Button has been pressed");
dlg.SetLine(1, "You pressed button 1");
dlg.SetLine(2, String.Empty);
dlg.SetLine(3, String.Empty);
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
private void OnButtonTwo()
{
GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading("Button has been pressed");
dlg.SetLine(1, "You pressed button 2");
dlg.SetLine(2, String.Empty);
dlg.SetLine(3, String.Empty);
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
#region ISetupForm Members
// Returns the name of the plugin which is shown in the plugin menu
public string PluginName()
{
return "MPTest";
}
// Returns the description of the plugin is shown in the plugin menu
public string Description()
{
return "Media Portal Test plugin";
}
// Returns the author of the plugin which is shown in the plugin menu
public string Author()
{
return "Piercy";
}
// show the setup dialog
public void ShowPlugin()
{
MessageBox.Show("Nothing to configure, this is just an example");
}
// Indicates whether plugin can be enabled/disabled
public bool CanEnable()
{
return true;
}
// Get Windows-ID
public int GetWindowId()
{
// WindowID of windowplugin belonging to this setup
// enter your own unique code
return 1289;
}
// Indicates if plugin is enabled by default;
public bool DefaultEnabled()
{
return true;
}
// indicates if a plugin has it's own setup screen
public bool HasSetup()
{
return true;
}
/// <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 bool GetHome(out string strButtonText, out string strButtonImage,
out string strButtonImageFocus, out string strPictureImage)
{
strButtonText = String.Empty;
strButtonImage = String.Empty;
strButtonImageFocus = String.Empty;
strPictureImage = String.Empty;
return true;
}
// With GetID it will be an window-plugin / otherwise a process-plugin
// Enter the id number here again
public override int GetID
{
get
{
return 1289;
}
set
{
}
}
#endregion
}
}