Monthly Archive
Browsing all posts from April, 2009.
December 22nd, 2008
You’re quite familiar by now with the need for cross-domain policy files and service proxies if you’ve spent any time writing applications in Silverlight that behave like mashups. The root of the cross-domain issue is in how browsers restrict XML requests, and one emerging and popular way to circumvent this problem is to make JSON calls instead, which are cross-site friendly.
Silverlight has a nice set of browser interoperability classes waiting to be used for these kinds of purposes. As a quick and dirty example let’s create some extensions that allow us to make JSON calls to grab data from…
Continue reading "How to make cross-site service calls in Silverlight using JSON" »
December 19th, 2008
When I read Nikhil’s “Effects and Transitions for Silverlight” and its accompanying Silverlight.FX framework, I was impressed by how easy it was, and is, to create an animation and declare it on any Silverlight framework element.
<Grid>
<Grid.RowDefinitions>...</Grid.RowDefinitions>
<fxglitz:Effects.ClickEffect>
<fxglitz:HighlightEffect TargetName="highlightImage" HighlightColor="Yellow" Duration="00:00:01" />
</fxglitz:Effects.ClickEffect>
<Border x:Name="highlightImage">
<Image Source="/Silverlight.png" />
</Border>
<TextBlock Grid.Row="1">Highlight</TextBlock>
</Grid>
With a framework this powerful, I wanted to extend it even further by providing a fluent interface, similar to jQuery, to compose and chain animations together. This way, you can declare a common animation element and behavior once, and apply it to any framework element you require, swap…
Continue reading "Composing animations with Silverlight.FX" »
December 16th, 2008
If you’re not familiar with Wrox Blox, they are shorter than books, and aim to give developers focused, contextual information on new technologies to get and stay productive quickly. I’m happy to report that Jumping from ASP.NET to Silverlight 2 was published today.
In it, I try to provide a solid base from which to learn Silverlight 2 coming from an ASP.NET development background. If you’ve held off getting into Silverlight 2, but are anxious to learn and build on what you already know about web development, I sincerely hope this is helpful for you.
Continue reading "Jumping from ASP.NET to Silverlight 2 available now" »
December 11th, 2008
One pattern I’ve grown to love, as it provides an expressive and maintainable way to remix business logic, is the specification pattern. Using a specification, I can define business rules against an object as single statements of truth, and compose more complicated rules out of those smaller rules. Here’s a quick example:
// Specification
class ShortWordSpecification : SpecificationBase<string>
{
public override bool IsSatisfiedBy(string instance)
{
return instance.Length < 5;
}
}
// Usage
var spec = new ShortWordSpecification();
bool result = spec.IsSatisfiedBy("GOOG");
In the example above I have defined what my application considers to be a short word. Using composition in my…
Continue reading "Improving the readability of the Specification pattern" »
December 8th, 2008
Recently I needed an easy way to figure out whether an instance or type implements a given interface, whether or not that interface is generic, as well as obtain the generic arguments (the real types the instance uses in place of a generic type) for that interface.
So I’ve written a small set of extension methods to give you these features. There are only two methods, but they are available with multiple signatures. The first method allows you to determine if an instance implements any interface, whether it is generic or non-generic.
// A regular, non-generic interface
var result = instance.Implements(typeof(INoDeclaredTypes));…
Continue reading "How to determine generic implementers and type parameters at runtime" »
Socialized