I assume this is not possible but want to make sure before I give up:
I want to automatically submit a form every five minutes while it's open in the browser. I do this to maintain a "lock" on the form, which is actually rendered as a secondary data source in another form.
I was hoping to use System.Timers, but I can't access the MainDataSource. Below is the code I'm trying to use, calling it from a button:
public void btnOpenIntro_Clicked(object sender, ClickedEventArgs e) {
Timer aTimer = new Timer(10000);
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = 2000;
aTimer.Enabled = true;
}
public void OnTimedEvent(object source, ElapsedEventArgs e) {
XPathNavigator xpxp = MainDataSource.CreateNavigator();
}
When the code reaches the last line in OnTimedEvent, it returns an UnhandledOperationException: "Operation is not valid due to the current state of the object."
Any suggestions? I'm pretty new to C#.