beckhoff TX1000 — 3.1 Sample for a machine with Microsoft Silverlight for Windows Embedded

Samples Silverlight if (FAILED(retcode=root->FindName(TEXT("txtCount", &txtCount))) return -1; if (FAILED(retcode=root->FindName(TEXT("prgSteps", &prgSteps))) return -1; // Get timelines by nameif (FAILED (retcode=root- >FindName(TEXT("timelineDeviceDown"), &timelineDeviceDown))) return -1; if (FAILED (retcode=root->FindName(TEXT("timelineDeviceUp"), &timelineDeviceUp))) return -1; if (FAILED (retcode=root->FindName(TEXT("timelineEngine"), &timelineEngine))) return -1; Creating the "RadioButtonGroup" and assigning the two radio buttons from this group.

WCHAR groupName[17]; wsprintf(groupName, L"RadioButtonGroup"); radSpeedFast->SetGroupName(groupName); radSpeedSlow->SetGroupName(groupName); A redirecting object is needed to link the EventHandler with the buttons. BtnEventHandler handler; // Set the event handler for the buttonsif (FAILED(retcode=CreateDelegate(&handler, &BtnEventHan dler::OnClick, &clickdelegate))) return -1; if (FAILED(retcode=butClose->btnAddClickEventHandler(clickdelegate))) return -1; if (FAILED(retcode=radSpeedSlow->AddClickEventHandler(clickdelegate))) return -1; if (FAILED(retcode=radSpeedFast->AddClickEventHandler(clickdelegate))) return -1; Integrating the Ads components.

long adserror = -1; port = AdsPortOpenEx(); AdsGetLocalAddressEx(port, &addr); // connect to the PLC and register callbacks addr.port = 0x321; adserror = connect(port, &addr, Callback); event_cnt = 0; event_cntold = -1; // init timer for reconnect SetTimer(NULL, NULL, 5000, MyTimerProc); if (FAILED(retcode=vhost->StartDialoge(&exitcode))) return -1; // cleanup disconnect(port, &addr); clickdelegate->Release(); return 0; } 7. Properties A connection to xamlruntime.lib and TcAdsDllCe.lib must be made in the project properties. TX1000 21 Version: 1.2