Thursday, February 24, 2011

Basics Of MVVM in Silverlight

While I was doing a project using Silverlight, I had a requirement to cascade some combo boxes. As some might already know binding data to combo boxes in Silverlight is a real headache. So when I googling for some answers, I saw a lot of articles about a topic called data binding using MVVM. At first I had no idea what MVVM is and then I wanted to learn what MVVM is. After some reading I was amazed by the things that can be achieved with MVVM and I thought I might share some basics of MVVM with you all.

First of all MVVM(Model-View-ViewModel) is a great design pattern for Silverlight and Windows Presentation Foundation (which is commonly known as WPF). The MVVM has become a such overrated pattern is because it's powerful features. One of the best features of MVVM is it's close work with XAML based applications such as Silverlight.

To get a best idea about MVVM, I will explain the MVVM Triad (Model,View,View Model).
  • View is the user controls designed in XAML. Since I am mainly focuing on Silverlight, in Silverlight View is described in MainPage.xaml. 
  • The Model is used to access the data from a data source. 
  • The View Model is used the put all the logic behind the controls and to fill the gap between View and the Model. It actually bind or convert the information of Model to View information.
Using these three parts, MVVM provides powerful XAML binding for it's controls. If you are doing development with Silverlight or WPF I am sure some of you have already gone through the need of this nice pattern and if you have not gone through this pattern yet, very soon you will be going through. You can find more information and tutorials in the web on MVVM.

Happy Coding.

Regards,
Jaliya

Sunday, February 20, 2011

Error : Your mailbox appears to be unavailable. Try to access it again in 10 seconds - Microsoft Exchange 2010

Today for the first time in my life, I got the experience of installing Microsoft Exchange 2010 and that was really a nice one. My requirement was just simple, which was sending an Email from SharePoint to Exchange. I configured SharePoint to send Emails to my Exchange and when I checked from SharePoint my Emails were nicely sent.

But when I tried to log in to OWA (Outlook Web App) to check whether I have received my Emails, after typing the user name and password I got this nice error saying "Your mailbox appears to be unavailable. Try to access it again in 10 seconds". Since I am a beginner in Exchange I was confused and tried many things to fix it.

But after struggling for around 2 hours, at last I have managed to fix it now and I am so happy.

Solution was again, just a simple one. That is,
In services, Start the service "Microsoft Exchange Information Store". I think the problem was, without that service up and running Exchange can't map a mailbox to a user.

Now everything is fine and I have received my emails and I got the pleasure of confirming my Emails are successfully receiving from SharePoint.

Happy Coding.

Regards,
Jaliya

Sunday, February 13, 2011

Silverlight UI Thread and Background Thread

One of the coolest features in Silverlight is UI threading. WPF is also provides UI threading. I got to know about this feature while I was trying to update the UI elements from my background thread. After googling around I saw a nice class that deals with threading which is the Dispatcher class. Mainly what Dispatcher class does is it provides services for managing the queue of work items for a thread.

One important thing that you should keep in your mind is that Silverlight recognizes the difference between UI threads and background threads. You just can't update controls designed in XAML through your background thread. You must invoke the UI thread by using the Dispatcher class.

We can simply do this by declaring a delegate to access the XAML DOM.

Dispatcher.BeginInvoke(delegate()
{
//update the UI
});


Happy Coding.

Regards,
Jaliya

Geographic Information Systems(GIS) for SharePoint using Silverlight

These days Geographic Information Systems (GIS) are becoming more popular systems rather than ever before. Since currently I am working on developing a GIS, I thought I might share some things I got to know while developing.

First of all .net is a nice platform that supports developing GIS. Through SIlverlight, It seems to me that you can develop anything for your GIS. You can do all the customization per your need.

ArcGIS API for Microsoft Silverlight/WPF is one of the commonly used and one of the best free APIs that can be accessed within the Silverlight code. One of the greatest advantages of using Silverlight for your GIS is, you can attach your GIS into a SharePoint site very easily. Just add the Silverlight Application(.xap) to a document library of your SharePoint site, then add a Silverlight web part to a web page and configure the source for the Silverlight web part to the added .xap file and that's it. Your GIS will be nicely loading into your web page.

There is a mapping for SharePoint by ArcGIS for creating a GIS using SharePoint, but I don't think you will be able to do all the customizations you want by using it. Anyhow It's always good to explore that one too.

If anyone is developing or interested in Geographic Information System feels free to post your questions or comments here.

I am sharing some links for further reference.

To get some more details about ArcGIS visit,
http://www.esri.com/software/arcgis/index.html

To learn about ArcGIS API for Microsoft Silverlight/WPF visit,
http://resources.arcgis.com/content/arcgis-api-silverlightwpf/1.2/about

To learn about ArcGIS mapping for SharePoint visit,
http://www.esri.com/software/arcgis/mapping-sharepoint/index.html

Happy Coding.

Regards,
Jaliya

Sunday, February 6, 2011

Basics of Client Object model in SharePoint 2010

When writing some applications for SharePoint 2010, I have noticed this nice thing called Client Object model. In here I am going to describe what Client Object model is per my understanding. Since I am a beginner for SharePoint please feel free to correct me if I am wrong.

SharePoint 2010 has introduced developers a nice concept called Client Object model which can be used to do variety of customizations in SharePoint. Previous versions of SharePoint such as SharePoint 2007 had no Client Object model available.

The main reason for Microsoft to introduce such a concept was, the developers need of different kind of Web Services that interacts with SharePoint and It’s not possible for Microsoft to Develop a Web Service per developer’s need. Even if Microsoft has provided a lot of Web Services that interacts with SharePoint, but because of the developer’s need of customized web services has made most of the out of the box web services unusable.

The most important part of using the client object model is developers can build remote clients without using the SharePoint out of the box Web services and without implementing the communication architecture.

Basically Client Object model enables developers to build solutions that consume SharePoint data and objects from applications that do not run on a SharePoint server. The best example would be a Silverlight application.
In Client Object Model Client can be in one of these type of applications.
  • Managed Client (Assembly File – Microsoft.SharePoint.Client)
  • Silverlight (Assembly File – Microsoft.SharePoint.Client.Silverlight)
  • ECMAScript (Assembly File – SP.js)
SharePoint 2010 client Object Model is written based on .Net CLR, so we can write custom code in C# or VB for SharePoint 2010 platform. For this we need following dlls , located at “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI” folder.
  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

Similarities of SharePoint Client Object Model


Server (Microsoft.SharePoint)
Client Object Model
SPContext
ClientContext
SPSite
Site
SPWeb
Web
SPList
List
SPListItem
ListItem
SPField
Field


Please feel free to correct me and Give me your feedback.

Happy Coding.

Regards,
Jaliya