NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 40 41 42 43 44 … 93 Next »
v1.x BaseButtonListUiTask plugin/skin question

 
  • 0 Vote(s) - 0 Average
v1.x BaseButtonListUiTask plugin/skin question
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#1
2007-07-31, 12:09 PM
I'm developing (slowly, never enough free time) a video-playing plugin using the 'Hello' plugin example (using BaseButtonListUiTask) as the basis. I'm having trouble figuring out how the various CompositeImage definitions in the skin file map onto stuff in the code.

If one item in the list-view (in details mode) represents a folder, what makes it use the "DetailsViewNormalFolder" or "DetailsViewSelectedFolder" rather than the "DetailsViewNormalItem" image? Put another way, how do I tell the list (UiList object) that a specific item is a folder item and not just a file (for example)?

On a slightly related note, is it ok to override the base class GetRenderList(), and just tack some extra elements of my own onto the end of the render list returned by the base class? I'm hoping I don't need to override render() as well.

cheers

Dronny
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#2
2007-07-31, 04:05 PM
There is two types of objects you can put into the item list, either the UiList.Item or UiList.Container. UiList.Container objects will render using the "Folder" composite images.

In the ActivateItem() call you can do something like:
Code:
public override void ActivateItem(object o)
        {
            if (o is UiList.Container)
            {
                // change directory (looking at whatever property holds the folder name)
                UiList.Container container = (UiList.Container)o;
                string folder = (string)container.properties["@folderName"];
                ...
            }
            else (o is UiList.Item)
            {
                // user is trying to play file
                UiList.Item item = (UiList.Item)o;
                string fileName = (string)item.properties["@path"];
                ...
            }

Quote:On a slightly related note, is it ok to override the base class GetRenderList(), and just tack some extra elements of my own onto the end of the render list returned by the base class? I'm hoping I don't need to override render() as well.
Yes, that should be alright. render() is no longer used, just there for backward compatibility.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#3
2007-08-01, 10:33 AM
Cool! Now I get it -- I had wondered if there was some ctor param to Item but I didn't know about the container thing. I'll give it a blast when I get home.

thanks for the prompt and detailed response!!

Dronny
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#4
2007-09-01, 04:48 PM
I finally got round to trying this, and can't get it working...

I'm using the BaseButtonListUiTask base class to implement a 'video library' type of plugin, everything I'm doing is working fine, but I want to add an extra element (a kind of status indicator) to the main screen of my plugin.

So, I added a Placement and a CompositeImage to my skin file, and then added a new GBPVRUiElement to my plugin class.

If I actually instantiate the element, using the values from my skin (or indeed, just loading an image and providing a simple rectangle in code), my plugin then crashes in GetRenderList(). Whether I override GetRenderList() or not, without even trying to add my element to the render-list, it always crashes like so:-

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at GBPVRX2.BaseButtonListUiTask.GetRenderList()
at GBPVRX2.MenuTask.xd2a3a83a17aec615.GetRenderList()
at GBPVRX2.x0061b801bdf12d35.xdb012c437aec4a40(Boolean xd23bf32f3b17e3be)
at GBPVRX2.x0061b801bdf12d35.xf11d09f6e9e3e55b()
at GBPVRX2.xdd215986d9a64c86.ReturnToMainMenu()
at GBPVRX2.x0061b801bdf12d35.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I guess I must be doing something dumb, but I can't figure it out... any ideas? The only code I've added to deal with this in my Initialise() method, where I create a new element like so:-

Code:
Hashtable args = new Hashtable();
       args["@message"] = "Status";
       this.statusElement = new GBPVRUiElement("status",
                    this.skinHelper2.getPlacementRect("StatusIndicator"),
                    this.skinHelper2.getNamedImage("DV_Status",args));

BTW I'm using 1.0.16 PVRX2 in case its important.
Ton
Offline

Member

Posts: 233
Threads: 16
Joined: Aug 2005
#5
2007-09-02, 12:11 AM
Hi,

I had the same problem myself... Could be one of two things:

1. You'ce got a type in naming between the skin-file and the arguments in the Skinhelper2 calls...

2. I have instantiated my own SkinHelper2 object to do things (and this may be what you need to do), like this:

Code:
mySkinHelper = new SkinHelper2(getSkinSubdirectory() + "\\skin.xml");

            statusInfo = new GBPVRUiElement("status", mySkinHelper.getPlacementRect("StatusInfo"), mySkinHelper.getNamedImage("StatusInfo", new Hashtable()));
//Ton
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#6
2007-09-02, 10:14 AM
Ton -- thanks, you're a star, mate! It now works, it was needing to create my own SkinHelper2 that did it.

Nice one!

cheers

Dronny
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#7
2007-09-14, 08:49 AM
Continuing my own thread again...

I've got my video playing plugin working nicely, beta testing it on the main family PVR system in the living room, they are happy! Which is all cool, but...

I extended my plugin to implement IEventNotification, and implemented the Notify() method, which duly gets called back whenever a video stops playing (the specific event I'm looking for) and all that. However, inside the Notify() method, all my instance variables (members) are null! Even the ones from the base class! Roughly speaking, its like this:-

Code:
public class DronnyVideosPlugin : BaseButtonListUiTask, IUiPopupCallback, IEventNotification
{
  // implementation details...
  private string s;

  private void Activate()
  {
     this.s = "foo";
  }

  void IEventNotification.Notify(EventTypes eventType, string s)
  {
    // Amazingly, any of the instance variables seem to be NULL
    // in this function when it gets called back! even uiList which
    // belongs to the BaseButtonListUiTask class
    Log(this.s); // <-- causes NullRefException!!!! even though I set it in another method!
  }
}

Now, I've done a fair bit of C# development at work, but I've never come across anything like this before! I am currently at a complete loss to explain this strange behaviour. Perhaps its a quirk of C# but its almost like a C++ type of thing where your class is cast to the wrong type and your 'this' pointer is pointing to the wrong place, or something. I didn't think this could happen in C#.

Any ideas?????

Dronny
Ton
Offline

Member

Posts: 233
Threads: 16
Joined: Aug 2005
#8
2007-09-14, 01:21 PM
Well...

It almost looks like this is a static mathod being called (from sub's code)...

What I would try is to use static class member-variables to see if you can read / set those...
//Ton
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#9
2007-09-14, 01:44 PM
Ah-ha! You're right, it seems as if setting a static variable in my plugin class helps. In the Notify() method, I can see the value of the static, so that's one way of getting there, I suppose. Thing is, I really want to do some stuff in that callback, and without a 'this' I can't do it. I guess I could set another static variable, and look at it in some other methods.

What I'd really want to do is post a message to my plugin somehow, so it could be handled asynchronously.

Aside from this, I still don't get why my 'this' is apparently broker inside that Notify() method. I didn't think you could have static methods in an interface -- I still have no idea why this problem occurs.

Anyway, thanks for the hints, Ton -- I'll be sure to let you know if I figure what's really going on here.

cheers

Dronny.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#10
2007-09-14, 05:05 PM
Because GB-PVR wasnt expecting these interfaces to be implemented on the same class, then it is creating a new instance of your class, not the same instance that was used for the IMenuTask, so you'll find it has a 'this' but not the same 'this'.

(I would have liked to have changed this a long time back, but cant because it would break a lot of plugins.)
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP plugin for Kodi sgilani 2 3,027 2022-10-17, 12:44 AM
Last Post: sgilani
  Web API only_new Question Gazavant 6 2,787 2021-04-04, 06:54 PM
Last Post: sub
  New Systems Plugin kirschey 10 3,515 2020-11-14, 08:01 PM
Last Post: sub
  Another Artwork question scJohn 15 8,371 2019-09-10, 05:33 PM
Last Post: nonob
  Skin help (correct location?) SFX Group 4 3,940 2018-01-24, 07:42 AM
Last Post: pBS
  WEB API GuidService/Listing question(s) scJohn 6 4,398 2017-08-09, 02:18 PM
Last Post: scJohn
  skin question pBS 2 3,378 2016-06-18, 07:03 PM
Last Post: pBS
  VIdeo playback from plugin mvallevand 5 3,609 2015-08-06, 10:43 PM
Last Post: sub
  Skin - view further into the future, scale the guide Vitenka 5 3,367 2014-11-26, 07:28 PM
Last Post: Vitenka
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,987 2014-11-14, 02:05 AM
Last Post: Benoire

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode