How to turn on async on the dataItem function in remoting 4

Q and A about functionality and how to solve a special task for your application.

How to turn on async on the dataItem function in remoting 4

Postby Jodaine Moore » 02 Feb 2018, 16:31

I am using ventuz remoting 4 in my remoting app. I am in a scenario where I am clicking next and previous on a counter but each time I change the counter through my app I would like to get the index back to my app but if I do not use a sleep after the first async method the index that I get back is incorrect. Would I like to get the current index (after execution) without sleeping? Are these method fully async? I also try setting the async state to true but the index is still incorrect.

private async void MainIndexPrevPopup(object sender, RoutedEventArgs e)
{
try
{
// This invoke the prev on the counter node
await this._LocalCluster.DataItem(this._LocalSceneIID.IID.Value, ".MainIndex.MainPopupPrevious", null, null, null);
System.Threading.Thread.Sleep(500);

// Gets the index of the counter from the ventuz into my app
object o = await this._LocalCluster.DataItem(this._LocalSceneIID.IID.Value, ".MainIndex.MainIndexPopupCurrentIndex", null);

}
catch (Exception ex)
{
LogFileController.WriteCurrentErrorOrWarningToXmlFile(ex.Message, "MainIndexPrevPopup");
}
}
Jodaine Moore
 
Posts: 27
Joined: 30 Oct 2015, 19:19

Return to How to...