Showing posts with label jared. Show all posts
Showing posts with label jared. Show all posts

Wednesday, December 17, 2008

Xaml Guidelines, Part 1

Check out Jonathan, Jared and Nathan on Xaml Guidelines on Channel 9. I know this is focused alot of WPF but as suggested on their post it applies to Silverlight AND wpf.

http://channel9.msdn.com/shows/Continuum/XAML-Guidelines-Part-1/Default.aspx?wa=wsignin1.0

Thursday, August 21, 2008

Saturday, December 22, 2007

Full Length Movie Vie Silverlight

I'm ashamed to admit that I contributed in any way to this project... mind you I liked the Movielink team but the content is really really offesive in my opinion but the fact is that this is the first full length feature streamed via Silverlight to the masses. The player itself is straight forward and we un covered a few issues on the mac apprently in the underlying media stack in Silverlight but none the less a bug where about half way through the movie the sounds slowly gets upto a second off from the video... otherwise it works great :) if you must, you can check it out at:

http://blockbuster.jackassworld.com/

Friday, October 26, 2007

Silverlight Key Events In full screen mode...

Jared my friend is building this video player in silverlight. Nothing new about that :) but I showed me its full screen mode and how he used the key up event from the esc to fix up his UI as he couldn't capture key events from silverlight from full screen mode... cool little hack persay. another way around that is to capture events off the document object and or if you can use the on full screen change event.

JavaScript Class Structures

So 8 years ago or so I worked for this company and was hired to fix and admin tool they wrote in JavaScript... The system had 10's of thousands of lines and loaded as an HTA and looked and feeled like a win 32 app. This was cool but everything they used visual studio to debug everything feel to pieces. I spent a long time looking over the code and what bothered me was how they laid out classes. They would always declare a class (function) and then add functions to it effectively making them all global. It turns out when a move of a curlly braces so that it appeared more like a traditional class (minus the key word class) with the methods(functions) being nested in the class (top function). Like magic the application preformance went up and visual studio stopped blowing up on contact. It was really amazing. Since then I have been pretty sold on using a JavaScript class structure like this... Over the years my self rightousnous about JavaScript has grown to the point of having trouble getting in the door with my big head... What is the saying the bigger they are the harder they fall. Anyway in my self rightousness I over looked a little key word called 'prototype'. I don't know if it just wasn't around 10 years ago when I started JavaScript and came later or what but one day I wake up and there is class structure using prototypes that gives me heart burn as it keeps giving me flash backs to this one project. And alas I have learned something new. With all my winnying about properly structured javascript some one pointed out that oh look this key word makes all instances use the same copy... gasp choke [descriptive explative] what? So I ask to see the link and do a bit of research. and what do you know a better way of doing something.

So it turns out that if I declare my class with its properties and then declare using prototype my methods then all instances of the class use the same method. this is also how to extend core classes as well. (dah, as I have seen that before) So then the new rule is that proper javascript class declarations should look like this:

function myclass()

{

this.WhateverProperty = "";

}

myclass.prototype =

{

Method1: function( param1, param2 )

{

// some code

},

method2: function( param1, param2 )

{

//some more code

}

}

Yes I know my curly braces are matching and not the OLD school javascript standard but will all the other languages it just seems to be that JavaScript should follow suit, anyway this is how a javascript class should look like until I am proved otherwise... (hmm. setting my self up again). :)

Silverlight Host Loosing Mouse Capture...

So one issue we have had to deal with in Silverlight is loosing Mouse Capture. So inside the context of a silverlight application this isn't an issue. The problem is when we have a small embeded silverlight app, say a media player for instance that we want to be able to be dragged and resized dynamically accross the page over HTML content and back. We can build this application so it has a typical windows like drag corner that you can left down click on and then drag out to resize. In theory this works. The issue is if the mouse ever gets off of the silverlight app surface, which is very easy todo, Silverlight still thinks it has the mouse captured but events are no longer received and the on mouse up never gets fired. Further when you move back on to the Silverlight surface you still have managed to loose the mouse and code can get easily confused ie: say your using a flag to determine if the mouse is captured since silverlight currently doesn't have a 'isMouseCaptured' property etc.

So now we have framed the problem here is how we solved it. So even though the media player visually one size when we first catch the mouse down on the drag corner we actually change the size of the underlying aghost for silverlight to be an extra buffer of so many pixels. So now the aghost makes it much harder for the user to get the mouse off of the silverlight surface so we basically run around the screen and chase after the mouse. On drop then we resize the aghost to match the current drag corner position. On IE this works really well, on firefox it is more problematic but does work well if done correctly. On Safari on the Mac the drag works well but Safari is generally more touchy around the html dom.

Another point or rather surprise for me was making this same player work on Safari on the Mac... lets not get confused with Safari on windows which as of this post blows up on contact with silverlight. But anyway. on the Mac, Silverlight runs as smoothly as in IE especially with this particular mouse capture issue. Hmm... makes me wonder if it is just Firefox...

Path Performance Issues in Silverlight

So I was talking to Jared and Devin and the other designer/integrator types this morning and some one pointed out that when you create a Path that uses stretch and has a height and width Silverlight takes a huge preformance hit. Not sure why this is as it doen'st appear to be an issue in WPF that I know of but it seems to be a 'don't do that' in Silverlight...