NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 64 65 66 67 68 … 93 Next »
When is a plugin constructor called?

 
  • 0 Vote(s) - 0 Average
When is a plugin constructor called?
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#1
2005-11-23, 11:26 PM
Well - I know that a constructor is called when an instance of an object is created but how does this apply to plugins?

I'm trying to work out where I should initialize various components, process the skin.xml, etc. etc. I'm currently doing this in the Activate method but that doesn't seem right - I have to use 'keep-alive' type flags to prevent Activate from re-initialising stuff if I exit the plugin then go back in. At the same time, I don't want my plugin to do a whole load of stuff every time the gbpvr main app. is started (if that is when the constructor is called).

Slightly confused.

Cheers,
Brian
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#2
2005-11-23, 11:33 PM
The constructor is called when GBPVR starts if the plugin is being loaded. Putting a lot of stuff in here can slow down the start up of GBPVR. This is why a few people use the activate method since it's called when you actually use it.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#3
2005-11-23, 11:39 PM
activate is called whenever the plugin is activated, ie when you enter it
deactivate is the reverse

so yeah just throw everything in the constructor, it will slow down gbpvr load time, but wont slow gbpvr when you are actually using it (which is the important thing).
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,676
Threads: 767
Joined: Nov 2003
#4
2005-11-23, 11:59 PM
I do my initialization the first time activate is called. Its much friendlier to the resources used by the system.

Code:
public void Activate()
{
    if (!initialized)
    {    
        initialized = true;
        initialize();
    }
    ...
}
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#5
2005-11-24, 12:39 AM
Thanks guys for confirming what I think I thought I might have understood. Smile

sub - have you thought about adding an Initialize method and Initialized property to IMenuTask?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,676
Threads: 767
Joined: Nov 2003
#6
2005-11-24, 12:58 AM
Quote:sub - have you thought about adding an Initialize method and Initialized property to IMenuTask?
Yes, but I hate breaking compatibility with things, so I probably wont.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP plugin for Kodi sgilani 2 2,800 2022-10-17, 12:44 AM
Last Post: sgilani
  New Systems Plugin kirschey 10 3,340 2020-11-14, 08:01 PM
Last Post: sub
  VIdeo playback from plugin mvallevand 5 3,448 2015-08-06, 10:43 PM
Last Post: sub
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,892 2014-11-14, 02:05 AM
Last Post: Benoire
  API docs to help with plugin development? McBainUK 3 2,766 2013-06-08, 06:14 PM
Last Post: sub
  Refreshing TV Guide Data (after System plugin EPG update) imilne 13 6,070 2013-03-24, 08:03 PM
Last Post: imilne
  sabnzbd plugin to show processed files Wakalaka 1 1,944 2013-03-12, 06:48 AM
Last Post: psycik
  Plugin problems with started from the command line mvallevand 11 4,970 2012-08-12, 07:56 PM
Last Post: sub
  GetRenderList() always called with "block-extras..." element in renderlist alibert 1 1,612 2012-06-18, 10:24 AM
Last Post: sub
  Get NextPVR data directory from outside a plugin McBainUK 3 2,236 2012-02-11, 05:42 PM
Last Post: mvallevand

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

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

Linear Mode
Threaded Mode