A little help ? (1 Viewer)

wizard123

Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #1
    Hi Guys

    I currently have the plugin template setup in visual studio and have complied then used inside mediaportal no problem. My question is how would i go about creating an image control that is available to be displayed in the home screen and displays whatever is set in the c# code plugin. A bit like displaying latest media from latestmediahandler.

    I've got to be honest the wiki is shoddy at best for examples in plugin code.

    Hopefully someone can give me some ideas.

    Thanks
     

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #2
    No one ? wow it's even quieter than i thought :eek:
     

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #4
    Thanks, i have scrolled through that source but found nothing that indicated what i'm after :( i'm sure it would only take a dev 10 minutes to put together what i want but have not found anyone willing to help :cry:
     

    mrj

    Portal Pro
    January 27, 2012
    251
    100
    Country flag
    Hi wizard
    You can try something like this

    In code
    GUIPropertyManager.SetProperty("#picture", "picturefile.jpg");


    in XML

    <control>
    <description>an Image</description>
    <type>image</type>
    <id>5</id>
    <posX>75</posX>
    <posY>370</posY>
    <texture>#picture</texture>
    </control>


    N.B
    NOT tested
    /mrj
     
    Last edited:

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #7
    Thank you both for the replies much apprieciated :)

    @Edalex i have added the example posted above but i get this error

    'MediaPortal.GUI.Library.GUIPropertyManager.SetProperty(string, string)' is a 'method' but is used like a 'type'

    Am i missing a reference ?
     

    Edalex

    Community Plugin Dev
  • Premium Supporter
  • January 3, 2008
    2,922
    1,228
    Saratov
    Russian Federation Russian Federation
    Country flag
    Nope, looks like you added this in the wrong place in code as your probably doing this outside the class.
    it should be like this as I think:
    C#:
    namespace MyPlugin
    {
        public class MyClass
        {
            public void SetProp
            {
            GUIPropertyManager.SetProperty("#picture", "picturefile.jpg");
            }
        }
    }
    You could attach your cs file to look at.
     

    mrj

    Portal Pro
    January 27, 2012
    251
    100
    Country flag
    Hi wizard
    add
    using MediaPortal.GUI.Library;
    if u haven't done so
     

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #10
    Nope, looks like you added this in the wrong place in code as your probably doing this outside the class.
    it should be like this as I think:
    C#:
    namespace MyPlugin
    {
        public class MyClass
        {
            public void SetProp
            {
            GUIPropertyManager.SetProperty("#picture", "picturefile.jpg");
            }
        }
    }
    You could attach your cs file to look at.
    It is literally the template code from wiki still at the moment

    Code:
    using System;
    using System.Windows.Forms;
    using MediaPortal.GUI.Library;
    using MediaPortal.Dialogs;
    using System.Threading.Tasks;
    using System.Linq;
    using System.Text;
    
    namespace AthenaPlugin
    {
        public class Class1 : GUIWindow, ISetupForm
        {
            [SkinControlAttribute(2)]
            protected GUIButtonControl buttonOne = null;
            [SkinControlAttribute(3)]
            protected GUIButtonControl buttonTwo = null;
    
            public void SetProp
            {
            GUIPropertyManager.SetProperty("#picture", "picturefile.jpg");
            }
    
            public Class1()
            {
    
            }
    
            #region ISetupForm Members
    
            // Returns the name of the plugin which is shown in the plugin menu
            public string PluginName()
            {
                return "AthenaPlugin";
            }
    
            // Returns the description of the plugin is shown in the plugin menu
            public string Description()
            {
                return "My First plugin tutorial";
            }
    
            // Returns the author of the plugin which is shown in the plugin menu
            public string Author()
            {
                return "Wizard123";
            }
    
            // 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 5678;
            }
    
            // 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 = PluginName();
                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 5678;
                }
    
                set
                {
                }
            }
    
            #endregion
    
            public override bool Init()
            {
                return Load(GUIGraphicsContext.Skin + @"\AthenaPlugin.xml");
            }
    
            protected override void OnClicked(int controlId, GUIControl control,
              MediaPortal.GUI.Library.Action.ActionType actionType)
            {
                if (control == buttonOne)
                    OnButtonOne();
                if (control == buttonTwo)
                    OnButtonTwo();
                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);
            }
    
        }
    
    }
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    M A little help with new install pls Installation, configuration support 3
    framug [solved] Interested with a little modification in your plugin ? My TVSeries 11
    Alberto83 The little non-definitive guide to video WASAPI General 8
    J Help with new grabber file. WebEPG 1
    J IPTV Sweden, need help with m3u list MediaPortal 1 Plugins 14
    wizard123 [solved] MP1 Build help MediaPortal 1 21
    D Please help with getting Schedules Direct to work Newcomers Forum 10
    U [solved] Beginner needs help recording live TV General 19
    A IPTV from https m3u8 urls - Help General 6
    mrmojo666 beginner: trying to write a plugin, need help to catch event General Development (no feature request here!) 3
    N Music player help Listen Music 4
    A Enigma2 receiver channels on Windows PC with Media Portal help General Support 0
    A Help! MP2 - DVB-T Not recognised (DRIVERS?) General 12
    milagroso Remote control with EventGhost - I'm stuck, need help General 3
    D Font size reduced. help. Skins and Plugins Installer (MPEI) 0
    S Gpu/hdtv/mp setup help please Newcomers Forum 3
    W Need help getting my TV guide working again General Support 1
    A I need help with 110 and 119 west Installation, configuration support 21
    A Need help rescaning Channels for 110 and 119 west MediaPortal 1 Talk 2
    C EPG-Buddy: so close to no help needed Electronic Program Guide 8
    mjmapi Help, getting My TVSeries 16
    F Setup Help General 1
    S [solved] Alright, I need help with BD ISO's Newcomers Forum 19
    B pls help. tv stops playing but resumes if I push pause and play General 0
    TLD Help setting up HVR-1955 remote & blaster on MP Remotes 20
    Top Bottom