Ejemplo n.º 1
0
        /// <summary>
        /// Creates an integer widget
        /// </summary>
        /// <param name="widget">Widget settings</param>
        /// <param name="style">Style for the widget</param>
        /// <param name="result">Styled Widget</param>
        private void CreateIntWidget(IntQuestionManager widget, WindowsStyleProperties style, ref Control result)
        {
            // Create textbox for integers
            TextBox input = ConstructTextbox <int>(widget, style, ref result);

            // Add change listener
            input.TextChanged += delegate(object sender, EventArgs e) { ChangedIntWidget(widget, input); };
        }
 public void Initialize()
 {
     _elementManagerDisplayContoller = new ElementManagerDisplayContollerWindows();
     _intWidget    = new IntQuestionManager("a", "q1", null, _elementManagerDisplayContoller);
     _boolWidget   = new BoolQuestionManager("b", "q2", null, _elementManagerDisplayContoller);
     _stringWidget = new StringQuestionManager("c", "q3", null, _elementManagerDisplayContoller);
     _formManager  = new FormManager("d", "form", _elementManagerDisplayContoller);
 }
Ejemplo n.º 3
0
        public void Initialize()
        {
            _widgetStyle = new WindowsStyleProperties();

            _widgetDisplayController = new ElementManagerDisplayContollerWindows(null, 10);
            _intWidget    = new IntQuestionManager("a", "q1", null, _widgetDisplayController);
            _boolWidget   = new BoolQuestionManager("b", "q2", null, _widgetDisplayController);
            _stringWidget = new StringQuestionManager("c", "q3", null, _widgetDisplayController);
        }
Ejemplo n.º 4
0
 private void UpdateIntWidget(IntQuestionManager widget, Control control)
 {
     foreach (Control b in control.Controls)
     {
         if (b.GetType() == typeof(TextBox))
         {
             b.Text = widget.Answer.Value.ToString();
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Int widget change event
        /// </summary>
        /// <param name="intWidget">Sending widget</param>
        /// <param name="input">Input textbox</param>
        private void ChangedIntWidget(IntQuestionManager intWidget, TextBox input)
        {
            // Parse value
            QuestionElementValue <int> value = intWidget.ParseInput(input.Text);

            // Assign parsed answer to input
            if (value.IsValid)
            {
                input.Text = value.Value.ToString();
                intWidget.SetAnswer(value.Value);
            }
            else if (input.Text != "")
            {
                input.Text = value.Value.ToString();
            }

            // Launch update
        }