The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

Getting PropertyChanged events in an add-in

Last post 11-07-2011, 3:36 PM by evorgevol. 4 replies.
Sort Posts: Previous Next
  •  01-06-2009, 6:05 PM 8783

    Getting PropertyChanged events in an add-in

    Has anyone had problems or experience with getting your PropertyChanged event handler called in an add-in?

    I'm writing an add-in for Media Center using the managed code object model. I'm trying to get events from Media Center. I attached handlers to the PropertyChanged events but it seems that they are never called when the object changes. For example, the handler seem to never get called in

    MediaCenterEnvironment.MediaExperience.PropertyChanged +=new PropertyChangedEventHandler(MediaExperience_PropertyChanged);

    I've also attached handlers to MCE.ME.Transport.PropertyChanged, AddInHost.PropertyChanged, and any similar objects that MC passes in to the add-in, but the handlers don't get called when things change.

    I do know that the add-in is alive and running the whole time. If I put in a timer to query for changes that I can get the changed data (but I don't want to poll for changes; I should be notified when changes happen).

    I'm using the latest MC SDK and VS2008 on Vista Sp1 (and not using Fiji/TV Pack 2008)

    Thanks for any help or pointers to more information.
  •  01-07-2009, 12:13 AM 8785 in reply to 8783

    Re: Getting PropertyChanged events in an add-in

    I think the problem is that MediaExperience object and the Transport Object both change when the content changes (e.g. switch from music to tv, or from one tv recording to another), so you'd need to re-subscribe to the event when the object is changed.

    Try adding a PropertyChanged to MediaCenterEnvironment and see what you get from that - if you get a PropertyChanged event with "MediaExperience" as the property, re-attach to the new MediaExperience.

    Cheers,
    Andrew

  •  01-07-2009, 12:14 AM 8786 in reply to 8785

    Re: Getting PropertyChanged events in an add-in

    Forgot to add, PropertyChanged events get called on the application thread.  If your addin is a background addin, it blocks the application thread in the Launch method, so you won't get any PropertyChanged events firing.

    Cheers,
    Andrew

  •  01-12-2009, 12:19 PM 8805 in reply to 8786

    Re: Getting PropertyChanged events in an add-in

    This is really helpful. Thanks a bunch!

  •  11-07-2011, 3:36 PM 10143 in reply to 8786

    Re: Getting PropertyChanged events in an add-in

    Hi AndyC,

    I've just stumbled across this topic. Not even sure if you'll see this reply! I've been trying for *ages* to attach to the PropertyChanged from a background addin. I had absolutely no idea that it wouldn't fire.

    Is there any way of getting it to fire in a background addin? I really need to be able to attach to it!

    Cheers,

    evorgevol

    EDIT: Just found this which I'll try later...
    http://damianblog.com/2008/05/20/creating-msas-sinks-in-c/
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems