From 9b7289569ae0d77fb60a399d54cd0b4f2b975863 Mon Sep 17 00:00:00 2001 From: 084MochalinPA Date: Wed, 15 Feb 2023 16:29:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D1=8C=D1=82?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestApp02.sln | 25 ++++++++++++++ TestApp02/App.razor | 11 ++++++ TestApp02/Data/WeatherForecast.cs | 13 +++++++ TestApp02/Data/WeatherForecastService.cs | 21 ++++++++++++ TestApp02/Pages/Counter.razor | 17 +++++++++ TestApp02/Pages/Error.cshtml | 42 +++++++++++++++++++++++ TestApp02/Pages/Error.cshtml.cs | 27 +++++++++++++++ TestApp02/Pages/FetchData.razor | 42 +++++++++++++++++++++++ TestApp02/Pages/Index.razor | 7 ++++ TestApp02/Pages/_Host.cshtml | 8 +++++ TestApp02/Pages/_Layout.cshtml | 31 +++++++++++++++++ TestApp02/Program.cs | 36 +++++++++++++++++++ TestApp02/Properties/launchSettings.json | 28 +++++++++++++++ TestApp02/Shared/MainLayout.razor | 34 ++++++++++++++++++ TestApp02/Shared/NavMenu.razor | 5 +++ TestApp02/TestApp02.csproj | 13 +++++++ TestApp02/TestApp02.sln | 25 ++++++++++++++ TestApp02/_Imports.razor | 11 ++++++ TestApp02/appsettings.Development.json | 10 ++++++ TestApp02/appsettings.json | 10 ++++++ TestApp02/wwwroot/favicon.ico | Bin 0 -> 15086 bytes 21 files changed, 416 insertions(+) create mode 100644 TestApp02.sln create mode 100644 TestApp02/App.razor create mode 100644 TestApp02/Data/WeatherForecast.cs create mode 100644 TestApp02/Data/WeatherForecastService.cs create mode 100644 TestApp02/Pages/Counter.razor create mode 100644 TestApp02/Pages/Error.cshtml create mode 100644 TestApp02/Pages/Error.cshtml.cs create mode 100644 TestApp02/Pages/FetchData.razor create mode 100644 TestApp02/Pages/Index.razor create mode 100644 TestApp02/Pages/_Host.cshtml create mode 100644 TestApp02/Pages/_Layout.cshtml create mode 100644 TestApp02/Program.cs create mode 100644 TestApp02/Properties/launchSettings.json create mode 100644 TestApp02/Shared/MainLayout.razor create mode 100644 TestApp02/Shared/NavMenu.razor create mode 100644 TestApp02/TestApp02.csproj create mode 100644 TestApp02/TestApp02.sln create mode 100644 TestApp02/_Imports.razor create mode 100644 TestApp02/appsettings.Development.json create mode 100644 TestApp02/appsettings.json create mode 100644 TestApp02/wwwroot/favicon.ico diff --git a/TestApp02.sln b/TestApp02.sln new file mode 100644 index 0000000..3ac471e --- /dev/null +++ b/TestApp02.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp02", "TestApp02\TestApp02.csproj", "{A78C4A7C-3D9B-4149-9583-2024B689D766}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A78C4A7C-3D9B-4149-9583-2024B689D766}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A78C4A7C-3D9B-4149-9583-2024B689D766}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A78C4A7C-3D9B-4149-9583-2024B689D766}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A78C4A7C-3D9B-4149-9583-2024B689D766}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3E21C979-3355-43D6-B91E-872F83AF6A84} + EndGlobalSection +EndGlobal diff --git a/TestApp02/App.razor b/TestApp02/App.razor new file mode 100644 index 0000000..843f201 --- /dev/null +++ b/TestApp02/App.razor @@ -0,0 +1,11 @@ + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/TestApp02/Data/WeatherForecast.cs b/TestApp02/Data/WeatherForecast.cs new file mode 100644 index 0000000..8a0d10e --- /dev/null +++ b/TestApp02/Data/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace TestApp02.Data +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/TestApp02/Data/WeatherForecastService.cs b/TestApp02/Data/WeatherForecastService.cs new file mode 100644 index 0000000..23c0e87 --- /dev/null +++ b/TestApp02/Data/WeatherForecastService.cs @@ -0,0 +1,21 @@ +namespace TestApp02.Data +{ + public class WeatherForecastService + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + public Task GetForecastAsync(DateTime startDate) + { + var rng = new Random(); + return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }).ToArray()); + } + } +} diff --git a/TestApp02/Pages/Counter.razor b/TestApp02/Pages/Counter.razor new file mode 100644 index 0000000..0cc164c --- /dev/null +++ b/TestApp02/Pages/Counter.razor @@ -0,0 +1,17 @@ +@page "/counter" + +Counter + +Counter +Current count: @currentCount +Click me + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/TestApp02/Pages/Error.cshtml b/TestApp02/Pages/Error.cshtml new file mode 100644 index 0000000..1271259 --- /dev/null +++ b/TestApp02/Pages/Error.cshtml @@ -0,0 +1,42 @@ +@page +@model TestApp02.Pages.ErrorModel + + + + + + + + Error + + + + + +
+
+

Error.

+

An error occurred while processing your request.

+ + @if (Model.ShowRequestId) + { +

+ Request ID: @Model.RequestId +

+ } + +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+
+
+ + + diff --git a/TestApp02/Pages/Error.cshtml.cs b/TestApp02/Pages/Error.cshtml.cs new file mode 100644 index 0000000..020a4f1 --- /dev/null +++ b/TestApp02/Pages/Error.cshtml.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Diagnostics; + +namespace TestApp02.Pages +{ + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + [IgnoreAntiforgeryToken] + public class ErrorModel : PageModel + { + public string? RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + private readonly ILogger _logger; + + public ErrorModel(ILogger logger) + { + _logger = logger; + } + + public void OnGet() + { + RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; + } + } +} diff --git a/TestApp02/Pages/FetchData.razor b/TestApp02/Pages/FetchData.razor new file mode 100644 index 0000000..0f33fc9 --- /dev/null +++ b/TestApp02/Pages/FetchData.razor @@ -0,0 +1,42 @@ +@page "/fetchdata" +@using TestApp02.Data +@inject WeatherForecastService ForecastService + +Weather forecast + +Weather forecast +This component demonstrates fetching data from the server. +@if (forecasts == null) +{ + +} +else +{ + + + Date + Temp. (C) + Temp. (F) + Summary + + + @context.Date + @context.TemperatureC + @context.TemperatureF + @context.Summary + + + + + +} + + +@code { + private WeatherForecast[]? forecasts; + + protected override async Task OnInitializedAsync() + { + forecasts = await ForecastService.GetForecastAsync(DateTime.Now); + } +} diff --git a/TestApp02/Pages/Index.razor b/TestApp02/Pages/Index.razor new file mode 100644 index 0000000..7994d54 --- /dev/null +++ b/TestApp02/Pages/Index.razor @@ -0,0 +1,7 @@ +@page "/" + +Index + +Hello, world! +Welcome to your new app, powered by MudBlazor! +You can find documentation and examples on our website here: www.mudblazor.com diff --git a/TestApp02/Pages/_Host.cshtml b/TestApp02/Pages/_Host.cshtml new file mode 100644 index 0000000..8b2532a --- /dev/null +++ b/TestApp02/Pages/_Host.cshtml @@ -0,0 +1,8 @@ +@page "/" +@namespace TestApp02.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@{ + Layout = "_Layout"; +} + + \ No newline at end of file diff --git a/TestApp02/Pages/_Layout.cshtml b/TestApp02/Pages/_Layout.cshtml new file mode 100644 index 0000000..2bbb223 --- /dev/null +++ b/TestApp02/Pages/_Layout.cshtml @@ -0,0 +1,31 @@ +@using Microsoft.AspNetCore.Components.Web +@namespace TestApp02.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + + + + + + + + + + + + + @RenderBody() + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + diff --git a/TestApp02/Program.cs b/TestApp02/Program.cs new file mode 100644 index 0000000..d3cbf13 --- /dev/null +++ b/TestApp02/Program.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Hosting.StaticWebAssets; +using MudBlazor.Services; +using TestApp02.Data; + +var builder = WebApplication.CreateBuilder(args); + +StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration); + +// Add services to the container. +builder.Services.AddRazorPages(); +builder.Services.AddServerSideBlazor(); +builder.Services.AddSingleton(); +builder.Services.AddMudServices(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapBlazorHub(); +app.MapFallbackToPage("/_Host"); + +app.Run(); \ No newline at end of file diff --git a/TestApp02/Properties/launchSettings.json b/TestApp02/Properties/launchSettings.json new file mode 100644 index 0000000..d1ff10e --- /dev/null +++ b/TestApp02/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61949", + "sslPort": 44393 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "TestApp02": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/TestApp02/Shared/MainLayout.razor b/TestApp02/Shared/MainLayout.razor new file mode 100644 index 0000000..05fd2f9 --- /dev/null +++ b/TestApp02/Shared/MainLayout.razor @@ -0,0 +1,34 @@ +@inherits LayoutComponentBase + + + + + + + + + + + + + + + TestApp02 + + + + + + @Body + + + + +@code { + bool _drawerOpen = true; + + void DrawerToggle() + { + _drawerOpen = !_drawerOpen; + } +} \ No newline at end of file diff --git a/TestApp02/Shared/NavMenu.razor b/TestApp02/Shared/NavMenu.razor new file mode 100644 index 0000000..0772484 --- /dev/null +++ b/TestApp02/Shared/NavMenu.razor @@ -0,0 +1,5 @@ + + Home + Counter + Fetch data + diff --git a/TestApp02/TestApp02.csproj b/TestApp02/TestApp02.csproj new file mode 100644 index 0000000..e477502 --- /dev/null +++ b/TestApp02/TestApp02.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/TestApp02/TestApp02.sln b/TestApp02/TestApp02.sln new file mode 100644 index 0000000..da59da8 --- /dev/null +++ b/TestApp02/TestApp02.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31717.71 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp02", "TestApp02.csproj", "{42F60A9C-C0B5-45D1-8375-151FCF1B76E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42F60A9C-C0B5-45D1-8375-151FCF1B76E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42F60A9C-C0B5-45D1-8375-151FCF1B76E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42F60A9C-C0B5-45D1-8375-151FCF1B76E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42F60A9C-C0B5-45D1-8375-151FCF1B76E9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1D3B3BEB-C060-4713-84B0-051D04A1E7FE} + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/TestApp02/_Imports.razor b/TestApp02/_Imports.razor new file mode 100644 index 0000000..cdc74ec --- /dev/null +++ b/TestApp02/_Imports.razor @@ -0,0 +1,11 @@ +@using System.Net.Http +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using MudBlazor +@using TestApp02 +@using TestApp02.Shared diff --git a/TestApp02/appsettings.Development.json b/TestApp02/appsettings.Development.json new file mode 100644 index 0000000..5173757 --- /dev/null +++ b/TestApp02/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/TestApp02/appsettings.json b/TestApp02/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/TestApp02/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/TestApp02/wwwroot/favicon.ico b/TestApp02/wwwroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..12392236657563eb8cc764f235e66d568b3a0fbb GIT binary patch literal 15086 zcmd5@3vgXU89or@;sb&xh>sx^P*g@JAPS{Yd_tiueWi_Q(uStVO_SUgeWuMhXESw* zFTgS?1+faFJmjS?j^l{KW$MUNQRF4GG;Mi{HEn^W?Ir8??>T$U?zwwz&J9WFoo@fL zyZ>{a|NgtNtV66CYy5Z%aGZ6^r!DJCmSv3_=jV^Itmjd76d=`iyvMTE0^zg30g2Uu zMCIalk_Qgt|D3VIc-Fau=bfv0&e@3c9MWc_Cwb1k2g%_DMkXCpKVB%j4?3hAp%_Srwg;P_+2y@BU?Pv%*BDe&H|fIGkot3MH^3zhSx?rD75 zr91frjXX%R7CjY56EpVr@J#QCl7_}E{D^Lm!enjQR-q7jt3+IJx zuIf(TGg~)l1bznc;fu-f>BFpjW)zp#*Vh2=*>YUHJz?kkGMp&?oO_kZpEqSE#J0P% zgZhOrc)0oxvfhZudq&3yb4K0r?zJI?=+6ZDJ1+>Re%|QK9>(ij!P__hvr7>m0uDvUuIehDNu5kpji^qxqY%+;3t~DV*EYI+m@{f`DkNOx2dtq(|=~`W=&R> zP0;Dtd0KtWxk;@1i&uU~EAM0<1l{X`Hfy(Qb; zLjSZnc6gr64C@U2l5_h!{nqc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