Results 1 to 8 of 8

Threaded View

  1. #7

    Smile

    Quote Originally Posted by DarioCrivelli View Post
    If you have an external source that notifies you of the changes in your data (as, in this case, a "row inserted" event), then the reception of the notification is the right place in which you can invoke "Update".
    As you can see, in this case, you don't have to create your own threads, but you can just lean on the threads used by your external source to issue the notifications.

    The only problem for you is to ensure that, if multiple rows are inserted at once, you will invoke Update once for each new row and in the same order.
    In particular, if you have separated the data in three items, then what is important is that subsequent rows inserted for the same item give rise to invocations of Update in the same order.
    Once you have ensured that, your client will receive the real-time updates correctly.
    Okay never mind, i got this :d . By the way, please help me one more thing. I got the Run method below:
    Code:
    public void Run()
      {    
         go = true;
         int c = 0; 
         Random rand = new Random();
          while (go)      {              
              IDictionary eventData = new Hashtable();
              eventData["message"] = c % 2 == 0 ? "Hello" : "World";       
              eventData["timestamp"] = DateTime.Now.ToString("s");
              _listener.Update("greetings", eventData, false);  
              c++;       
              Thread.Sleep(1000 + rand.Next(2000));      
        }  
    }
    How can i pass some parameters to this method? Coz if i do that, i get stuck the code below
    Code:
    Thread t = new Thread(new ThreadStart(Run));
    t.Start();
    I dont want to hard code like eventData["message"] or listener.update("greetings"). I want something like eventData[string] or listener.update(fieldname) (string and fieldname will be treated as arguments)

    Thanks in advance
    Last edited by vielktus; November 8th, 2013 at 02:27 AM.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:13 PM.