Sync data between webclient windows phone and webservice
I'm using a webclient on a windows phone 8 app, i have to sync some data
with the webservice each minutes (or by pressing a button). I put my
webclient in a private data of my object :
private WebClient client_summary;
At the launch of the app the client connects to the webservice :
client_summary = new WebClient();
client_summary.DownloadStringAsync(new Uri("random url" + info_conf.id));
client_sommaire.DownloadStringCompleted += new
DownloadStringCompletedEventHandler(client_DownloadSummaryConf);
I recovered well data, but each time i want to re sync my webclient, data
remain the same :(
DispatcherTimer TradeThread = new DispatcherTimer();
TradeThread.Interval = TimeSpan.FromSeconds(10);
TradeThread.Tick += new EventHandler(dispatcherTimer_Tick);
TradeThread.Start();
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
pivotMainList.Items.Clear();
summary.Children.Clear();
client_summary.DownloadStringAsync(new Uri("url" + info_conf.id));
}
private void client_DownloadSummaryConf(object sender,
DownloadStringCompletedEventArgs e)
{
MessageBox.Show(e.Result);
}
e.Result remain the same, whereas if I restart my app the data sync
correctly I don't understand why the sync didn't work ... Please tell me
thanks in advance.
No comments:
Post a Comment