Saturday, April 11, 2009

Smart Client Advantages

Any updates to the application, a single change and the changes will be reflected to all the clients when they are launched the next time. This is called a smart client.
Lets see the Client Application Code
Collapse

using System;
using System.Reflection;
using System.Windows.Forms;
namespace MySmartClient
{
class SmartClient
{
[STAThread]
static void Main(string[] args)
{
SmartClient objSmartClient = new SmartClient();

//display splash screen

Splash splash = new Splash();
splash.Show();
Application.DoEvents();

// Set the URL to load the Assembly from

string strURL = "http://Server/Smart/Bin/Release/Smart.exe";

// Set the class to call

string sClassName = "MySmartClient.SmartForm";

Assembly assemblyContent = null;

try
{
// Load the assembly

assemblyContent = Assembly.LoadFrom(strURL);
}
catch(Exception e)
{
}
splash.Close();
// Create a object for the Class

Type typeContent = assemblyContent.GetType(sClassName);
// Invoke the method. Here we are invoking the Main method.

try
{
typeContent.InvokeMember ("Main", BindingFlags.Public |
BindingFlags.InvokeMethod | BindingFlags.Static, null, null, null);
}
catch(Exception e)
{
}
}
}
}

This is all that would be installed on the client. The actual application will be available on the Server. First time the client application is launched, the .NET Framework will download the required assemblies locally. Henceforth every time the application is launched, the .NET Framework will check for the version of the assemblies, if the server has a latest version, it will downloaded or else the locally available assemblies will used to launch the application. This way, any updates to the application can be handled easily at one location, thereby making the deployment of application easy

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home