Samples Silverlight event_cntold = event_cnt; } The following Ads Event handler is called if a PLC variable to which a link exists changes. // ADS-State Callback- Functionvoid __stdcall Callback(AmsAddr* addr, AdsNotificationHeader* handler, unsigned long User) { event_cnt++; The corresponding arrows are colored red or not, depending on whether deviceUp, deviceDown or engine is set to TRUE. This effect can be improved still further by the use of timelines.
if (User == deviceUp) { if (*(bool*)handler->data == true) { timelineDeviceDown->Stop(); timelineEngine->Stop(); timelineDeviceUp->Begin(); } } else if (User == deviceDown) { if(*bool*)handler-data == true) { timelineDeviceUp->Stop(); timelineEngine->Stop(); timelineDeviceDown->Begin(); } } else if (User == engine) { if (*(bool*)handler->data == true) { timelineDeviceDown->Stop(); timelineDeviceUp->Stop(); timelineEngine->Begin(); } } steps indicates the number of cycles. The value is output via the progress bar prgSteps . For this the data must first be converted to a byte, since the associated PLC variable is of the type byte.
Since the progress bar can only transfer data of the type float, conversion to the type float subsequently takes place. else if (User == steps) { prgSteps->SetValue((float)*((byte*)handler->data)); } In the case of count , as with steps, the data must first be converted to their original data type before they can be converted into a text and transferred to the text block txtCount . else if (User == count) { WCHAR text[6]; wsprintf(text, L"%d", *(unsigned short*)handler->data); txtCount->SetText(text); } The output of the speed type is done via RadioButtons. The appropriate radio button is marked depending on the speed. TX1000 18 Version: 1.2