Пример #1
0
 /** Copy constructor does deep copy */
 public BulletPoint(BulletPoint other)
 {
     this.mName = other.mName;
     this.mString = other.mString;
     this.mIsRegEx = other.mIsRegEx;
     this.mWrapIsAtRight = other.mWrapIsAtRight;
 }
Пример #2
0
 /** Copy constructor does deep copy */
 public BulletPoint(BulletPoint other)
 {
     this.mName          = other.mName;
     this.mString        = other.mString;
     this.mIsRegEx       = other.mIsRegEx;
     this.mWrapIsAtRight = other.mWrapIsAtRight;
 }
Пример #3
0
        /**
         * Validates the bullet at the given index, throws an exception if it is
         * invalid.
         */
        public void validateBullet(int index)
        {
            BulletPoint bp = (BulletPoint)mBulletPoints[index];

            if (bp.mName.Trim().Length == 0)
            {
                throw new System.ArgumentException("Bullet name must not be empty");
            }

            int i = 0;

            foreach (BulletPoint bpother in mBulletPoints)
            {
                if ((i != index) && (bpother.mName.CompareTo(bp.mName) == 0))
                {
                    throw new System.ArgumentException("Bullet name must be unique");
                }
                i++;
            }

            if (bp.mIsRegEx)
            {
                try
                {
                    Regex regex = new Regex(bp.mString);
                }
                catch (Exception)
                {
                    throw new System.ArgumentException("Bullet regular expression is invalid");
                }
            }
        }
Пример #4
0
        private void BulletNewButton_Click(object sender, EventArgs args)
        {
            if (!validateSelectedBullet(true))
                return;

            BulletPoint newObj = new BulletPoint("New Bullet Point", ".*",true, true);
            _params.mBulletPoints.Add(newObj);
            BulletList.Items.Add(new ListViewItem(newObj.mName));
            int index = BulletList.Items.Count-1;
            selectBulletListItem(index);
            BulletList.Items[index].EnsureVisible();
            BulletList.Items[index].BeginEdit();
            updateItemsForBullet(index);
        }