Hello All,
I am using VWG 6.4, I am trying to push changes to client every 5 seconds .. but no luck
could anybody please help?
I followed the article on http://www.visualwebgui.com/Developers/Forums/tabid/364/forumid/29/postid/52887/scope/posts/Default.aspx
I use global.asax below to push changes to client every 5 seconds
in global.asax
private Timer m_timer;
int _i = 0;
protected void Application_Start(object sender, EventArgs e)
{
var ts = new TimeSpan(0, 0, 5);
m_timer = new Timer(OnTimer, new object(), ts, ts);
}
void OnTimer(object state)
{
_i++;
Class1.Publish(_i.ToString());
}
in Class1
public delegate void TextWasPublishedDelegate(string text);
public class Class1
{
private static Gizmox.WebGUI.Forms.Label _label;
public static event TextWasPublishedDelegate TextWasPublished;
private static string _someText;
public static void Publish(string text)
{
_someText = text;
if (TextWasPublished != null)
{
TextWasPublished(text);
}
}
and Form1.vwg is:
private void Form1_Load(object sender, EventArgs e)
{
Class1.TextWasPublished += new TextWasPublishedDelegate(PublicData_TextWasPublished);
}
void PublicData_TextWasPublished(string text)
{
label1.Text = text;
}