DotNetNuke: DNN 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. 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<DNNChatUser> GetCurrentUsersFromCache(int ModuleId)
        {
            string key = String.Format("{0}_DNNChatUser", ModuleId.ToString());
            List<DNNChatUser> colDNNChatUser;

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

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

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

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 the module and source code here:

Requires ASP.net 3.5 SP1 or higher on the server

Use the install directions for SilverlightDesktop.net as a guide for preparing your DotNetNuke site:

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 from:

http://localhost/dotnetnuke_silverlight/Silverlight20/SilverlightChat/tabid/69/Default.aspx

 

 

[Back to: The ADefWebserver DotNetNuke HELP WebSite]

 


Buy DotNetNuke Modules from Snowcovered

 DotNetNuke Powered!DotNetNuke is a registered trademark of DotNetNuke Corporation.