Example #1
0
        private void ReloadForm()
        {
            if (_currentIndex == Interview.Survey.Questions.Rows.Count - 1)
            {
                menuItemNextQuestion.Text = "Finalizar";
            }
            else
            {
                menuItemNextQuestion.Text = "Próximo";
            }

            menuItemPreviousQuestion.Enabled = _currentIndex > 0;
            //menuItemGoTo.Enabled = _currentIndex > 0;
            inputPanel1.Enabled = false;
            lblHeader.Text      = String.Format("Pergunta {0} de {1}", _currentIndex + 1, Interview.Survey.NumberOfQuestions);

            var question = Interview.Survey.Questions.Rows[_currentIndex]["Question"].ToString();

            _currentQuestionId = Convert.ToInt32(Interview.Survey.Questions.Rows[_currentIndex]["Id"]);

            lblQuestion.Text     = question;
            lblQuestion.Width    = this.Width - 18;
            lblQuestion.Height   = CFMeasureString.MeasureString(lblQuestion, lblQuestion.Text, lblQuestion.ClientRectangle).Height;
            lblInstructions.Top  = lblQuestion.Bottom + 10;
            lblDbInstruction.Top = lblInstructions.Top + 20;

            _panel       = new Panel();
            _panel.Top   = lblDbInstruction.Top;
            _panel.Width = this.Width - 18;
            _panel.Left  = 3;

            if (!String.IsNullOrEmpty(Interview.Survey.Questions.Rows[_currentIndex]["Instruction"].ToString()))
            {
                lblDbInstruction.Text   = Interview.Survey.Questions.Rows[_currentIndex]["Instruction"].ToString();
                lblDbInstruction.Height = CFMeasureString.MeasureString(lblDbInstruction, lblDbInstruction.Text, lblDbInstruction.ClientRectangle).Height;
                _panel.Top = lblDbInstruction.Bottom + 5;
                lblDbInstruction.Show();
            }
            else
            {
                lblDbInstruction.Hide();
                _panel.Top = lblDbInstruction.Top;
            }
            this.Controls.Add(_panel);
        }
Example #2
0
        private int PlaceComponents <T>(DataRow[] options, List <T> list)
        {
            int top = 0;

            for (int i = 0; i < options.Count(); i++)
            {
                Control option = list[i] as Control;
                option.Tag = i + 1;
                var label = new Label();
                label.Text   = options[i]["Option"].ToString();
                label.Left   = 20;
                label.Width  = _panel.Width - label.Left;
                label.Height = CFMeasureString.MeasureString(label, label.Text, label.ClientRectangle).Height;
                option.Width = 20;
                option.Top   = top;
                label.Top    = top + 2;
                _panel.Controls.Add(option);
                _panel.Controls.Add(label);
                top = label.Bottom + 10;
            }
            return(top);
        }
Example #3
0
        private void DoStep()
        {
            currentNode = workflowManager.NextNode(currentNode);

            StopLoader();

            if (currentNode == null)
            {
                #region Filling Complete

                //result.Push(current.OuterXml);

                //Modify this part
                Panel.Controls.Clear();

                Label l = new Label();
                l.Width = 1000;
                StringBuilder message = new StringBuilder();
                message.Insert(0, workflowManager.Result.OuterXml);

                l.Text     = message.ToString();
                l.Height   = CFMeasureString.MeasureString(l, message.ToString(), l.ClientRectangle).Height;
                l.Location = new Point(30, 100);
                Panel.Controls.Add(l);
                Next.Text    = "Send";
                Back.Enabled = false;
                Back.Text    = "";
                Refresh();

                #endregion

                return;
            }

/*
 *          if (currentNode != null)
 *              if (!currentNode.Name.Equals(currentNode.Name))
 *                  currentNode.GetType();//result.Push(current.OuterXml + " ");
 *              else
 *              {
 *                  notification.Text = "Error";
 *                  notification.Visible = true;
 *                  return;
 *              }
 */
            PrepareTransition();
            Panel.Controls.Clear();

            #region Rendering

            List <Control> controls = new List <Control>();
            for (int i = 0; i < currentNode.Data.Length; i++)
            {
                controls.Add(currentNode.Data[i].Render(this.Bounds));
            }
            //Controls disposition

            int offset = TopOffset;
            foreach (Control c in controls)
            {
                c.LostFocus += new EventHandler(OnLostFocus);
                c.Top        = offset;
                offset      += c.Height + controlDistance;
                this.Panel.Controls.Add(c);
                this.Controls.Add(this.Panel);
            }

            #endregion

            if (currentNode != null)
            {
                StartForwardTransition();
            }
        }