From bf8112d4abe823838edc6bfeb5d115e47abb276d Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Thu, 14 Jul 2022 03:42:10 +0200 Subject: [PATCH] Add TestWebApp --- .idea/.idea.VAR.WebFormsCore/.idea/.gitignore | 13 ++++++ .../.idea/encodings.xml | 4 ++ .../.idea/indexLayout.xml | 8 ++++ .idea/.idea.VAR.WebFormsCore/.idea/vcs.xml | 6 +++ VAR.WebFormsCore.TestWebApp/FrmDefault.cs | 45 +++++++++++++++++++ VAR.WebFormsCore.TestWebApp/Program.cs | 20 +++++++++ .../Properties/launchSettings.json | 28 ++++++++++++ VAR.WebFormsCore.TestWebApp/Scripts/keep.txt | 0 VAR.WebFormsCore.TestWebApp/Startup.cs | 25 +++++++++++ VAR.WebFormsCore.TestWebApp/Styles/keep.txt | 0 .../TestWebAppGlobalConfig.cs | 24 ++++++++++ .../VAR.WebFormsCore.TestWebApp.csproj | 13 ++++++ .../appsettings.Development.json | 8 ++++ VAR.WebFormsCore.TestWebApp/appsettings.json | 9 ++++ VAR.WebFormsCore.sln | 22 +++++++++ 15 files changed, 225 insertions(+) create mode 100644 .idea/.idea.VAR.WebFormsCore/.idea/.gitignore create mode 100644 .idea/.idea.VAR.WebFormsCore/.idea/encodings.xml create mode 100644 .idea/.idea.VAR.WebFormsCore/.idea/indexLayout.xml create mode 100644 .idea/.idea.VAR.WebFormsCore/.idea/vcs.xml create mode 100644 VAR.WebFormsCore.TestWebApp/FrmDefault.cs create mode 100644 VAR.WebFormsCore.TestWebApp/Program.cs create mode 100644 VAR.WebFormsCore.TestWebApp/Properties/launchSettings.json create mode 100644 VAR.WebFormsCore.TestWebApp/Scripts/keep.txt create mode 100644 VAR.WebFormsCore.TestWebApp/Startup.cs create mode 100644 VAR.WebFormsCore.TestWebApp/Styles/keep.txt create mode 100644 VAR.WebFormsCore.TestWebApp/TestWebAppGlobalConfig.cs create mode 100644 VAR.WebFormsCore.TestWebApp/VAR.WebFormsCore.TestWebApp.csproj create mode 100644 VAR.WebFormsCore.TestWebApp/appsettings.Development.json create mode 100644 VAR.WebFormsCore.TestWebApp/appsettings.json create mode 100644 VAR.WebFormsCore.sln diff --git a/.idea/.idea.VAR.WebFormsCore/.idea/.gitignore b/.idea/.idea.VAR.WebFormsCore/.idea/.gitignore new file mode 100644 index 0000000..e2b642c --- /dev/null +++ b/.idea/.idea.VAR.WebFormsCore/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/.idea.VAR.WebFormsCore.iml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.VAR.WebFormsCore/.idea/encodings.xml b/.idea/.idea.VAR.WebFormsCore/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.VAR.WebFormsCore/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.VAR.WebFormsCore/.idea/indexLayout.xml b/.idea/.idea.VAR.WebFormsCore/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.VAR.WebFormsCore/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.VAR.WebFormsCore/.idea/vcs.xml b/.idea/.idea.VAR.WebFormsCore/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.VAR.WebFormsCore/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/VAR.WebFormsCore.TestWebApp/FrmDefault.cs b/VAR.WebFormsCore.TestWebApp/FrmDefault.cs new file mode 100644 index 0000000..dbf385a --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/FrmDefault.cs @@ -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}"; + } +} \ No newline at end of file diff --git a/VAR.WebFormsCore.TestWebApp/Program.cs b/VAR.WebFormsCore.TestWebApp/Program.cs new file mode 100644 index 0000000..0b4c917 --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/Program.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace VAR.WebFormsCore.TestWebApp +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/VAR.WebFormsCore.TestWebApp/Properties/launchSettings.json b/VAR.WebFormsCore.TestWebApp/Properties/launchSettings.json new file mode 100644 index 0000000..aee16af --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:14577", + "sslPort": 44334 + } + }, + "profiles": { + "VAR.WebFormsCore.TestWebApp": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7260;http://localhost:5128", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/VAR.WebFormsCore.TestWebApp/Scripts/keep.txt b/VAR.WebFormsCore.TestWebApp/Scripts/keep.txt new file mode 100644 index 0000000..e69de29 diff --git a/VAR.WebFormsCore.TestWebApp/Startup.cs b/VAR.WebFormsCore.TestWebApp/Startup.cs new file mode 100644 index 0000000..24ff415 --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/Startup.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.DependencyInjection; +using VAR.WebFormsCore.Code; + +namespace VAR.WebFormsCore.TestWebApp +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + // If using Kestrel: + services.Configure(options => + { + options.AddServerHeader = false; + }); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + app.UseGlobalRouterMiddleware(env); + } + } +} \ No newline at end of file diff --git a/VAR.WebFormsCore.TestWebApp/Styles/keep.txt b/VAR.WebFormsCore.TestWebApp/Styles/keep.txt new file mode 100644 index 0000000..e69de29 diff --git a/VAR.WebFormsCore.TestWebApp/TestWebAppGlobalConfig.cs b/VAR.WebFormsCore.TestWebApp/TestWebAppGlobalConfig.cs new file mode 100644 index 0000000..3711e80 --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/TestWebAppGlobalConfig.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Microsoft.AspNetCore.Http; +using VAR.WebFormsCore.Code; + +namespace VAR.WebFormsCore.TestWebApp; + +public class TestWebAppGlobalConfig: IGlobalConfig +{ + public string Title { get; } = "TestWebApp"; + public string TitleSeparator { get; } = " :: "; + public string Author { get; } = "XXX"; + public string Copyright { get; } = "Copyright (c) 2022 by XXX, All Right Reserved"; + public string DefaultHandler { get; } = nameof(FrmDefault); + public string LoginHandler { get; } + public List AllowedExtensions { get; } = new List { ".png", ".jpg", ".jpeg", ".gif", ".ico", ".wav", ".mp3", ".ogg", ".mp4", ".webm", ".webp", ".mkv", ".avi" }; + public bool IsUserAuthenticated(HttpContext context) + { + return false; + } + + public void UserUnauthenticate(HttpContext context) + { + } +} \ No newline at end of file diff --git a/VAR.WebFormsCore.TestWebApp/VAR.WebFormsCore.TestWebApp.csproj b/VAR.WebFormsCore.TestWebApp/VAR.WebFormsCore.TestWebApp.csproj new file mode 100644 index 0000000..a0860e1 --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/VAR.WebFormsCore.TestWebApp.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/VAR.WebFormsCore.TestWebApp/appsettings.Development.json b/VAR.WebFormsCore.TestWebApp/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/VAR.WebFormsCore.TestWebApp/appsettings.json b/VAR.WebFormsCore.TestWebApp/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/VAR.WebFormsCore.TestWebApp/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/VAR.WebFormsCore.sln b/VAR.WebFormsCore.sln new file mode 100644 index 0000000..27df3df --- /dev/null +++ b/VAR.WebFormsCore.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.WebFormsCore", "VAR.WebFormsCore\VAR.WebFormsCore.csproj", "{E0E00013-9FEF-4E28-A9FC-27A965737FBB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.WebFormsCore.TestWebApp", "VAR.WebFormsCore.TestWebApp\VAR.WebFormsCore.TestWebApp.csproj", "{0D81464B-802D-4ECA-92C8-427F481A4583}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E0E00013-9FEF-4E28-A9FC-27A965737FBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0E00013-9FEF-4E28-A9FC-27A965737FBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0E00013-9FEF-4E28-A9FC-27A965737FBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0E00013-9FEF-4E28-A9FC-27A965737FBB}.Release|Any CPU.Build.0 = Release|Any CPU + {0D81464B-802D-4ECA-92C8-427F481A4583}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D81464B-802D-4ECA-92C8-427F481A4583}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D81464B-802D-4ECA-92C8-427F481A4583}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D81464B-802D-4ECA-92C8-427F481A4583}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal