stardv
June 17th, 2005, 09:42 AM
Does anybody have any sample code of creating smart client. I found one on “the code project” but it does not seem to work, it just stalls and splash screen is displayed forever. I am still confused about the concept of smart client, does it run from local pc and just download updates or it runs from server? Do we have just one main dll that get updated or may be many?
Thank you very much
Here is the code I downloaded:
<Code>
using System;
using System.Reflection;
using System.Windows.Forms;
namespace MySmartClient
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class SmartClient
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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://arsenaldev3/Smart/Bin/Release/Smart.exe";
string strURL = "http://localhost/smartserver/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)
{
}
}
}
}
</Code>
Thank you very much
Here is the code I downloaded:
<Code>
using System;
using System.Reflection;
using System.Windows.Forms;
namespace MySmartClient
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class SmartClient
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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://arsenaldev3/Smart/Bin/Release/Smart.exe";
string strURL = "http://localhost/smartserver/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)
{
}
}
}
}
</Code>