Subby
Subby

Reputation: 5480

Windows Phone and Website Request

I wish to send a request to a Website (server) to update a potential scoreboard which everyone who has the application can see. This website isn't of course restricted to just the application users - but it can be accessible to anyone.

Is it possible to call a WCF from a Windows Phone app for example where the WCF can then update the database. So whenever someone goes on the website, the updated changes will be seen.

Is this at all possible? And if it is, would this be the most sensible/optimised way of doing things?

Upvotes: 0

Views: 23

Answers (1)

Echilon
Echilon

Reputation: 10254

I did this using a BsckgroundWorker in my ViewModel to prevent hanging the UI. This way, you can "set it and forget it". Something like this:

private void UpdateScoreboard()
{ 
  var scoreboardWorker = new BackgroundWorker();
  scoreboardWorker.DoWork += (s,dwe)=>{
       //call some WCF service compleate async
  };
  scoreboardWorker.RunWorkerCompleted += (s,rwe)=>{
       // check whether rwe.Error is not null, indicating an exception. Show an alert maybe
  };
  scoreboardWorker.RunWorkerAsync();
}

Upvotes: 1

Related Questions