コード例 #1
0
 private static void SetDirect(IDynamicPropertySupport support)
 {
     lock (typeof(ConfigurationManager))
     {
         m_Config = support;
         DynamicProperty.RegisterWithDynamicPropertySupport(support);
         m_InitializedWithDefaultConfig = false;
     }
 }
コード例 #2
0
 internal static void Initialize(IDynamicPropertySupport config)
 {
     lock (typeof(DynamicProperty))
     {
         m_DynamicPropertySupportImpl = config;
         config.ConfigurationChanged += OnConfigurationChanged;
         UpdateAllProperties();
     }
 }
コード例 #3
0
 /// <summary>
 /// Initialize the factory with a <see cref="IDynamicPropertySupport"/>.
 ///
 /// The initialization will register a {@link PropertyListener} with the DynamicPropertySupport so that DynamicProperty
 /// will receives a callback and refresh its value when a property is changed.
 ///
 /// If the factory is already initialized with a default configuration source (see <see cref="GetInstance"/>), it will re-register
 /// itself with the new configuration source passed to this method. Otherwise, this method will throw IllegalArgumentException
 /// if it has been initialized with a non-default configuration source. This method should be only called once.
 /// </summary>
 /// <param name="dynamicPropertySupport">DynamicPropertySupport to be associated with the DynamicProperty</param>
 /// <returns>the instance of DynamicPropertyFactory</returns>
 internal static DynamicPropertyFactory InitWithConfigurationSource(IDynamicPropertySupport dynamicPropertySupport)
 {
     if (dynamicPropertySupport == null)
     {
         throw new ArgumentNullException("dynamicPropertySupport");
     }
     lock (typeof(ConfigurationManager))
     {
         AbstractConfiguration configuration = null;
         if (dynamicPropertySupport is AbstractConfiguration)
         {
             configuration = (AbstractConfiguration)dynamicPropertySupport;
         }
         else if (dynamicPropertySupport is ConfigurationBackedDynamicPropertySupport)
         {
             configuration = ((ConfigurationBackedDynamicPropertySupport)dynamicPropertySupport).Configuration;
         }
         if (InitializedWithDefaultConfig)
         {
             m_Config = null;
         }
         else if (m_Config != null && m_Config != dynamicPropertySupport)
         {
             throw new InvalidOperationException("DynamicPropertyFactory is already initialized with a diffrerent configuration source: "
                                                 + m_Config);
         }
         if (ConfigurationManager.IsConfigurationInstalled &&
             (configuration != null && configuration != ConfigurationManager.GetConfigInstance()))
         {
             throw new InvalidOperationException("ConfigurationManager is already initialized with configuration "
                                                 + ConfigurationManager.GetConfigInstance());
         }
         if (configuration != null && configuration != ConfigurationManager.GetConfigInstance())
         {
             ConfigurationManager.SetDirect(configuration);
         }
         SetDirect(dynamicPropertySupport);
         return(m_Instance);
     }
 }
コード例 #4
0
 internal static void RegisterWithDynamicPropertySupport(IDynamicPropertySupport config)
 {
     Initialize(config);
 }