We have a windows workflow application that uses infopath as its form engine.To manage our forms we are using FormServer on a Sharepoint server therefore we are using a web browser control and a web page to host infopath forms (using XmlFormView control).
To obtain the form data we are using a hidden field in our web page that is populated everytime the form is postback so we can get its content using Document.GetElementById() in our win app.(We are using DocumentCompleted event of WebBrowser control to be sure that the document is loaded in web browser)
This approach seems to work but we have some serious problems here:
1.Sometimes it seems that the web page is not loaded completely and thus there's no hidden field to retrieve so the data is lost.
2.To get the form data from XmlFormView we first use XmlFormView.DataBind() method and then XmlFormView.MainDataSource().CreateNavigator().InnerXml to get form data but sometimes CreateNavigator() returns null as if there's no form is loaded into XmlFormView control.
So here's my question: Since all we want is to get the form data it doesn't matter how we will do it and it seems that getting data from a hidden field is our problem (that we have to handle data manually) I'd like to know if there's a better way to do that ?