private static DateTime GetTimestampFromTrigger(Trigger trigger, List <MTConnectStreams.DataItem> dataItems)
        {
            var result = DateTime.MinValue;

            MTConnectStreams.DataItem item = dataItems.Find(x => x.DataItemId == trigger.Link);

            if (item != null)
            {
                if (item.Timestamp > result)
                {
                    result = item.Timestamp;
                }
            }

            return(result);
        }
        private static void ProcessDataItem(MTConnectStreams.DataItem item, List <StatusInfo> infos)
        {
            var info = infos.Find(x => x.Id == item.DataItemId);

            if (info != null)
            {
                info.Timestamp = item.Timestamp;

                info.PreviousValue1 = info.Value1;
                info.Value1         = item.CDATA;

                if (info.Category == MTConnect.DataItemCategory.CONDITION)
                {
                    info.PreviousValue2 = info.Value2;
                    info.Value2         = ((MTConnectStreams.Condition)item).ConditionValue.ToString();
                }
            }
        }
        private static SampleData Create(string deviceId, long agentInstanceId, MTConnectStreams.DataItem dataItem)
        {
            var obj = new SampleData();

            obj.DeviceId = deviceId;

            obj.Id = dataItem.DataItemId;
            obj.AgentInstanceId = agentInstanceId;
            obj.Sequence        = dataItem.Sequence;
            obj.Timestamp       = dataItem.Timestamp;
            obj.CDATA           = dataItem.CDATA;
            if (dataItem.Category == DataItemCategory.CONDITION)
            {
                obj.Condition = ((MTConnectStreams.Condition)dataItem).ConditionValue.ToString();
            }

            return(obj);
        }