Demo 4 Project (View Auto Refresh)

In this demo, it shows you how to automatically refresh the view after taking an action on the iOS device. Without implementing auto refresh, you will have to manually press the refresh button (upper, right corner of the screen). The key is to set tap.url to "self" in the Demo4.xml. To test and learn more, read on.

What you will see

You will see a listing of fruits on your iOS device after scan a QR code.

What you should do

Launch Demo4.exe and iQuipment PC. If you need help on this, review the demo 1 help chapter.

Enter Demo4 URL into the iQuipment iPhone app (Review the Demo1 Project if you need help). You should see a view as shown above.

Tap the scan button (1, above) then aim the camera at the QR code (2, above).

The QR code scan fills the Barcode data field (1, on Demo4.exe UI) with a string of "Apple; Orange; Plum." Demo4.exe parse the string to three separate titles and append each title with a "(+)" tag. The new titles recombines separated by semicolon into a new string. The new string is programmably entered into the 2nd textfield(2, on Demo4.exe UI). which in turn controls the content of the table on iPhone (1, above).

Code highlight

On iQuipment PC's File menu, open Demo4.xml. Identify the first "section" node. The first row employs a "barCodeReader" controller. For this row, right click the tap.url. You will find the value is set to "self." This instructs the iPhone to refresh when the barCodeReader take a scan. In other words, when the barcode reader feeds the Demo4.exe the data, it normally only read back the barcode data return from Demo4.exe. With tap.url set to self, it instruct iPhone to reload all the data (includes the table data) from Demo4.exe after barcode scan.

Code highlight

Launch the Demo4 Visual Studio project in the SDK, Open Form1.cs. Let's go into the nuts and bolts.

The delegate function DataExchangeService_clientSetData_ID_Event handles the incoming barcode data:

void DataExchangeService_clientSetData_ID_Event(string clientIP, string viewName, string dataName, object dataValue, long processID)
if (viewName == myViewName)
switch (dataName)
case dataName_barcode:
UpdateTextGUIObject(richTextBox_barCode, (string)dataValue);
INFOMATO.WCF.DataExchangeService.serviceRequestViewChange(clientIP, viewName, "self");

The function ProcessBArCodeData appends "(+)" to each fruit and feed the new string for constructing the table on iOS device. The function INFOMATO.WCF.DataExchangeService.serviceRequestViewChange(clientIP, viewName, "self") is responsible for the refresh of the view data. Review below section for more details about this function.


In order to automatically update the table on your iOS device, you need to call

INFOMATO.WCF.DataExchangeService.serviceRequestViewChange(clientIP, viewName, value).

This function lets you control the view on iOS device to switch to another view if desired. If your current view is not shown with a tab bar (a bar at the bottom of a view on iOS device for quick view switching), it will push another view into the navigation stack so that the current view becomes the parent view. For instance, if you set the value to "demo1", the iOS device will switch to demo1 view and showing a back button (top, left corner on iOS device) for you to return to the current view. If your current view is shown with a tab bar (because either its xml file contains a "tabBar" sub node under the "view" node, or a user tapped a tab bar button that led to the current view), it will simply switch to the "demo1" view. Please note that views may be organized by navigation stack or tab bar. When views are organized by a tab bar, the view navigation hierarchy becomes flat. When views are organized by navigation stack, it is easy to trace back the chain of view hierarchy but not easily to switch between views that do not follow a clear hierarchy.

When you feed the value with a special keyword "self" or "refresh," this function will refresh the current view instead. Other special keywords include "home" or "root" for popping out all the views in the iOS navigation controller (navigate by click the back button on the top, left of the iOS device) except the root view (last view), "back" or "pop" for popping out just the current view and display the parent view (that leads to the current view). The special keyword "hom" or "back" has no effects if the current view is shown by a tab bar.

Previous Lesson: Demo 3 Project (Photo Shows) Table of Contents Next Lesson: Demo 5 Project (Table Icons)