Page 1 of 1

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

Posted: 02 Feb 2018, 16:31
by Jodaine Moore
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");
}
}