예제 #1
0
        private void RenderMetrics(MetricBase metricBase, RenderingMode renderingMode, IMetricRenderer renderer, int depth, IDictionary<string, object> viewData)
        {
            try
            {
                var renderingContextValues = GetMetricRenderingContextValues(metricBase, depth, renderingMode, true);
                renderer.Render(metricTemplateBinder.GetTemplateName(renderingContextValues), metricBase, depth, viewData);
                var containerMetric = metricBase as ContainerMetric;
                if (containerMetric != null)
                {
                    foreach (var child in containerMetric.Children)
                    {
                        metricRenderingContextProvider.ProvideContext(child, viewData);

                        RenderMetrics(child, renderingMode, renderer, depth + 1, viewData);
                    }
                }
                renderingContextValues = GetMetricRenderingContextValues(metricBase, depth, renderingMode, false);
                renderer.Render(metricTemplateBinder.GetTemplateName(renderingContextValues), metricBase, depth, viewData);
            }
            catch (Exception ex)
            {
				throw new InvalidOperationException(string.Format("Failed to render metricId:{0}  metricVariantId:{1}  name:{2}", metricBase.MetricId, metricBase.MetricVariantId, metricBase.Name), ex);
            }
        }
예제 #2
0
 public void RenderMetrics(MetricBase metricBase, RenderingMode renderingMode, IMetricRenderer renderer, IDictionary<string, object> viewData)
 {
     RenderMetrics(metricBase, renderingMode, renderer, 0, viewData);
 }