Beispiel #1
0
        /// <summary>
        /// Execute une strategie
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="context">The context.</param>
        /// <param name="strategy">The strategy.</param>
        private static void RunStrategy(ICustomizableElement element, GenerationContext context, StrategyBase strategy)
        {
            ILogger logger = ServiceLocator.Instance.GetService <ILogger>();

            if (logger != null)
            {
                logger.Write("Running strategy", String.Concat("Strategy '", strategy.DisplayName, "' id : ", strategy.StrategyId), LogType.Debug);
            }
            if (context.SelectedStrategies != null && (context.SelectedStrategies != null && !context.SelectedStrategies.Contains(strategy)))
            {
                if (logger != null)
                {
                    logger.Write("Running strategy", "Strategy skipped because this is not a selected strategy", LogType.Debug);
                }
            }
            else if (context.CanGenerate(element.Id))
            {
                RunStrategyInternal(element, strategy, context);
            }
        }