Add TestWebApp

This commit is contained in:
2022-07-14 03:42:10 +02:00
parent bf629a5ebe
commit bf8112d4ab
15 changed files with 225 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using System;
using VAR.WebFormsCore.Code;
using VAR.WebFormsCore.Controls;
using VAR.WebFormsCore.Pages;
namespace VAR.WebFormsCore.TestWebApp;
public class FrmDefault: PageCommon
{
private CTextBox _txtText = new CTextBox { ID = "txtText", CssClassExtra = "width150px", AllowEmpty = false };
private Button _btnTest = new Button { ID = "btnTest", };
private Label _lblMessage = new Label { ID = "lblMessage", };
public FrmDefault()
{
MustBeAuthenticated = false;
Init += FrmLogin_Init;
}
private void FrmLogin_Init(object sender, EventArgs e)
{
InitializeControls();
}
private void InitializeControls()
{
Title = MultiLang.GetLiteral("Default");
var lblTitle = new Label { Text = Title, Tag = "h2" };
Controls.Add(lblTitle);
Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Text"), _txtText));
_txtText.PlaceHolder = MultiLang.GetLiteral("Text");
Controls.Add(FormUtils.CreateField(string.Empty, _btnTest));
_btnTest.Text = MultiLang.GetLiteral("Test");
_btnTest.Click += BtnTest_Click;
Controls.Add(FormUtils.CreateField(string.Empty, _lblMessage));
}
private void BtnTest_Click(object? sender, EventArgs e)
{
_lblMessage.Text = $"Hello World: {_txtText.Text}";
}
}