Example #1
0
        /// <summary>
        /// Resets the given subject instance with data from this string content.
        /// Note that this method calls <see cref="TrimEnd"/> thus changing the source data as well.
        /// </summary>
        /// <param name="subj">The subject instance which will be reinitialized with the data from this instance.</param>
        internal void FillSubject(Parser.Subject subj)
        {
            subj.LastInline         = null;
            subj.LastPendingInline  = null;
            subj.FirstPendingInline = null;

#if DEBUG
            subj.DebugStartIndex = 0;
#endif

            this.TrimEnd();

            if (this._partCounter == 0)
            {
                subj.Buffer   = string.Empty;
                subj.Position = 0;
                subj.Length   = 0;
                return;
            }

            if (this._partCounter > 1)
            {
                subj.Buffer   = this.ToString(subj.ReusableStringBuilder);
                subj.Position = 0;
                subj.Length   = subj.Buffer.Length;
                return;
            }

            subj.Buffer   = this._parts[0].Source;
            subj.Position = this._parts[0].StartIndex;
            subj.Length   = this._parts[0].StartIndex + this._parts[0].Length;
#if DEBUG
            subj.DebugStartIndex = this._parts[0].StartIndex;
#endif
        }
Example #2
0
        private void makeUI()
        {
            this.subj = new Parser.Subject(this.xmlSubjectDef);

            this.questionGroupPanels = new Dictionary <string, QGPanel>();

            //foreach (XmlElement elm in this.xmlSubjectDef.SelectNodes("QG"))
            //{
            foreach (Parser.QuestionGroup qGroup in this.subj.GetQuestionGroups())
            {
                QGPanel pn = new QGPanel();
                pn.Width = this.pnlContainer.Width - 10;
                pn.SetDefinition(qGroup);
                //pn.SetDefinition(elm);
                //pn.SetAnswer(this.xmlAnswers);
                //this.flowLayoutPanel1.Controls.Add(pn);
                Point p = new Point(this.padding, this.y_pos + this.padding);
                pn.Location = p;

                pn.OnContentChange += new QGPanel.ContentChange(pn_OnContentChange);

                this.pnlContainer.Controls.Add(pn);
                this.y_pos = pn.Location.Y + pn.Height;

                this.questionGroupPanels.Add(pn.GetIdentifyLabel(), pn);
            }

            this.pnlContainer.Height = this.y_pos + 5;
        }
        private void makeUI()
        {
            this.subj = new Parser.Subject(this.xmlSubjectDef);

            this.questionGroupPanels = new Dictionary<string, QGPanel>();

            //foreach (XmlElement elm in this.xmlSubjectDef.SelectNodes("QG"))
            //{
            foreach (Parser.QuestionGroup qGroup in this.subj.GetQuestionGroups())
            {
                QGPanel pn = new QGPanel();
                pn.Width = this.pnlContainer.Width - 10;
                pn.SetDefinition(qGroup);
                //pn.SetDefinition(elm);
                //pn.SetAnswer(this.xmlAnswers);
                //this.flowLayoutPanel1.Controls.Add(pn);
                Point p = new Point(this.padding, this.y_pos + this.padding);
                pn.Location = p;

                pn.OnContentChange += new QGPanel.ContentChange(pn_OnContentChange);

                this.pnlContainer.Controls.Add(pn);
                this.y_pos = pn.Location.Y + pn.Height;

                this.questionGroupPanels.Add(pn.GetIdentifyLabel(), pn);
            }

            this.pnlContainer.Height = this.y_pos + 5;
        }
 private void parseContent()
 {
     this.subj = new Parser.Subject(this.elmSubject);
     initTreeNode();
 }
 private void parseContent()
 {
     this.subj = new Parser.Subject(this.elmSubject);
     initTreeNode();
 }