Forum  General Visual ...  How do I...?  push changes to client
Previous Previous
 
Next Next
New Post 3/10/2012 8:13 PM
  winanjaya
305 posts
3rd Level Poster


push changes to client 
Modified By winanjaya  on 3/11/2012 12:18:28 AM)

 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;
        }

 

 

 

 
New Post 3/12/2012 3:12 AM
  terricide
271 posts
4th Level Poster




Re: push changes to client 

 The timer should be in Form1 not Global.asmx and Timers should be enabled in the web.config.

 
New Post 3/23/2012 1:31 PM
  palli
14299 posts
1st Level Poster




Re: push changes to client 

Hi winanjaya,

Please let us know if terricide's suggestion didn't help here.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  push changes to client
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS