示例#1
0
        }//ProcessData

        #endregion

        #region Private Methods

        private void SendData(List <List <AFValue> > valueLists)
        {
            //This method sends data to the destination PI Data Archive

            List <Task <OSIsoft.AF.AFErrors <AFValue> > > sendDataTasks = new List <Task <OSIsoft.AF.AFErrors <AFValue> > >();

            foreach (List <AFValue> valueList in valueLists)
            {
                //Convert each AFValue to have the proper PI point property for the destination PI Data Archive
                Parallel.ForEach(valueList, value => value.PIPoint = PIPoints.CurrentPIPoints_Dictionary[value.PIPoint.Name]);

                //Actually make the call to send the data
                var sendDataTask = DestinationServer.UpdateValuesAsync(valueList, AFUpdateOption.Insert, AFBufferOption.BufferIfPossible);
                sendDataTasks.Add(sendDataTask);
            }

            var allResults = Task.WhenAll(sendDataTasks);

            Parallel.ForEach(allResults.Result, result => LogSendDataError(result));
        }//SendData