views:

47

answers:

1

I am using a Hauppauge HD-PVR with Windows 7 Media Center (using DVBLink to connect them). I'd like to write a small application to check if the system is currently recording and if not perform some action. Which classes do I use to get this status? I've read the docs but the solution is not immediately obvious to me. Thanks!

A: 

You can use this: In the namespace Microsoft.MediaCenter.Samples.MediaState.MediaState

(MediaState) ms=new MediaState();

ms.Connect();

if(ms.Active == true) {
    Console.Writeline("MediaState Active");
}
else  {
    Console.Writeline("MediaState NOT Active");
}

Note that that this will always return false even though it works, I've included this to make this point so you dont get hung up on its returning false and not carry on....;-)

Then wire up the response event

ms.OnMSASEvent += new MSASEventHandler(ms_OnMSASEvent);


private void ms_OnMSASEvent(object state, MediaStatusEventArgs args)
      {
    MediaState typedState = (MediaState) state;

    string _Out = "     " + args.Session.ToString() + " " +     args.SessionID.ToString() + " " + args.Tag.ToString()  + args.Value.ToString();

    Console.Writeline(_Out);
       }

Which will show all events that occur on the media center.

There are more specific events. In the same class there is a namespace TVRECORDING which allow you to monitor specifc events.

Hope this helps.... Shout if I can help more...

JohnnyJP
Hi, Did this help you?
JohnnyJP