Exemplo n.º 1
0
        private object menuCommand; //ICommand or IViewProvider

        public ToolBarCommand(XmlNode node, IBundle owner, bool createCommand)
        {
            RightToLeft = RightToLeft.Inherit;
            this.node   = node;
            this.owner  = owner;

            if (createCommand)
            {
                LoadClass();
            }

            if (Image == null)
            {
                string icon = XmlUtility.ReadAttribute(node, "icon");
                if (!string.IsNullOrEmpty(icon))
                {
                    Image = ResourcesUtility.TryGetBitmap(owner.LoadResource(icon, ResourceLoadMode.ClassSpace));
                }
            }
            Text        = XmlUtility.ReadAttribute(node, "text");
            ToolTipText = XmlUtility.ReadAttribute(node, "tooltip");
            commandName = XmlUtility.ReadAttribute(node, "command");

            if (!string.IsNullOrEmpty(commandName))
            {
                _statusMonitor = new CommandStatusMonitor(commandName, enable => Enabled = enable,
                                                          visible => Visible = visible);
            }
        }
Exemplo n.º 2
0
        public ToolBarCommand(XmlNode node, IBundle owner, bool createCommand)
        {
            RightToLeft = RightToLeft.Inherit;
            this.node   = node;
            this.owner  = owner;

            if (createCommand)
            {
                LoadClass();
            }

            if (Image == null)
            {
                string icon = XmlUtility.ReadAttribute(node, "icon");
                if (!string.IsNullOrEmpty(icon))
                {
                    Image = ResourcesUtility.TryGetBitmap(owner.LoadResource(icon, ResourceLoadMode.ClassSpace));
                }
            }
            Text        = XmlUtility.ReadAttribute(node, "text");
            ToolTipText = XmlUtility.ReadAttribute(node, "tooltip");
        }