コード例 #1
0
 /// <summary>
 /// Raises the EnumeratingConfigurations event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void OnEnumeratingConfigurations(object sender, XmlConfigurationManagerEventArgs e)
 {
     try
     {
         if (EnumeratingConfigurations != null)
         {
             EnumeratingConfigurations(sender, e);
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine(ex);
     }
 }
コード例 #2
0
        /// <summary>
        /// Allows a client to retrieve all of the configurations to be displayed in a configuration properties window, or for other purposes. All SnapIns should listen for the for the EnumeratingConfigurations event, and add any configurations to the event as needed.
        /// </summary>
        /// <param name="configurations">An array of configurations that can be initially added so that the event listeners may filter them.</param>
        /// <returns></returns>
        public static XmlConfiguration[] EnumConfigurations(params XmlConfiguration[] configurations)
        {
            if (configurations == null)
            {
                configurations = new XmlConfiguration[] { }
            }
            ;

            XmlConfigurationManagerEventArgs e = new XmlConfigurationManagerEventArgs(configurations);

            OnEnumeratingConfigurations(null, e);

            return(e.Configurations.ToArray());
        }
コード例 #3
0
 /// <summary>
 /// Occurs when the configuration providers manager enumerates configuration files to display them.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnConfigurationProvidersManagerEnumeratingConfigurations(object sender, XmlConfigurationManagerEventArgs e)
 {
     e.Configurations.Add(this.Configuration);
 }