private void Timer_Elapsed(object aSender, System.Timers.ElapsedEventArgs aEventArgs) { object lValue = pop(); if (lValue != null) { ValueObject = lValue; try { mItemBrowser.writeItemValue(mOutValueItemHandle, lValue); } catch { mValueChanged = true; } } correctInterval(); }
public void writeSnapshot(bool aCancelOnError) { foreach (KeyValuePair <int, object> lKeyValue in mRecords) { if (mItemBrowser.getItemAccess(lKeyValue.Key).HasFlag(EAccess.WRITE)) { try { mItemBrowser.writeItemValue(lKeyValue.Key, lKeyValue.Value); } catch (Exception lExc) { string lMessage = "Error writing Item '" + mItemBrowser.getItemNameByHandle(lKeyValue.Key) + "'. " + lExc.Message; if (aCancelOnError) { throw new InvalidOperationException(lMessage, lExc); } else { Log.Error(lMessage, lExc.ToString()); } } } else { string lMessage = "No access for writing Item '" + mItemBrowser.getItemNameByHandle(lKeyValue.Key) + "'. "; if (aCancelOnError) { throw new InvalidOperationException(lMessage); } else { Log.Error(lMessage); } } } }