Beispiel #1
0
        /// <summary>
        /// Загрузить конфигурацию компонента из XML-узла
        /// </summary>
        public override void LoadFromXml(XmlNode xmlNode)
        {
            base.LoadFromXml(xmlNode);

            BackColorOnHover   = xmlNode.GetChildAsString("BackColorOnHover");
            BorderColorOnHover = xmlNode.GetChildAsString("BorderColorOnHover");
            ImageOnHoverName   = xmlNode.GetChildAsString("ImageOnHoverName");
            Action             = xmlNode.GetChildAsEnum <Actions>("Action");

            XmlNode conditionsNode = xmlNode.SelectSingleNode("Conditions");

            if (conditionsNode != null)
            {
                Conditions = new List <ImageCondition>();
                XmlNodeList conditionNodes = conditionsNode.SelectNodes("Condition");
                foreach (XmlNode conditionNode in conditionNodes)
                {
                    ImageCondition condition = new ImageCondition {
                        SchemeView = SchemeView
                    };
                    condition.LoadFromXml(conditionNode);
                    Conditions.Add(condition);
                }
            }

            InCnlNum   = xmlNode.GetChildAsInt("InCnlNum");
            CtrlCnlNum = xmlNode.GetChildAsInt("CtrlCnlNum");
        }
        private static bool VerifyImage(IReadOnlyCollection <PhotoSize> photo, ImageCondition condition)
        {
            if (condition?.Null == null)
            {
                return(true);
            }
            if (condition.Null.Value)
            {
                if (photo.Count != 0)
                {
                    return(false);
                }
            }

            if (condition.Null.Value)
            {
                return(true);
            }
            return(photo != null && photo.Count > 0);
        }