Page 2 of 8 FirstFirst 1234 ... LastLast
Results 11 to 20 of 78

Thread: Plugins and NPVR. Where do we start?

  1. #11
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    89,988
    Quote Originally Posted by Ommina View Post
    Hm. Am I required to inherit from NUtility.Base.SimpleButtonPlugin or NUtility.Base.NewStyleButtonListPlugin ?
    No, you're not requrired to use those base classes, but they are there to make things easier for you. You can instead implement a plugin that implements IScreenPlugin, and implement all the methods (like GetRenderList() etc).

    I'm not seeing any other place with a .GetSkinHelper() -- IScreenPlugin doesn't have it.
    IScreenHelper is an interface that the application calls to interact with all plugins. The application never calls GetSkinHelper() on a plugin. This is just something the bases classes were doing internally within the plugin. You dont have to have an equivalent if you implement IScreenHelper. In fact, a plugin doesnt even need to use the skinhelper if it doesnt want to. If you were implementing a IScreenPlugin from scratch, I'd expect you probably would have a SkinHelper member variable, and would probably initialise it the first time the application calls Activate() on your plugin.

  2. #12
    Join Date
    Dec 2004
    Location
    West Yorkshire, UK
    Posts
    4,543
    Quote Originally Posted by Ommina View Post
    Hm. Am I required to inherit from NUtility.Base.SimpleButtonPlugin or NUtility.Base.NewStyleButtonListPlugin ? I'm not seeing any other place with a .GetSkinHelper() -- IScreenPlugin doesn't have it.

    Or am I missing something obvious - again ?
    Both classes implement IScreenPlugin. If your plugin class implements IScreenPlugin directly you'd have to create your own SkinHelper object. Much easier to use an existing plugin base class.

    EDIT: ....and sub gets there first yet again.

  3. #13
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    89,988
    Too slow my friend, too slow...

  4. #14
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    330
    So - is there any provision for left/right scrolling of the (new style) buttons?

    One limitation that I've quickly hit against is that the new style allows very few buttons. Far fewer than I need.

    Thinking aloud, I suppose I can simulate the scrolling myself... although all buttons would then have to be a fixed width, which is somewhat unattractive.

    Any suggestions or alternate solutions for dealing with having more buttons than space?

  5. #15
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    89,988
    Quote Originally Posted by Ommina View Post
    So - is there any provision for left/right scrolling of the (new style) buttons?

    One limitation that I've quickly hit against is that the new style allows very few buttons. Far fewer than I need.

    Thinking aloud, I suppose I can simulate the scrolling myself... although all buttons would then have to be a fixed width, which is somewhat unattractive.

    Any suggestions or alternate solutions for dealing with having more buttons than space?
    There is nothing built in that'll do that currently. You can squeeze in about 5 or 6 buttons by lengthing the buttonstrip background in the skin file though.

  6. #16
    Join Date
    Feb 2008
    Location
    Scotland, UK
    Posts
    2,420
    Just getting starting with my first ever plugin, an attempt at duplicating the "System" functionality from GBPVR into nPVR...

    Can I ask a hopefully simple question: how do I popup a message dialog? I need to do one with a basic "ok" option, and one with the usual "are you sure yes/no" options.

    I've found PluginHelperFactory.GetPluginHelper().ShowMessage( ) in the examples, but that just seems to overlay a graphic (which would be fine for a simple message) but I see no way to get rid of it again (quickly).

    Iain

  7. #17
    Join Date
    Nov 2006
    Location
    Louisville, KY, USA
    Posts
    7,870
    Calling PluginHelperFactory.GetPluginHelper().ShowMessage( "") or PluginHelperFactory.GetPluginHelper().ShowMessage( string.Empty) will get rid of the message popup.

  8. #18
    Join Date
    Feb 2008
    Location
    Scotland, UK
    Posts
    2,420
    Quote Originally Posted by whurlston View Post
    Calling PluginHelperFactory.GetPluginHelper().ShowMessage( "") or PluginHelperFactory.GetPluginHelper().ShowMessage( string.Empty) will get rid of the message popup.
    Cheers.

    So far I've managed to get all the main options implemented, including the Update EPG. At least I think I have - I'm doing it all in a VM with no tuners so can't be sure :-)

    Next is to figure out how to display text and/or draw to the display itself. I'm a Java programmer by day so this is all new to me...

    Iain

  9. #19
    Join Date
    Feb 2008
    Location
    Scotland, UK
    Posts
    2,420
    Ok, my next question...

    I've found two ways so far of displaying an image. I can either create a UiElement object and add it to the render list, or I can define an <image> element in the skin.

    The latter looks like the preferred way of doing it, because it'll be easier to tweak positions and sizes etc?

    The image I want to use will be custom generated. I'm making a Bitmap object, and drawing to its Graphics. But how can I match its size to what will appear on screen?

    If I don't set fixedAspectRatio=true in the skin then it gets scaled to fit (and looks messy). If I do set it, then the image appears perfectly, but obviously I need to match sizes. So is there a way to convert from skin co-ordinates into usable width and height values for the Graphics object?

    Thanks

    Iain

    (please jump in stop me at any time if it looks like I'm doing things the stupid way)

  10. #20
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    89,988
    I'm not at home to give you an example at the moment, but I'd generally use a UiStatic, and pass in the name of an Element in the skin file. That Element can define an <Image> to be drawn. In the args to the UiStatic, pass in something like args["@previewImage"] = this;, and implement the SkinHelper.IGetImageCallback() interface. This way your GetImage(width, height) method will be called when it needs that image, and it'll pass you the image size in pixels etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •