Пример #1
0
        /**
         * Validates the force line break at the given index, throws an
         * exception if it is invalid
         */
        public void validateBreakFlowString(int index)
        {
            BreakFlowString bp = (BreakFlowString)mBreakFlowStrings[index];

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

            int i = 0;

            foreach (BreakFlowString bpother in mBreakFlowStrings)
            {
                if ((i != index) && (bpother.mName.CompareTo(bp.mName) == 0))
                {
                    throw new System.ArgumentException("Force line break name must be unique");
                }
                i++;
            }

            if (bp.mIsRegEx)
            {
                try
                {
                    Regex regex = new Regex(bp.mString);
                }
                catch (Exception)
                {
                    throw new System.ArgumentException("Force line break regular expression is invalid");
                }
            }
        }
Пример #2
0
 /** Copy constructor does deep copy */
 public BreakFlowString(BreakFlowString other)
 {
     this.mName                    = other.mName;
     this.mString                  = other.mString;
     this.mIsRegEx                 = other.mIsRegEx;
     this.mNeverReflowLine         = other.mNeverReflowLine;
     this.mNeverReflowIntoNextLine = other.mNeverReflowIntoNextLine;
 }
 /** Copy constructor does deep copy */
 public BreakFlowString(BreakFlowString other)
 {
     this.mName = other.mName;
     this.mString = other.mString;
     this.mIsRegEx = other.mIsRegEx;
     this.mNeverReflowLine = other.mNeverReflowLine;
     this.mNeverReflowIntoNextLine = other.mNeverReflowIntoNextLine;
 }
Пример #4
0
        private void BreakFlowStringNewButton_Click(object sender, EventArgs args)
        {
            if (!validateSelectedBreakFlowString(true))
                return;

            BreakFlowString bfs = new BreakFlowString(
                "New break flow string", "string to break flow", false, true, true);

            _params.mBreakFlowStrings.Add(bfs);
            BreakFlowStringList.Items.Add(new ListViewItem(bfs.mName));
            int index = BreakFlowStringList.Items.Count-1;
            selectBreakFlowStringListItem(index);
            BreakFlowStringList.Items[index].EnsureVisible();
            BreakFlowStringList.Items[index].BeginEdit();
            updateItemsForBreakFlowString(index);
        }
 private void BreakFlowStringNewButton_Click(object sender, System.EventArgs e)
 {
     if (!validateSelectedBreakFlowString(true))
     {
         return;
     }
     BreakFlowString newObj = new BreakFlowString("New break flow string", "string to break flow",false,true,true);
     mpset.mBreakFlowStrings.Add(newObj);
     BreakFlowStringList.Items.Add(new ListViewItem(newObj.mName));
     int index = BreakFlowStringList.Items.Count-1;
     selectBreakFlowStringListItem(index);
     BreakFlowStringList.Items[index].EnsureVisible();
     BreakFlowStringList.Items[index].BeginEdit();
     updateItemsForBreakFlowString(index);
 }