コード例 #1
0
        public int CompareTo(ElementTag other)
        {
            var compare = TagName.CompareTo(other.TagName);

            if (compare == 0 && InputType != null)
            {
                compare = InputType.CompareTo(other.InputType);
            }
            return(compare);
        }
コード例 #2
0
        private bool CheckTagName()
        {
            if (string.IsNullOrEmpty(tbTag.Text))
            {
                return(false);
            }

            if (TagList != null)
            {
                if (TagList.FindIndex(tag => tag.Name == tbTag.Text) != -1)
                {
                    if (string.IsNullOrEmpty(TagName) || (TagName.CompareTo(tbTag.Text) != 0))
                    {
                        MessageBox.Show("标签名已存在,请重新输入!", "错误");
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #3
0
        public int CompareTo(Tag other)
        {
            if (other == null)
            {
                return(1);
            }

            int result = 0;

            result = m_Checked.CompareTo(other.m_Checked);
            if (result != 0)
            {
                return(result);
            }

            result = m_Enabled.CompareTo(other.m_Enabled);
            if (result != 0)
            {
                return(result);
            }

            result = m_Visible.CompareTo(other.m_Visible);
            if (result != 0)
            {
                return(result);
            }

            result = m_ValueSelect1.CompareTo(other.m_ValueSelect1);
            if (result != 0)
            {
                return(result);
            }

            result = m_ValueSelect2.CompareTo(other.m_ValueSelect2);
            if (result != 0)
            {
                return(result);
            }

            result = ChannelId.CompareTo(other.ChannelId);
            if (result != 0)
            {
                return(result);
            }

            result = DataBlockId.CompareTo(other.DataBlockId);
            if (result != 0)
            {
                return(result);
            }

            result = DeviceId.CompareTo(other.DeviceId);
            if (result != 0)
            {
                return(result);
            }

            result = DataType.CompareTo(other.DataType);
            if (result != 0)
            {
                return(result);
            }

            result = Address.CompareTo(other.Address);
            if (result != 0)
            {
                return(result);
            }

            result = TagName.CompareTo(other.TagName);
            if (result != 0)
            {
                return(result);
            }

            result = TagId.CompareTo(other.TagId);
            if (result != 0)
            {
                return(result);
            }

            result = Timestamp.CompareTo(other.Timestamp);
            if (result != 0)
            {
                return(result);
            }

            result = Description.CompareTo(other.Description);
            if (result != 0)
            {
                return(result);
            }

            return(result);
        }