Example #1
0
        public override FormElement Add(int formID, ElementType type, string title, string code, FormMode mode)
        {
            FormElement fm = FormElement.Instance(formID, type, title, code, mode);

            FormElements.Add(fm);
            return(fm);
        }
        public override void Start(Pacman pacman, FormElements formElements, GameBoard gameBoard, Food food)
        {
            Start();

            myTimer.Tick    += (sender, e) => TimerEventProcessor(sender, e, pacman, food);
            myTimer.Interval = 100;
            myTimer.Start();
        }
Example #3
0
 public void FormElements()
 {
     var e = new FormElements();
     var f = e.Int(required: true);
     Assert.Equal("<input required=\"required\" name=\"f0\" value=\"\" type=\"number\" />", f.ToString());
     var result = f.Run(new Dictionary<string, string> {
         {"f0", ""},
     });
     var errorForm = result.Form.Render();
     Assert.Contains("errorinput", errorForm);
 }
Example #4
0
        public FormDesignerModule(FormTemplate template) : base()
        {
            foreach (FormElement e in template.FormElements)
            {
                FormElementWrapper w = new FormElementWrapper(e);
                FormElements.Add(w);
            }
            RowString    = template.Rows;
            ColumnString = template.Columns;
            _template    = template;

            generateInstance();
        }
Example #5
0
 public void LINQ_formlet_with_validation_error()
 {
     var e = new FormElements();
     var f = from name in e.Text()
             join age in e.Int() on 1 equals 1
             where age == 42
             select new { name, age };
     var r = f.Run(new Dictionary<string,string> {
         {"f0", "John"},
         {"f1", "44"},
     });
     Assert.False(r.Value.HasValue());
     Assert.Equal(1, r.Errors.Length);
 }
Example #6
0
 public void LINQ_formlet()
 {
     var e = new FormElements();
     var f = from name in e.Text()
             join _ in Formlet.Raw(X.E("br")) on 1 equals 1
             join age in e.Int() on 1 equals 1
             where age == 42
             select new { name, age };
     var r = f.Run(new Dictionary<string, string> {
         {"f0", "John"},
         {"f1", "42"},
     });
     Assert.True(r.Value.HasValue());
     Assert.Equal("John", r.Value.Value.name);
     Assert.Equal(42, r.Value.Value.age);
 }
Example #7
0
        private void addFormElement()
        {
            if ((ChosenFormElementOption == null) || (ChosenFormElementOption == String.Empty))
            {
                return;
            }

            if (ChosenFormElementOption == "Label")
            {
                LabelFormElement e = new LabelFormElement();
                e.Name      = "New Label";
                e.LabelText = "New Label";
                LabelElementWrapper w = new LabelElementWrapper(e);
                _template.FormElements.Add(e);
                FormElements.Add(w);
                generateInstance();
            }
            else if (ChosenFormElementOption == "Text Box")
            {
                TextFormElement e = new TextFormElement();
                e.Name = "New text box";
                FormElementWrapper w = new FormElementWrapper(e);
                _template.FormElements.Add(e);
                FormElements.Add(w);
                generateInstance();
            }
            else if (ChosenFormElementOption == "Numeric Up Down")
            {
                NumericFormElement e = new NumericFormElement();
                e.Name = "New numeric box";
                NumericElementWrapper w = new NumericElementWrapper(e);
                _template.FormElements.Add(e);
                FormElements.Add(w);
                generateInstance();
            }
        }
Example #8
0
 public GameDetailFacade()
 {
     this._formElements = new FormElements();
     this._gameBoard    = new GameBoard();
     this._highscore    = new HighScore();
 }
Example #9
0
 public override FormElement Add(FormElement formElement)
 {
     FormElements.Add(formElement);
     return(formElement);
 }