Hi again, Well, start by creating a method in your Forms project that does just that, recieves the time info, and updates the controls. You can do this with
public void updateTime(int timeSpan){
for each(Control c in this.Controls){
c.doSomething();
}
}
then, all you need to do is spawn a thread that wakes up every few minutes (or whatever period of time you want) and access the web service and retrieve the time information from your server. When it wakes up, it calls the method mentioned earlier. The code i'm about to throw in here is by no means a product of good coding practices and will definitelly have bugs as i'm writing it directly on the reply from here at CodeProject, but might just do the trick.
public class Scheduler : Thread {
private Form parentForm;
private "WebServiceProxy" webServiceProxy;
public Scheduler(Form mainForm){
this.parentForm = mainForm;
this.webServiceProxy = new "WebServiceProxy"();
}
public override void Run() {
while(true) {
int timeSpan = webServiceProxy.getTimeSpan(); // get the time elapsed
sleep(5000); // will suspend thread execution for 5 seconds
}
}
}
Now add an instance of the Scheduler to your main form. In the constructor of your form (or at the InitializeComponent method) initialize the Scheduler field and call the Run() method on it. Try it for yourself. Hope it helps