I have a service that provides data to a WPF application , and one of these data is a value called Market Price that i want it to be updated every minute for example( i am just doing a simulation, so the service will return a random value). So i want to know the best and simplest way to do that.
You can try to use DispatcherTimer class.
Declare this on the constructor class and set the interval as you need:
var dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);//method to be executed
dispatcherTimer.Interval = new TimeSpan(0,0,1);//the interval is set to 1 second
dispatcherTimer.Start();
And declare a method to be executed:
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
//call WCF service and update the value
}