コード例 #1
0
            public Collection <TrackingProfile> ReadProfiles()
            {
                if (this.trackingProfiles != null)
                {
                    return(this.trackingProfiles);
                }

                TrackingSection trackingSection = null;

                try
                {
                    trackingSection =
                        (TrackingSection)ConfigurationHelpers.GetSection(ConfigurationHelpers.GetSectionPath(TrackingConfigurationStrings.Tracking));
                }
                catch (ConfigurationErrorsException e)
                {
                    if (!Fx.IsFatal(e))
                    {
                        FxTrace.Exception.TraceUnhandledException(e);
                    }

                    throw;
                }

                if (trackingSection == null)
                {
                    return(null);
                }

                // Configuration elements are never null, collections are empty
                // and single elements are constructed with the property IsPresent=false
                this.trackingProfiles = new Collection <TrackingProfile>();

                foreach (ProfileElement profileElement in trackingSection.Profiles)
                {
                    if (profileElement.Workflows != null)
                    {
                        foreach (ProfileWorkflowElement workflowElement in profileElement.Workflows)
                        {
                            TrackingProfile profile = new TrackingProfile()
                            {
                                Name = profileElement.Name,
                                ImplementationVisibility = profileElement.ImplementationVisibility,
                                ActivityDefinitionId     = workflowElement.ActivityDefinitionId
                            };

                            workflowElement.AddQueries(profile.Queries);

                            this.trackingProfiles.Add(profile);
                        }
                    }
                }

                return(this.trackingProfiles);
            }
コード例 #2
0
 public Collection <TrackingProfile> ReadProfiles()
 {
     if (this.trackingProfiles == null)
     {
         TrackingSection section = null;
         try
         {
             section = (TrackingSection)ConfigurationHelpers.GetSection(ConfigurationHelpers.GetSectionPath("tracking"));
         }
         catch (ConfigurationErrorsException exception)
         {
             if (!Fx.IsFatal(exception))
             {
                 FxTrace.Exception.TraceUnhandledException(exception);
             }
             throw;
         }
         if (section == null)
         {
             return(null);
         }
         this.trackingProfiles = new Collection <TrackingProfile>();
         foreach (ProfileElement element in section.Profiles)
         {
             if (element.Workflows != null)
             {
                 foreach (ProfileWorkflowElement element2 in element.Workflows)
                 {
                     TrackingProfile item = new TrackingProfile {
                         Name = element.Name,
                         ImplementationVisibility = element.ImplementationVisibility,
                         ActivityDefinitionId     = element2.ActivityDefinitionId
                     };
                     element2.AddQueries(item.Queries);
                     this.trackingProfiles.Add(item);
                 }
             }
         }
     }
     return(this.trackingProfiles);
 }