Example #1
0
        /// <summary>
        /// 根据XML对象设置当前元素的属性值
        /// </summary>
        /// <param name="element"></param>
        public override bool InitProperties(XElement element, IBundle bundle)
        {
            bool success = false;

            // 获取页签的唯一标识
            this.Id = element.AttibuteStringValue("id");
            if (string.IsNullOrEmpty(this.Id))
            {
                return(success);
            }
            // 获取页签名列类型
            string className = element.AttibuteStringValue("type");

            if (string.IsNullOrEmpty(className))
            {
                return(success);
            }
            // 创建页签的命令类型
            this.command = RibbonUtils.NewInstance <RibbonGroupCommand>(className, bundle);
            if (this.command == null)
            {
                return(success);
            }
            this.command.XRibbonElement = this;

            return(true);
        }
Example #2
0
        /// <summary>
        /// 根据XML对象设置当前元素的属性值
        /// </summary>
        /// <param name="element"></param>
        public override bool InitProperties(XElement element, IBundle bundle)
        {
            bool success = false;

            // 获取页签的唯一标识
            this.Id = element.AttibuteStringValue("id");
            if (string.IsNullOrEmpty(this.Id))
            {
                return(success);
            }
            // 获取图片库
            this.ImageMso = element.AttibuteStringValue("imageMso");
            // 获取用户自定义图片
            this.IconName = element.AttibuteStringValue("iconName");
            // 获取用户自定义图片加载类型
            this.LoadMode = element.AttributeEnumValue <ResourceLoadMode>("loadMode", ResourceLoadMode.Local);
            // 加载用户图片资源
            if (string.IsNullOrEmpty(this.ImageMso) &&
                !string.IsNullOrEmpty(this.IconName))
            {
                this.Image = RibbonUtils.LoadImage(this.IconName, this.LoadMode, bundle);
            }
            // 获取页签名列类型
            string className = element.AttibuteStringValue("type");

            if (string.IsNullOrEmpty(className))
            {
                return(success);
            }
            // 创建页签的命令类型
            this.command = RibbonUtils.NewInstance <RibbonMenuCommand>(className, bundle);
            if (this.command == null)
            {
                return(success);
            }
            this.command.XRibbonElement = this;

            return(true);
        }