Auto update of the timeline in silverlight with wcf

Mar 9, 2013 at 10:19 AM
I have the psudo code for an update of the timeline using wcf but can't get it working. see below:

Backgroundworker bw = new Backgroundworker();

public void Constructor ()
{
 bw.DoWork += new DoWorkEventHandler(bw_DoWork);

        bw.RunWorkerCompleted += 
                   new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
}

private void Update()
{
 bw.bw_DoWorkAsync();

 while (!autoEvent.WaitOne())
        {
              Dispatcher.BeginInvoke(timeline.UpdateEvents)
        }
}

private void bw_DoWork(Object sender, DoWorkEventArgs e)
{
 Dispatcher.beginInvoke(GetFreshData);
 // This event is where I refresh the collection data
}

private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
              Dispatcher.BeginInvoke(timeline.UpdateEvents) 

       //updates the timeline control where my refreshed collecton exists
}

Now, I put a break point in the bw_DoWork and bw_RunWorkerComplete which gets hit every time; however, the timeline control refresh never occurs except for the first time.

If you could give me an example of how I can get the refresh to work every 60 seconds based on my psudo code that would be great!

Thanks,


Steve Holdorf
Coordinator
Apr 19, 2013 at 2:51 AM
Try to use ResetEvens method to update collection of your events from wcf.