Beispiel #1
0
        /// <summary>
        ///   Registers or overrides the given <see cref="BehaviorChainTemplateKey"/>
        ///   with the given <see cref="BehaviorChainTemplate"/>.
        /// </summary>
        public static void RegisterTemplate(BehaviorChainTemplateKey key, BehaviorChainTemplate template)
        {
            Check.NotNull(key, nameof(key));
            Check.NotNull(template, nameof(template));

            _templates[key] = template;
        }
Beispiel #2
0
 public void ReplaceConfiguration(BehaviorChainTemplateKey templateKey)
 {
     _configuration.ViewModelConfiguration = BehaviorChainConfiguration.GetConfiguration(
         templateKey,
         BehaviorFactoryConfigurations.ForViewModel <TVM>()
         );
 }
        internal static BehaviorChainConfiguration GetConfiguration(
            BehaviorChainTemplateKey templateKey,
            IBehaviorFactoryConfiguration factoryConfiguration
            )
        {
            var template = BehaviorChainTemplateRegistry.GetTemplate(templateKey);

            return(template.CreateConfiguration(factoryConfiguration));
        }
        public IVMPropertyDescriptor <TValue> CustomProperty <TValue>(
            BehaviorChainTemplateKey templateKey,
            IBehaviorFactoryConfiguration factoryConfiguration,
            Action <BehaviorChainConfiguration> chainConfigurationAction
            )
        {
            var config = BehaviorChainConfiguration.GetConfiguration(templateKey, factoryConfiguration);

            chainConfigurationAction(config);
            return(CustomProperty <TValue>(config));
        }
        private IVMPropertyDescriptor <TValue> CustomProperty <TValue>(
            BehaviorChainTemplateKey templateKey,
            IBehaviorFactoryConfiguration factoryConfiguration,
            Action <BehaviorChainConfiguration> chainConfigurationAction,
            Action <BehaviorChainConfiguration> userChainConfigurationAction
            )
        {
            return(CustomProperty <TValue>(
                       templateKey,
                       factoryConfiguration,
                       config => {
                chainConfigurationAction(config);

                if (userChainConfigurationAction != null)
                {
                    userChainConfigurationAction(config);
                }
            }
                       ));
        }
Beispiel #6
0
        /// <summary>
        ///   Returns a template previously register with <see cref="RegisterTemplate"/>.
        /// </summary>
        /// <exception cref="KeyNotFoundException">
        ///   No template with the given <paramref name="key"/> was registered.
        /// </exception>
        public static BehaviorChainTemplate GetTemplate(BehaviorChainTemplateKey key)
        {
            Check.NotNull(key, nameof(key));

            return(_templates[key]);
        }