Source/CommandLink.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.ComponentModel;

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Represents the base class that provides link between DotNetBar BaseItem commands and typed code representation for them.
    /// </summary>
    [ToolboxItem(false), DesignTimeVisible(false), DefaultEvent("Click")]
    public class CommandLink : Component
    {
        #region Private Variables
        private string m_Name = "";
        private DotNetBarManager m_Manager = null;
        private static string CommandPrefix = "cmd";
        #endregion

        #region Events
        /// <summary>
        /// Occurs when item connected to the command link is clicked.
        /// </summary>
        public event EventHandler Click;
        #endregion

        /// <summary>
        /// Returns name of the item that can be used to identify item from the code. You should not set this property directly since it is populated by DotNetBar designer.
        /// </summary>
        [Browsable(false), Category("Design"), Description("Indicates the name used to identify item command link is connected to.")]
        public string Name
        {
            get
            {
                if (this.Site != null)
                    m_Name = this.Site.Name;
                return m_Name;
            }
            set
            {
                if (this.Site != null)
                    this.Site.Name = value;
                if (value == null)
                    m_Name = "";
                else
                    m_Name = value;
            }
        }

        protected virtual BaseItem GetItem(Type expectedItemType)
        {
            if (this.Manager == null)
                throw new InvalidOperationException("Manager property is not assigned to the instance of DotNetBarManager this CommandLink is linking to.");

            string itemName = GetItemName(this.Name);
            if (itemName == "")
            {
                throw new InvalidOperationException("Command link name is not in expected format. Could not retrive item.");
            }

            BaseItem item = this.Manager.GetItem(itemName, true);
后面还有 84 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。