コード例 #1
0
 /// <summary>
 /// Event handler to check when PI Point creation process should be written to console.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="eventArgs"></param>
 private void NotifyPIPointCreationToConsole(object sender, AFProgressEventArgs eventArgs)
 {
     if (eventArgs.ToString().Contains("Succeeded"))
     {
         lock (_updateLock)
         {
             _conf.PointsCreated += eventArgs.OperationsCompleted;
             ReportTiming(_conf.PointsCreated, _conf.TotalPoints, "PI Point");
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Process a list of AF Attributes
        /// </summary>
        /// <param name="attributes"></param>
        /// <param name="updateProgress"></param>
        private static void ProcessAttributes(IList <AFAttribute> attributes, EventHandler <AFProgressEventArgs> updateProgress = null)
        {
            PIServer targetPI = null;
            IDictionary <string, IDictionary <string, object> > pointDefinitions = new Dictionary <string, IDictionary <string, object> >();

            var PIPointInfoList = new List <PIPointInfo>();

            foreach (AFAttribute attr in attributes)
            {
                PIPointInfoList.Add(ParseConfigString(attr));
            }

            var attributesByPIDataArchive = PIPointInfoList.GroupBy(info => info.PIDataArchiveName);

            foreach (var group in attributesByPIDataArchive)
            {
                targetPI = FindTargetPIServer(group.Key);

                foreach (var info in group)
                {
                    pointDefinitions.Add(info.PointName, info.PointAttributes);
                }

                //Create PI Points
                CreatePIPoints(targetPI, pointDefinitions);
                SetConfigStrings(attributes);

                if (updateProgress != null)
                {
                    AFProgressEventArgs eventArgs = new AFProgressEventArgs(AFProgressStatus.InProgress,
                                                                            AFIdentity.AttributeList,
                                                                            new Guid(),
                                                                            "Succeeded");

                    eventArgs.OperationsCompleted = pointDefinitions.Count;
                    updateProgress(null, eventArgs);
                }

                pointDefinitions.Clear();
            }
        }
コード例 #3
0
        /// <summary>
        /// Process a list of AF Attributes
        /// </summary>
        /// <param name="attributes"></param>
        /// <param name="updateProgress"></param>
        private static void ProcessAttributes(IList<AFAttribute> attributes, EventHandler<AFProgressEventArgs> updateProgress = null)
        {
            PIServer targetPI = null;
            IDictionary<string, IDictionary<string, object>> pointDefinitions = new Dictionary<string, IDictionary<string, object>>();

            var PIPointInfoList = new List<PIPointInfo>();
            foreach (AFAttribute attr in attributes)
            {
                PIPointInfoList.Add(ParseConfigString(attr));
            }

            var attributesByPIDataArchive = PIPointInfoList.GroupBy(info => info.PIDataArchiveName);
            foreach (var group in attributesByPIDataArchive)
            {
                targetPI = FindTargetPIServer(group.Key);

                foreach (var info in group)
                {
                    pointDefinitions.Add(info.PointName, info.PointAttributes);
                }

                //Create PI Points
                CreatePIPoints(targetPI, pointDefinitions);
                SetConfigStrings(attributes);

                if (updateProgress != null)
                {
                    AFProgressEventArgs eventArgs = new AFProgressEventArgs(AFProgressStatus.InProgress,
                        AFIdentity.AttributeList,
                        new Guid(),
                        "Succeeded");

                    eventArgs.OperationsCompleted = pointDefinitions.Count;
                    updateProgress(null, eventArgs);
                }

                pointDefinitions.Clear();
            }
        }
 /// <summary>
 /// Event handler to check when PI Point creation process should be written to console.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="eventArgs"></param>
 private void NotifyPIPointCreationToConsole(object sender, AFProgressEventArgs eventArgs)
 {
     if (eventArgs.ToString().Contains("Succeeded"))
     {
         lock (_updateLock)
         {
             _conf.PointsCreated += eventArgs.OperationsCompleted;
             ReportTiming(_conf.PointsCreated, _conf.TotalPoints, "PI Point");
         }
     }
 }