Monday, September 1, 2008

Silverlight standalone exe application - Desklighter

Now we have a tool named Desklighter to run Silverlight application as a Client side stand alone application, Only prerequisite needed is to have the Silverlight 2 Beta 2 plug-in installed in our windows machine. We can download the free beta version of Desklighter from Blendables.com/Labs Page. For more details check here

Wednesday, June 11, 2008

Silverlight 2 Beta 2 - how to set built-in style for custom controls from generic.xaml

Built-In Style of Controls

The built-in style for a control is now determined by looking at the DefaultStyleKey property. This property defaults to null (which means no built-in style will be used).

If a control class wishes to provide a built-in style that is different from its parent, it should set the DefaultStyleKey in the control constructor. This change ultimately enables the scenario where a developer wants to subclass a control and add functionality, but does not wish to change the control's built-in look.

Example: Button sets DefaultStyleKey

public class Button : Control
{
public Button() : base()
{
...
DefaultStyleKey = typeof(Button);
}
}

for more details : http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Friday, June 6, 2008

Bill Gates announces Silverlight 2 Beta 2 and Crossfader @ Tech-Ed 2008

As Bill Gates announces Silverlight 2 Beta 2 @ Tech-Ed 2008, Crossfader application became one of the key presentation of Keynote.

Crossfader application was built with Silverlight 2 Beta, It was demonstrated in Tech-Ed by S. Somasegar, Senior Vice President, Developer Division, Microsoft.

Crossfader is a social networking application, through which one can share their digital content like Video, Audio, Photo, etc., with friends, families & with other members of the Online Community.

I am really proud to say that, I was one of the key members of the Crossfader development team, it was a great experience in working with some latest technologies like Silverlight, WCF, etc.

Crossfader was one of the first major project in Silverlight 2.0 in our company (IdentityMine). David Kelly was the architect of this project. I am thanking all team members for their support to make the project a grand success. Congratulations Team!


Some Links to Tech-ed 2008:
Microsoft Tech-Ed Online
Silverlight 2 Beta 2 Announced [Crossfader Demo]
Crossfader.com [Soon replaced by the new application in Silverlight.. Keep watching :) ]

Wednesday, June 4, 2008

Microsoft Innovation Days @ Kochi - May 30, 2008

I got a chance to attend Microsoft Innovation Days event at Le Meridien Hotel, Kochi on May 30,2008. Microsoft Innovation Days are day-long free events which offer an inspiring and productive day of technology previews, resources, and business benefits that will keep us competitive and help us to energize and maximize our technology.

Some of the key topics covered were:
1. Building Rich Internet Applications Using Silverlight 2.0 by Nahas Mohammed, Microsoft
Siverlight2.0 virtual vehicle gallery demo by Jim Mangaly, IdentityMine
2. Building high performance .NET applications by Harish Ranganathan, Microsoft
3. LINQ: Working with data naturally! by Harish Ranganathan, Microsoft
4. Getting the Best from SQL Box: Performance Tuning SQL Server by Praveen Srivastava, Microsoft

In that our company (
IdentityMine) got a 30 minutes slot to share our experience using Silverlight 2.0, Since IdentityMine has been into this technology for more than a year and IdentityMine also did some Silverlight 1.0 training at Mumbai and Bangalore in last December which had a wonderful developer, designer audience from various companies around India.

At the end of Building Rich Internet Applications Using Silverlight 2.0 by Nahas Mohammed, my colleague
Jim Mangaly did a great presentation showcasing a virtual vehicle gallery demo application developed in Silverlight 2.0. This was not a fully fledged application, which was created in a week's time. It include most of the highlighted features of Silverlight 2.0 like: Databinding, Templates, Animations, Drag and Drop, Video Brush, Isolated Storage, Video Markers etc.. He explained some of our experiences working with Silverlight, including the Developer-Designer workflow, also showed some other samples too.

There was 200 plus developer, designer audience from various companies around Kerala, all were impressed with
Jim Mangaly’s presentation.

Silverlight Chart Control - Sample Code

The Silverlight Chart Control provides charting solution in a silverlight environment. It uses XAML and C# to display charts on the silverlight platform. The Silverlight Chart Control supports different types of chart like: VerticalBar, CylinderBar, HorizontalBar, StackedVerticalBar, StackedHorizontalBar, Pie area, StackedArea, Line BarLine, AreaLine, BarAreaLine, XYLine, ScatterPlot, Radar, RadarArea, Funnel, CircularGauge, SemiCircularGauge, etc.

For more details Please check :

Free Silverlight Chart Control

You can download the original source code from here

FreeSilverlightChart Control Test Page

Wednesday, May 14, 2008

Silverlight RSS Feed Reader Using WCF

We can access RSS Feed from a Silverlight client, but it do have some limitations. ‘Cross-Domain’ Issues. The control and the feed are not hosted on the same domain, we need to add a clientaccesspolicy.xml or crossdomain.xml file to domain where the feed is hosted to enable cross-domain access, this is not a practical solution.

So here is the alternate solution, Access RSS Feed using WCF Service from a Silverlight application. For that we need have a WCF Service and a Silverlight Client.

WCF service will fetch the data from the feed URL and passed to the client.

Steps:
Create a new Silverlight Application using VS2008, Select “Add a new web to the solution for hosting the control’ Option.

Then Right click the Web project, select Add New Item and add WCF service.

Now WCF Service will be added to the Web.

Add a reference System.ServiceModel.Syndication to the service

Create a custom class for Feed data in to the service. Something like below :
//
/// Feeed Data List
///

[DataContract]
public class FeedData
{
public FeedData()
{

}
private string _LastUpdatedTime;
private string _PublishDate;
private string _Title;
private string _Summary;

[DataMember]
public string PublishDate
{
get { return _PublishDate; }
set { _PublishDate = value; }
}
[DataMember]
public string Summary
{
get { return _Summary; }
set { _Summary = value; }
}
[DataMember]
public string Title
{
get { return _Title; }
set { _Title = value; }
}
[DataMember]
public string LastUpdatedTime
{
get { return _LastUpdatedTime; }
set { _LastUpdatedTime = value; }
}


Add Service contact :

///
/// Summary description for IFeedAPI
///

[ServiceContract]
public interface IFeedAPI
{
[OperationContract]
List GetRSSData(string FeedURL);
}


Implement the interface

///
/// Fetched the RSS data from the current RSS Feed
///

/// A List of FeedData
public List GetRSSData(string FeedURL)
{
List feedData = new List();
SyndicationFeed feed = null;

// Get the current feed and load into an XMLReader
using (XmlReader reader = XmlReader.Create(FeedURL))
{
Rss20FeedFormatter feedFormatter = new Rss20FeedFormatter();
// Read the contents of the XMLReader into the FeedFormatter
feedFormatter.ReadFrom(reader);
// Get the current feed.
feed = feedFormatter.Feed;
}
foreach (SyndicationItem dataItem in feed.Items)
{
//Adding Feed Items to FeedData List
feedData.Add(new FeedData { LastUpdatedTime = dataItem.LastUpdatedTime.ToString(), PublishDate = dataItem.PublishDate.ToString(), Summary = dataItem.Summary.Text, Title = dataItem.Title.Text });
}
return feedData;
}


Then in the silverlight application, add the service reference, create the proxy instance of the service, call the GetRSSDataAsync method by passing the Feed URL, in the completed of GetRSSDataCompleted, we will get a data list type FeedData.

Thursday, March 27, 2008

WCF Client Proxy - Default Constructor & Parameterized Constructors

When service reference is added in the client application, many files are added to client as part of service reference like Reference.cs, ServiceReferences.ClientConfig, .svcinfo files, .datasource files, .disco files, .wsdl files, .xsd files etc.

Default Constructor & Parameterized Constructors are created within the Reference.cs


public ServiceAPIClient() :
this(defaultBinding, defaultAddress) {
}

public ServiceAPIClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}


Default Constructor ‘ServiceAPIClient()’ can be used for creating proxy for normal cases. It will use the default EndpointAddress and Binding from the Reference.cs file.

private static System.ServiceModel.Channels.Binding defaultBinding = new System.ServiceModel.BasicHttpBinding();

private static System.ServiceModel.EndpointAddress defaultAddress = new System.ServiceModel.EndpointAddress("http://localhost:56789/Service/ServiceAPI.svc");



In case if the service EndpointAddress to be changed, Usually Service reference is updated and used.

Constructor with Parameters can be used in this case, by defining the EndpointAddress and Binding Type.

public ServiceAPIClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}



Code:

Binding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:56789/Service/ServiceAPI.svc");

ServiceAPI.ServiceAPIClient(binding, address);


Here there is no need to Configure the service again if there is no change in the service part. Only the service host address is changed.