 I hope this works. So, welcome to the Moonlight Talk. Let me just find my stuff, hopefully. This is good. Okay. Hi. We're late, but hopefully I won't take too much of your time. I'm not going to do that many slides. I have four slides because I want to do a hands-on demo presentation. We haven't done one of those of Moonlight for a while, ever, I think. So, you've heard about Moonlight all day long, Silverlight and Moonlight, so I'm not going to tell you what it is. I'm going to show you what it is. The talk is entitled Moonlight and You, because it's... I want to show what you need to work with Moonlight. You, the user, you, the developer. The tools we have right now to build applications, what works, what doesn't, what features are available, and basically I'm going to show you what I had to do to get the demos working today so you can do the same with your applications, basically. So, you know what Moonlight is, an open source implementation of Silverlight. This is the goals that are stated on the site, they're still the same. I find the third one, the fifth one is funny, but the third one is the one I like best because one thing that we had from day one was pretty much support for desktop applications because when we did Moonlight, it was just a quick step to run it on the desktop because we don't actually need the browser for anything. It's a GTK backend. The browser is there to provide us a window and events, but we can do that too, so it's not that complicated. So, usually the good part about that is that most applications that work on Silverlight, the code can be just compiled for the desktop and run on the desktop with no changes, a very few changes, basically. And the more you go into Silverlight versions, the less problems you have because the less you're depending on JavaScript and web technologies. Originally Moonlight 1.0 was completely JavaScript and Runtime, no C-Sharp, no anything. But as we plugged in the good parts, which is the C-Sharp and the Runtime and everything, you cut down on the web technologies a bit. So, it's easy to do the translation between one and the other. So, I like that goal. I like the other ones too. That one is my favorite. This is how Silverlight and Moonlight works, okay? There's a lot of layers, a lot of structure, a lot of everything. But this is what happens. The Runtime is sitting in the middle, okay? It's C++. You don't see it. It's there, you know? You're doing stuff, you as an application developer, you as the user of the APIs. You're doing stuff in C-Sharp, right? Which is talking to C++ via a lot of calls. If you're running on the browser, there's two-way communication between all these layers, basically. So, when you load the plug-in, the browser loads the plug-in, initializes C++, eventually ends up in C-Sharp, which ends up in C++. It back again, tells you something in JavaScript, and then you can do calls from one end to the other. And it's transparent for you. So, this is basically what you care about are the two endpoints. And, like, the middle is what we care about. We hopefully care about it enough so it doesn't crash or anything. That's our business. So, I'm gonna start off with demos. Ah, kill this thing. Okay. So, I don't know if all of you are here for the MonoDevelop talk. This is MonoDevelop. I'm running it locally. It's the latest build, but it's the same thing that's released. Before we had Moonlight integration on MonoDevelop, we had to do everything on the command line. I'll show you how to do that in a bit, because there are important tools on the command line that you will need to know. Because we don't have designers and GUI tools for everything. But we do have now integration on MonoDevelop. So, basically, because that's what I do on MonoDevelop, it's a Moonlight application project. So, I don't know if this is activated already on the latest version of... Where's Luis? It's not on yet, by default. Moonlight type projects on MonoDevelop. Right, right, right. Because we're... Anyway, we're talking about leading ads, basically, because Moonlight 3 is just coming out. We're just starting to have all these tools available. So, what do you want, basically? Let's just go quickly through a little tiny small sample. Hello World, usually. This is... It has a purpose, believe me. So, I'm just going to change this. For those lazy view... Well, you probably haven't used Visual Studio interview, but this is pretty close, basically. This is the Hello World that Michael had to send, I think the template originally is still there. Sorry, Hello Moon, not Hello World. This is your basic XAML description of a Moonlight application. It's just totally empty. If we're talking about doing Moonlight applications like this, you don't have to even leave MonoDevelop to run and debug, because it's all integrated right now, which is basically what I'm going to show you. So, we are debugging right now a Moonlight application. It doesn't do anything, but if I step in, you can see that it's jumped into this page, which is the initialization that's separate. This is a basic template of a Moonlight application. So, this is the entry point. MonoDevelop, Moonlight, as soon as we release everything and all the distros have it, that's what you're going to get. Debugging applications, hopefully we'll get a designer really, really nice and really, really soon, so you don't even have to have XAML written down. But this stuff is starting to work. So, this is a generated file. So, what Silverlight Moonlight does is, it takes your XAML description file and generates, auto-generates all the hookup codes. So, you don't have to basically, which is just basically hooking up all the objects that are described on XAML. So, there's the grid layout route, which means layout route is going to be hooked up here. So, you can access it later. So, this is a Hello World. This is, by the way, you can't see it because the screen is too small, but we're going to see it in a second. This is running, as soon as it shows, on Firefox 3.6. Okay, so, MonoDevelop launched Firefox, connected to the debugger, which is asynchronous. And then, so you're debugging a plugin inside Firefox on MonoDevelop visually, which is a good step forward, I think. It's a good one. So, Miguel was complaining earlier that we don't have Chrome support. We do have Firefox support up to 3.7. I think it's working fully. We do have Chrome support. And just because he was complaining... Dude, sorry. Just because he was complaining, I'm going to quickly... I'm going to fake it, basically. And while I do this... Okay, while this is running, you're not going to see it. You're going to see it in a bit. You're typing, but you're going to see it. As soon as this goes... Yes, now you're going to see it. Okay, so while I'm building a separate branch, just for Chrome, come on. So what happens is, with the Chrome support, Chrome is a bug, okay? Chrome has this nice feature of running plugins out of process so they don't interfere with the browser. Basically, if they blow up, the browser doesn't blow up. So it just so happens that you can do a plugin with one line code that freezes the browser. And that one line code happens to be in moonlight. So it freezes. So it does work. It just kind of doesn't. So it just moves that line to another place that doesn't freeze Chrome. It just so happens that Firefox doesn't work with this one. So we either have one or the other. You can't have both. For now, I'm working on it. Hopefully it's going to be fixed very soon. So anyway, for now, Chrome support is full except for video. So we don't have video because video requires a backend that we need to do. Firefox has quirks that we support, but then obviously Firefox bridge for video doesn't work on Chrome. So we need to do that. But everything else basically works on Chrome, which is what I'm going to show you in a bit as soon as this ends. Okay. So this is a little script that just set up a bunch of LD library path, path and C include path and whatever that's sitting on my home. This is really useful because if you don't want to blow up your environment, it's kind of handy because Moonlight runs on the 2.6 branch of Mono, not trunk. So if you want to start playing around with it and you have Mono installed in the system and then you have to have a separate Mono, you're going to blow up your system. So I'm going to put this on, when we have the slides on the web, I'm going to put the script on somewhere. So if you want to play with it, you can just pull it and not blow up your system. So we were showing a Hello World. So this is what Mono developed created, right? The two ZAMLs, two CS. Mono developed dumps everything on the bin directory. So I'm going to go there. This is what it runs, the HTML page. I can actually do this because it's just a simple page that Firefox is going to work. This is the same thing that Mono developed does, right? It's just to prove, just to prove that Chrome works. Chrome works. Oops, you can't see it, sorry. Okay, now let's just switch branches again. It's not going to be very... Okay, so now while that's doing that, so we were looking at the application on Mono developed, right? There's tools on command line to do the same thing that Mono developed does, basically. So we have this Hello World. And what Mono developed essentially does is run MZAP. MZAP basically drives the compiler and the resource packer and everything to create a ZAP file, which is basically a ZAP file. Also the HTML and packs every resources in the assemblies. So it's the front end to build moonlight applications, basically. So if I run MZAP here, it's smart and it knows that everything XAML.cs is going to be compiled. Anything, any DLLs that are yours and that you reference, basically, are going to be included. Everything that's in there is going to be included. So, and it's cute. It creates the DLLs and everything. It's messy, Mono developed is cleaner. And it creates a HTML page somewhere around here, which is usually the same name as the directory where you are. So this guy is done. So basically it's the same thing. You just run still in the same place or Hello World. Now the trick is for desktop apps it's very complicated. You do dash desktop. And then you have another tool called Mopen, which does the same thing as Firefox, which is basically created to take a window and then initialize the Mono runtime and moonlight and everything and basically do the window. So what you do here is called the ZAP file, not the HTML file, obviously, because the ZAP file contains everything that the application has. And then you have a TTK window that is running exactly the same code as Firefox. If you don't want window decorations, dash D will give you what we call a desklet that we haven't touched in a really, really long while, which is basically, yeah, I fixed it that far in the morning. It still works. So basically window with no decorations, which allows you to now do something cute like we're going to go to somewhere else because I love opening windows. There are some very old samples of desklets, like three years old, maybe, something like that. This is still a poor thing. This one is great. Oh, I know, I know, I know why. The launcher has some problem or something. This is old code that needs to be reviewed. There are some problems with the TTK side. This code hasn't been touched in about two or three years, maybe. So we need to review it, basically. But this is a really, really simple clock application that has no code, basically. It's just all description and animation. We can look at the code very quickly. But it's running on desktop and it's totally transparent and needs fixing in the drawing. There's no window decoration because it's run with dash D. So you can basically do little applets, right? Just to show you the difference. That's what dash D does, right? This is the original, the transparency code as a few bugs. So this is a moonlight desktop app, which could technically be compiled to run on a browser. There's no difference. The HTML file doesn't do anything except load the plugin. So this application is very simple. Let's just open with something big so we can see. There's no highlighting, but it's basically just simple. You know, this is SVG. For those of you who don't know XAML but know SVG, Inkscape can export XAML. So if you want to draw nice ellipses, nice guis, anything, you go to Inkscape, you do whatever you want. You just load your SCGs if you have them. And then it just exports XAML and it'll be done. And you don't have to have any sort of driving code for this because here you have the canvas on top and this will get drawn immediately. It's just a XAML file, literally. You don't even have to technically compile it. You could just load it. The interpreter will just parse it and draw it for you. You just want to compile it because there's C sharp code that can manipulate these objects and then do nice stuff. The difference between desktop applications and moonlight applications is that moonlight is very restricted in what it can do. So the APIs that you have access to are very restricted. You only have one thread, which is a theme today, which is not exactly true, but essentially you have one main thread. Everything that you do, any calls, HTTP calls, anything that you want to do to the outside is completely asynchronous. You cannot do synchronous calls to anything outside your app to make sure the main thread is always going no matter what. You can't just freeze the plugin and probably kill the browser along with it. Also, there's a very limited subset of calls that you can make. On the other hand, the same application, exactly the same application compiled for the desktop has no restrictions because it's the desktop. It's yours. It's an application. You can do whatever you want with it. This is basically an interface on XAML, which is, for those of you who know, SVG Victoria drawing with animations, with video, which I'm going to demo in a bit, with everything you really want to do that you can draw on Inkscape, basically. You can dump the work on your designers on whatever. You can draw pretty nice, vectorial things, and then you can drive it with C-Sharp with full access to everything that .NET has to offer in terms of database access and in terms of everything, basically, that the runtime can do. So, I like it. But I'm biased, anyway. You must like it because you're here, so. Anyway, so that's... Let's see. Let's go back to our... It's here, yes. So, yes, this is built. So, MZAP for compiling. Normal or desktop applications. M-Open for running desktop applications. Anything else is via the browser. So, I don't forget. We've seen Hello World, so let's look at some demos, basically. What do we have available? Okay. I don't remember if I built this for the desktop or not. Sorry. It's too big. My mouse is not that good. So... Okay. So, this is something I just... I was messing around with just to show you different types of... So, these are standard Moonlight controls. Dot-downbox and everything. So, basically, this is an animation demo for built-in animations, basically. So, different types of how to animate an object. So, basically, all the animations are done with storyboards. And then you just define animations. How long do you want them to take and what type of using functions that they're going to take? So, how are they'll delay or they'll accelerate? What type of stuff that's going to happen on the animations? And this is basically the demo, a bunch of storyboards that animate objects. It doesn't do much else, but it's running... Again, if you compile this on ModerDeveloper, it just stands up. You can run this on the browser. It's exactly the same code, no change. So, that's animations. You can imagine taking the... the... decorations out, picking these objects, and then doing... doing animations on your applications, whatever they are. So, if you want to... I don't know, Twitter clients with nice thread-ins, whatever, you can... you can do that. What else? So, next. Something that's working again. That wasn't. Okay. So, this is more detailed. This is the Silverlight Toolkit, the Silverlight 3 Toolkit. So, it's basically a demo of a bunch of different controls that we basically have built in. You can use them. They're in the API. This is Silverlight 3. We are in the preview. So, not all of this is supported. Basically, we have all the controls, but not everything is working 100%. I don't know. Yeah, well, anyway, these... Yeah. So, the font is really small. So, this is... can you see it? These are all the... the several different controls. Some of them are special. They come in the Toolkit themselves. Others are built-in. But they're here. They work. They're running on Moonlight. So, I think this one was cute, basically. Okay. So, this is fully... Oh, okay. I'm going to demo the video, but I'm not going to demo the Microsoft Media Pack. I purposely removed it because we've been doing demos with the Media Pack 5. I'm going to do the demo next. We've been doing demos with the Media Pack and we know the Media Pack works. I have FFMPEG here. So, we can see Moonlight for you guys that are like FFMPEG rules. You can see Moonlight doing FFMPEG. For... this is handy for debugging your own applications if it shows, if it doesn't blow up the browser. Oh, when it's like huge, right? Yeah. I forgot this one is huge. These are features that are not available on Silverlight, but we have them because we like them. So, basically, you can do... you can see the entire tree of stuff that is done here because this entire GUI is done on Silverlight. So, it's pretty big. One final demo. We're building up to it. Works. Okay. One final... Oh! I'm sure I have it running somewhere else. Again. Really? What's the syntax? Okay. So, finally, this is a pure C sharp... Silverlight 3 feature, which just got working... David Riefman is working on this and we just got it working two or three days ago. Well, it's 64 bits anyway. 32 bits was working before. But I'm running 64 bits, so I wanted it to work too. So, basically, Silverlight 3 has pixel shaders which take care, take advantage of nice hardware that you have to dump that you really want to be fast and isn't at the moment. So, we are implementing this. And... I don't think I have updated driver, so it's probably... it's going to be slow on the video because this is an NVIDIA, and I didn't update my VDPOW, whatever. But... I can't hear it. This is running with FFM peg on the back as the engine, not with the binaries. For what it's worth, I tried both on this machine. It's the same thing. Same speeds. They're both working perfectly, so... We're... Ah, let's see if... So, you can tell that it takes a bit of a hit as soon as pixel shaders go in. But then again, this code, it lands a week ago, so it's really not that optimized. But this is doing... This is happening live on... You can apply all these effects at runtime, because everything is described with XAML, and that's easy to just... You can just create XAML on the fly and just dump it. You can do all of this on runtime. And you can do all of this in your applications desktop or on the web, basically. So, you have everything available. And... Well, that's all the time I have, I think. I don't know, with Q&A. Questions? Kill me. I think so. I think... I don't know, but I think I'm the only one running NVIDIA at the moment. Am I? Well, I'm... Which is already used, got it? There's like... The drivers are too new. There's stuff that's not supported yet, so they... We want trunk or whatever. I'm sure I'm not running them. I'm sure I'm not running them, because when I build stuff, half of it complained that I wasn't high enough. So, I'm sure this is slower than it should be. But, yes, I think Riven is trying them with decent hardware. Decent hardware, so... Moonlight... The accessibility team is on the side putting all the accessibility APIs on Moonlight to make sure everything goes on par. They actually blow us up a lot, because it's accessibility. It just pushes the limits a bit. So, while we're working, they're working on the side to plug everything in, basically. Exactly. They showed up from time to time with huge patches of accessibility to plug into our stuff, so... Yes. Well, 64-bit problems is more of this code which Riven was working on 32 bits, and we needed a few tweaks. So, we support all Linux and Unixi platforms in general, and all major platforms. Non... I don't know what else... I'm not currently aware of what else we support. Well, yeah, we did support... Yes, exactly. It's just... Our focus is Linux and Unix at the moment. There's support for there, but there's not... lack of hands, basically. Thank you.