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

Real Help for Noobs

Last post 04-09-2007, 3:29 PM by IgnoranceIsBliss. 11 replies.
Sort Posts: Previous Next
  •  04-07-2007, 10:27 PM 2348

    Real Help for Noobs

    Okay, after becoming infuriated with the "help" (or lack thereof) that I am trying to get on relatively simple things, I was thinking about starting a "real" help guide to MCML and C# together.

    At the moment, I have three samples that I could start with, but I wanted to know if this would be something people were interested in.  It would aso be nice if people would like to submit samples of their own.

    This guide would include FULL code examples (you know, the ones you can copy+paste, and have them work) instead of snippets or generalized "Well, to get data from C# to MCML, you just send the data accross" (Yeah, real helpful).

    Please reply if you are interested, as the amount of response would dictate if I would do this or not even bother wasting my time on it.
  •  04-08-2007, 12:31 PM 2352 in reply to 2348

    Re: Real Help for Noobs

    Yeah, well you know I'm with you.


    Gordon: Has reached the end!
  •  04-08-2007, 12:51 PM 2353 in reply to 2352

    Re: Real Help for Noobs

    If it was in the "CodeProject" style but for Media Center I would be interested.

    Cheers,
    Andrew

  •  04-08-2007, 3:21 PM 2360 in reply to 2348

    Re: Real Help for Noobs

    if it's in plain english i'm in. 

    this is taken from Stephen Toub's msdn page from this (thanks gordon):  http://msdn.microsoft.com/smartclient/default.aspx?pull=/library/en-us/dnxpmce/html/positionchangeraddin.asp

     

    "When ehshell is launched and finds a registered background add-in, it creates a new application domain in the process in which to host that particular add-in. Since an assembly cannot be unloaded from an application domain, the only way to unload an assembly from a process is to unload all application domains in which that assembly is loaded."       wtf???

     

    he means well, but to me, it's confusing.

     

     

  •  04-08-2007, 11:31 PM 2371 in reply to 2360

    Re: Real Help for Noobs

    I'll try and translate:

    All .NET Framework code runs in an application domain - it's a mechanism to create a defined boundary so that one bit of code can be kept away from another.   Media Center prior to MCE2005 Update Rollup 2 used this approach to allow add-ins to be loaded into the Media Center process, but to not allow them direct access to the MCE code.   The reason for this was (apart from the security) to allow add-ins to be loaded and unloaded as described by Stephen - once your add-in has completed, Media Center throws your add-in assembly away to save memory and generally tidies things up a bit.   The downside of this approach is that while they are in their own application domain, they are still within the main process, and if your program crashes badly, it brings the whole of MCE down.

    With MCE2005 Update Rollup 2, add-ins were moved out of the main Media Center process space intot their own process (called ehExtHost.exe) which communicates with MCE using .NET Remoting over "Named Pipes" (called IPC within .NET).   The advantage of this approach is that the main MCE process runs indepently, and can operate a "crash detection" routine to make sure your add-in is still working.  If it isn't you get the "add-in has stopped responding and you will be returned..." message.   The process can then be killed off, and everything is back to normal.

    If you want to learn more about Application Domains see: http://msdn2.microsoft.com/en-us/library/yb506139(vs.80).aspx

    For .NET Remoting, see Ingo Rammer's book "Advanced .NET Remoting", his website at http://www.thinktecture.com/ or MSDN at http://msdn2.microsoft.com/en-us/library/kwdt6w2k(vs.80).aspx

    Something key to remember with Media Center development: it's a superset of .NET Framework development in general, for which there's a wealth of information out there.  First port of call for anything you don't understand should be MSDN; if that doesn't help, then try Google or a development specific website like CodeProject (www.codeproject.com)

    Cheers,
    Andrew

  •  04-09-2007, 12:46 AM 2376 in reply to 2353

    Re: Real Help for Noobs

    AndyC:
    If it was in the "CodeProject" style but for Media Center I would be interested.

    I feel stupid, the first time I read through this, I was unsure of what you meant.  Yes, a CodeProject style would be great, it's a great source of information and example.

    Being new to the Sandbox, I don't even know who is running this forum (I see MS on the copyright).  Are there any mods?  Who could we talk to, to get the CodeProject style implemented?
  •  04-09-2007, 1:18 AM 2377 in reply to 2376

    Re: Real Help for Noobs

    The forum is run by the guys in the MCE platform team as an add-on to an already busy day job - I think that their hope was a groundswell of MCE developers would end up helping each other as the platform team just aren't going to have the time (similar to the myriad sites available for Windows development).   There just don't seem to be as many people out there yet as needed to make it work.

    I was thinking about a separate site that runs like a knowledge base rather than a community forum - unless the forum software can already handle that kind of thing (I don't know).

    Cheers,
    Andrew

  •  04-09-2007, 6:26 AM 2385 in reply to 2377

    Re: Real Help for Noobs

    It took me quite a few reads and a lot of experimentation (which as AndyC pointed out is painful) to try and get the idea.

    What I figured out from a naive noob viewpoint is that media center loads the addin, calls launch and as soon as launch is finished, which is immediately if its empty, it is uninstalled and the resources reclaimed. It does seem to then create an entry in the More Programs?

    Now, of course we want a background app to keep running, this is why the using ManualResetEvent is used, to keep the thing from closing down. see my basic code in the Managed Code forum, Help me ... background app.

    Anyway, I find I just had to keep reading and reading, and experimenting.

    I know that my problem is, is that I just write apps. I do not understand all the ins and outs of how windows works, how .net works, lots of the language features, delegates, journalling, blah blah blah.

    I've got loads of books, read loads of articles, but it just loses me ...

    That's why being in a software house with other developers must be so good when learning your craft, me I've always been alone, so my practice is poor.





    Gordon: Has reached the end!
  •  04-09-2007, 8:28 AM 2389 in reply to 2385

    Re: Real Help for Noobs

    Gordon,

    You're right about Media Center unloading the add-in when the Launch( ) method exits, but the entry in More Programs is created by the running of RegisterMceApp.exe not by the running of the add-in itself. 

    Cheers,
    Andrew

  •  04-09-2007, 9:25 AM 2394 in reply to 2389

    Re: Real Help for Noobs

    It doesn't seem to be there though when my proper background app is running?

    Ahhh, sorry, I've inadvertently caused confusion here I think.

    A normal mcml app is put into more programs or wherever yoi defined in the app.xml, when you register

    A non-terminating background app does not create a menu entry

    But? A background app that does terminate definitely does create a menu tile inm the More programs, and when selected will rerun the terminating background app. I assume it gets put there by default.

    Unless of course I'm wrong ... :()



    Gordon: Has reached the end!
  •  04-09-2007, 12:57 PM 2404 in reply to 2394

    Re: Real Help for Noobs

    But? A background app that does terminate definitely does create a menu tile inm the More programs, and when selected will rerun the terminating background app. I assume it gets put there by default.

     

    This shouldn't have been created at all if you specified the "Background" category - it's likely a problem in the structure of the XML file or something that caused it to appear, or some other experimentation you were doing.

    Cheers,
    Andrew

  •  04-09-2007, 3:29 PM 2413 in reply to 2404

    Re: Real Help for Noobs

    I'm trying to run that basic thing on my blog at http://www.thedigitallifestyle.com - but there's a certain thing called 'lack of time' that keeps hindering my efforts.

    If you do start up a blog (or want to contribute articles to my existing one) then feel free to drop me a line with the URL.

    But do remember - if you are learning to build a house, you should first take the time to learn to use a hammer. A Media Center guide should teach you how to use the MEDIA CENTER components, such as MCML. It appears as if you also don't really know C# - and that opens a whole new kettle of fish.

    But if you want to write a tutorial on both, that would be great for the newbies.


    100 downloads a day for Yougle Vista - goin' allright!

    Check out http://www.thedigitallifestyle.com/cs/Blogs/developer/default.aspx and http://www.push-a-button.com.au/products/mce
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems