You are here:   Silverlight 2.0 > Silverlight Chat
  |  Login
 DNN Silverlight Chat (Live Example)
 Silverlight Chat

Source Code

DotNetNuke Module

Silverlight Application

A Simple Silverlight Chat

DNN Silverlight Chat is designed to be a simple easy to configure chat for a small number of users. Simply install it and place an instance of the module on a page. All logged in users who visit the page are automatically logged into the room. The logged in user's email address is used to pull their gravatar image. Each instance of the module creates a new room.

This module is based on the Junnark Silverlight Chat project. The back end processing was completely reworked so only the parts of the Silverlight client remain from the original project.



The module also provides a chat log.



Module settings allow the administrator to configure the maximum number of users and the refresh rate.

 

The module




The Silverlight Chat application is launched by the DotNetNuke module and communicates with the DotNetNuke site using web services.




The basic flow of the application is to constantly refresh the list of users and recent chat messages.

Caching

Caching is used to reduce hits to the database. The JohnnyCoder generic cache helper class was used to implement caching.

        #region GetCurrentUsersFromCache
        private static List GetCurrentUsersFromCache(int ModuleId)
        {
            string key = String.Format("{0}_DNNChatUser", ModuleId.ToString());
            List colDNNChatUser;

            if (!CacheHelper.Get(key, out colDNNChatUser))
            {
                colDNNChatUser = new List();
                CacheHelper.Add(colDNNChatUser, key);
            }
            return colDNNChatUser;
        } 
        #endregion

        #region GetCurrentMessagesFromCache
        private static List GetCurrentMessagesFromCache(int ModuleId)
        {
            string key = String.Format("{0}_DNNChatMessages", ModuleId.ToString());
            List colDNNChatMessages;

            if (!CacheHelper.Get(key, out colDNNChatMessages))
            {
                colDNNChatMessages = new List();
                CacheHelper.Add(colDNNChatMessages, key);
            }
            return colDNNChatMessages;
        }
        #endregion

 

Gravatar

For information on how the Gravitar images are displayed, see: DotNetNuke Silverlight Chat v2 – Gravatar Support

Summary

DNN Silverlight Chat is designed to be a simple easy to configure chat for a small number of users. The module uses standard web services on port 80 so firewall problems are not an issue.

The entire application that implements real-time communication is constructed with a relatively small amount of code.

 Download

Requires ASP.net 3.5 SP1 or higher on the server

Use the install directions here:

http://dnnsilverlight.adefwebserver.com/FAQ/InstallingSilverlight/tabid/80/Default.aspx

Note: In IIS you will also need to set the MIME Type: Setting .xap MIME Type for Silverlight 2.0

Note: Install and run LinqPrep first.

DNN Module Install and Source: DNNSilverlightChat_02.50.00_Install.zip

Silverlight Project Source: DNN Silverlight Chat_02.00.00_Source.zip