Friday, January 29, 2010

Silverlight Media Framework v1.1 Released

This open source framework will make developer’s work much easier when they develop a media player for Silverlight.

More details in codeplex along with videos shows how to use it.

PDF Viewer for Silverlight

It seems the days of HTML overlay is coming to an end.A pdf viewer for Silverlight is ready by first floor software who gives Silverlight spy.Read the details here.

See it in action here

Monday, January 25, 2010

What is Managed Entity Framework - MEF

After joining in new company I rarely get time to learn new technologies than my previous company.Obviously its due to more responsibilities.But this week end I was managed to find some time to learn MEF (Managed Entity Framework) which was introduced some time back.

In simple words its all about Export,Import and you export a type or property then you import into another property which is present in another class.For this to happen there should be somebody in the middle.That is composition.

The export and import takes place by using attributes.Just decorate the class or property with the attribute export or import to achieve the functionality.For composition you just need one line code :-)

Exporting one type

public class Employee

The above code just exports one class.Lets see how this is being used or imported.

public class EmployeeViewModel
[Import ("Emp")]
public Employee Current { get; set; }

The employee view model class receives the exported type as Current.This code it not completed.To complete the code we need to compose.It is done by the line below.

public EmployeeViewModel()

This is the constructor of EmployeeViewModel class and the first line does the composition and after that if we access the object it will be initialized and ready for use.In this case it will display the default ToString method’s output ie the class name.

This is the basic concept of MEF.This can be used in data binding and for collection types etc…Next time will discuss about a data binding and MEF.

The project contains a reference to the dll System.ComponentModel.Composition.dll.You can locate this file from the attached sample or in the Silverlight 4 installation.

Sample can be downloaded from here.

Sunday, January 17, 2010

Performance optimization in Silverlight 3

Just now got a good link in MSDN for performance optimization in Silverlight 3 applications.

Don’t know when can I get a chance to apply this in my current project :-(