SilverUnit – Unit testing framework for Silverlight

Roy Osherove has just released SilverUnit, a unit testing framework for Silverlight code. I haven’t tried this yet but it certainly looks really interesting as you can start running your Silverlight unit tests inside of MS Test or NUnit. And kind cool to hear this is written in VB [:)] You can find more information and download SilverUnit from CodePlex here. Enjoy! [f1][f2]

Handling HTTPS SSL certificate errors

When using self created SSL certificates with HTTPS WCF endpoints you might run into certificate validation errors. The best solution of to make sure all your certificates are fully trusted but sometimes that might not be an easy thing. The next best thing is to the the ServicePointManager.ServerCertificateValidationCallback and have add your own function to validate the certificate. This way you can ignore invalid certificates and keep going as if everything is well. Take care though as this might open up a can of worms in a production environment. Enjoy! [f1][f2]

Patterns & Practices release Prism version 2

The Patterns & Practices group at Microsoft have just released Prism version 2. I am pretty exited about this because Prism version 2 supports both WPF and Silverlight. And as it makes extensive use of the Model – View – ViewModel amongst other design patterns it is a great place to learn, even if you don’t use it as is. Check out the main “Composite Application Guidance for WPF and Silverlight” page here. Or read Blaine Wastell about it here. Enjoy!

Getting started with the repository pattern in Silverlight

The repository pattern is quite a common design pattern when working with databases. And for a good reason as standardizing code on design patterns it makes it easer to read and understand. The typical repository pattern in .NET Most of the time the repository pattern looks something like this. public interface IRepository<T> { IEnumerable<T> All(); IEnumerable<T> FindAll(Func<T, bool> exp); } Note that I am only implementing the loading of data. Normally there would also be methods for saving, deleting and crating new entities but I have left these out for now. In regular .NET code that is just fine but … Continue reading Getting started with the repository pattern in Silverlight

Changing the MouseOver effect on a Silverlight ListBox

One thing I occasionally have to do is  change the way a ListBox item behaves. For example the blue highlight effect when the mouse hovers over it.   Changing the blue mouse over effect to something else, say the item growing slightly isn’t very hard using Blend. However I find the steps a little awkward so this post should help me remember them and I hope it helps someone else as well.   Suppose we start with the following very simple Silverlight page <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication4.Page" Width="640" Height="480">   <Grid x:Name="LayoutRoot" Background="White"> <ListBox Margin="8,8,0,0" VerticalAlignment="Top" Height="116" Width="77" HorizontalAlignment="Left" > … Continue reading Changing the MouseOver effect on a Silverlight ListBox

Using mouse gestures in an ASP.NET application with jQuery

Most applications allow a user to work both with the mouse and with the keyboard. With the mouse that usually means clicking on buttons or, in the case of a web application, on hyperlinks. using mouse gestures is still not all that common though and that is a shame because it is really easy to add to an application and can be a very useful addition of the user. To demonstrate how easy it is to add mouse gestures to an ASP.NET application I created a small sample to do just that. To start with I created a real simple … Continue reading Using mouse gestures in an ASP.NET application with jQuery

Visual Studio Autocomplete Documentation version of jQuery 1.3.1 available

I just noticed that a the Visual Studio Autocomplete Documentation version of JQuery 1.3.1 is now available. This makes using jQuery 1.3.1, the latest verion at the moment, al lot easier.See the jQuery downloads page here: http://docs.jquery.com/Downloading_jQuery or download directly from Google Code here: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.1-vsdoc.jsEnjoy!

Lazy loading using Ninject

In my previous blog post I demonstrated how you can use Ninject in your Silverlight application to automatically inject dependencies and make live easier. In the sample I injected the dependency, the PingService, inside my PageModel constructor. That worked just fine because the PingService is lightweight and stateless. However suppose creation is much more involved and you don’t need it all the time so you really want to divert creation until you really need the PingService. Well we can by just a few simple changes.   Changing the PageModel to defer loading of the PingService This is actually a very … Continue reading Lazy loading using Ninject

Using Ninject with Silverlight to make you code more testable

One useful feature when developing more complex code is using an inversion of control (IOC) container to do dependency injection. The basic principal of inversion of control, or dependency injection, is to pass in any dependencies when an object is created and not create them when needed. This way the code is much more decoupled and much easier to unit test. Dependency injection with Silverlight When developing regular .NET code there are plenty of IOC containers to choose from. However when it comes down to Silverlight the choice isn’t quite as big. I am aware of only two IOC containers … Continue reading Using Ninject with Silverlight to make you code more testable

Embedding Flex applications inside of PDF documents, good or bad?

Starting with version 9 it has become possible to embed a Flex application inside of a PDF document. Now this opens up some new exiting possibilities, that much is certain. However I can’t help thinking that virus writes will be just as happy. PDF documents are send around quite a lot and most people think they are completely safe. Now suppose some hacker embeds a malicious application in a PDF document? I have already heard stories that suggest this is already happening. Scary and not good. So I guess I am not sure this is a good thing or not. … Continue reading Embedding Flex applications inside of PDF documents, good or bad?