Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="element"></param>
 /// <param name="config"></param>
 /// <exception cref="NotImplementedException"></exception>
 public FusionChartWrapper(IChartElement element, IChartConfig config) {
     _element = element;
     _config = config??_config;
     _elementName = determineName(_element);
     _eltype = _elementName.To<FusionChartElementType>();
     _charttype = config.Type.To<FusionChartType>();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Проверяет доступность атрибута для данного элемента в конфигурации
 /// </summary>
 /// <param name="name"></param>
 /// <param name="chartType"></param>
 /// <param name="elementType"></param>
 /// <param name="config"></param>
 /// <returns></returns>
 private static bool IsMatch(string name, FusionChartType chartType, FusionChartElementType elementType = FusionChartElementType.Chart, IChartConfig config = null) {
     var key = (elementType.ToString() + "_" + name).ToLower();
     if (Attributes.ContainsKey(key)) {
         return 0 != (Attributes[key].Charts & chartType);
     }
     //custom attribute
     return true;
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="element"></param>
 /// <param name="config"></param>
 /// <exception cref="NotImplementedException"></exception>
 public FusionChartWrapper(IChartElement element, IChartConfig config)
 {
     _element     = element;
     _config      = config ?? _config;
     _elementName = determineName(_element);
     _eltype      = _elementName.To <FusionChartElementType>();
     _charttype   = config.Type.To <FusionChartType>();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Проверяет доступность атрибута для данного элемента в конфигурации
        /// </summary>
        /// <param name="name"></param>
        /// <param name="chartType"></param>
        /// <param name="elementType"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        private static bool IsMatch(string name, FusionChartType chartType, FusionChartElementType elementType = FusionChartElementType.Chart, IChartConfig config = null)
        {
            var key = (elementType.ToString() + "_" + name).ToLower();

            if (Attributes.ContainsKey(key))
            {
                return(0 != (Attributes[key].Charts & chartType));
            }
            //custom attribute
            return(true);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Находит все атрибуты по указанному критерию
 /// </summary>
 /// <param name="chartType"></param>
 /// <param name="element"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static IEnumerable<FusionChartAttributeDescriptor> FindAttributes(FusionChartType chartType = FusionChartType.None, FusionChartElementType element = FusionChartElementType.None, string name = null) {
     return Attributes.Values.Where(
         _ => {
             if (chartType != FusionChartType.None)
             {
                 if (0 == (_.Charts & chartType)) return false;
             }
             if (element != FusionChartElementType.None)
             {
                 if (_.Element != element) return false;
             }
             if (!string.IsNullOrWhiteSpace(name)) {
                 if (name.ToLower() != _.Name.ToLower()) return false;
             }
             
             return true;
         }
         );
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Находит все атрибуты по указанному критерию
        /// </summary>
        /// <param name="chartType"></param>
        /// <param name="element"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IEnumerable <FusionChartAttributeDescriptor> FindAttributes(FusionChartType chartType = FusionChartType.None, FusionChartElementType element = FusionChartElementType.None, string name = null)
        {
            return(Attributes.Values.Where(
                       _ => {
                if (chartType != FusionChartType.None)
                {
                    if (0 == (_.Charts & chartType))
                    {
                        return false;
                    }
                }
                if (element != FusionChartElementType.None)
                {
                    if (_.Element != element)
                    {
                        return false;
                    }
                }
                if (!string.IsNullOrWhiteSpace(name))
                {
                    if (name.ToLower() != _.Name.ToLower())
                    {
                        return false;
                    }
                }

                return true;
            }
                       ));
        }