├── 2022 ├── BlazorAppAmiibo │ └── BlazorApp │ │ ├── App.razor │ │ ├── BlazorApp.csproj │ │ ├── Features │ │ ├── Counter │ │ │ └── Counter.razor │ │ ├── Home │ │ │ ├── AmiiboCard.razor │ │ │ └── Index.razor │ │ ├── Layout │ │ │ ├── Header.razor │ │ │ ├── MainLayout.razor │ │ │ ├── MainLayout.razor.css │ │ │ ├── NavMenu.razor │ │ │ └── NavMenu.razor.css │ │ └── Shared │ │ │ ├── Amiibo.cs │ │ │ ├── Error.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ └── SurveyPrompt.razor │ │ ├── Pages │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── amiibos │ │ └── amiiboData.json │ │ ├── css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ │ ├── css │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ └── fonts │ │ │ │ ├── open-iconic.eot │ │ │ │ ├── open-iconic.otf │ │ │ │ ├── open-iconic.svg │ │ │ │ ├── open-iconic.ttf │ │ │ │ └── open-iconic.woff │ │ └── site.css │ │ ├── favicon.png │ │ └── images │ │ ├── logo.png │ │ └── navbar-bg.jpg ├── DemoBlazor_jsInterop │ ├── BlazorApp │ │ ├── App.razor │ │ ├── BlazorApp.csproj │ │ ├── Data │ │ │ ├── WeatherForecast.cs │ │ │ └── WeatherForecastService.cs │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ ├── Error.razor │ │ │ ├── FetchData.razor │ │ │ ├── Index.razor │ │ │ ├── JsInteropStuff.razor │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Shared │ │ │ ├── MainLayout.razor │ │ │ └── NavMenu.razor │ │ ├── Startup.cs │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ ├── bootstrap │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── open-iconic │ │ │ │ ├── FONT-LICENSE │ │ │ │ ├── ICON-LICENSE │ │ │ │ ├── README.md │ │ │ │ └── font │ │ │ │ │ ├── css │ │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ │ └── fonts │ │ │ │ │ ├── open-iconic.eot │ │ │ │ │ ├── open-iconic.otf │ │ │ │ │ ├── open-iconic.svg │ │ │ │ │ ├── open-iconic.ttf │ │ │ │ │ └── open-iconic.woff │ │ │ └── site.css │ │ │ ├── favicon.ico │ │ │ └── js │ │ │ └── interop.js │ └── readme.md ├── DemoUI │ ├── BlazorDemoUI │ │ ├── App.razor │ │ ├── BlazorDemoUI.csproj │ │ ├── Data │ │ │ ├── WeatherForecast.cs │ │ │ └── WeatherForecastService.cs │ │ ├── Models │ │ │ └── DisplayPersonModel.cs │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ ├── Error.razor │ │ │ ├── FetchData.razor │ │ │ ├── Index.razor │ │ │ ├── MyPages │ │ │ │ └── People.razor │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Shared │ │ │ ├── MainLayout.razor │ │ │ └── NavMenu.razor │ │ ├── Startup.cs │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ ├── bootstrap │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── open-iconic │ │ │ │ ├── FONT-LICENSE │ │ │ │ ├── ICON-LICENSE │ │ │ │ ├── README.md │ │ │ │ └── font │ │ │ │ │ ├── css │ │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ │ └── fonts │ │ │ │ │ ├── open-iconic.eot │ │ │ │ │ ├── open-iconic.otf │ │ │ │ │ ├── open-iconic.svg │ │ │ │ │ ├── open-iconic.ttf │ │ │ │ │ └── open-iconic.woff │ │ │ └── site.css │ │ │ └── favicon.ico │ ├── DataAccessLibrary │ │ ├── DataAccessLibrary.csproj │ │ ├── IPeopleData.cs │ │ ├── ISqlDataAccess.cs │ │ ├── Models │ │ │ └── PersonModel.cs │ │ ├── PeopleData.cs │ │ └── SqlDataAccess.cs │ └── DatabaseDDL │ │ └── PersonTable.sql ├── Documentation │ └── IntroduçãoBlazor2022.pdf ├── FormExample │ ├── BlazorApp │ │ ├── App.razor │ │ ├── BlazorApp.csproj │ │ ├── Data │ │ │ ├── WeatherForecast.cs │ │ │ └── WeatherForecastService.cs │ │ ├── Models │ │ │ └── DisplayPublicationModel.cs │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ ├── Error.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ ├── FetchData.razor │ │ │ ├── Fetchandinsertdata.razor │ │ │ ├── Index.razor │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Shared │ │ │ ├── MainLayout.razor │ │ │ ├── MainLayout.razor.css │ │ │ ├── NavMenu.razor │ │ │ ├── NavMenu.razor.css │ │ │ └── SurveyPrompt.razor │ │ ├── Startup.cs │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ ├── bootstrap │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── open-iconic │ │ │ │ ├── FONT-LICENSE │ │ │ │ ├── ICON-LICENSE │ │ │ │ ├── README.md │ │ │ │ └── font │ │ │ │ │ ├── css │ │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ │ └── fonts │ │ │ │ │ ├── open-iconic.eot │ │ │ │ │ ├── open-iconic.otf │ │ │ │ │ ├── open-iconic.svg │ │ │ │ │ ├── open-iconic.ttf │ │ │ │ │ └── open-iconic.woff │ │ │ └── site.css │ │ │ └── favicon.ico │ ├── DataAcessLibrary │ │ └── dataAcess │ │ │ ├── PublicationData.cs │ │ │ ├── IPublicationData.cs │ │ │ ├── ISqlDataAccess.cs │ │ │ ├── Models │ │ │ └── PublicationModel.cs │ │ │ ├── SqlDataAcess.cs │ │ │ └── dataAcess.csproj │ ├── readme.md │ └── workspace.code-workspace ├── README.md ├── SessionStorage │ ├── SessionStorage.sln │ ├── SessionStorage │ │ ├── App.razor │ │ ├── Data │ │ │ ├── WeatherForecast.cs │ │ │ └── WeatherForecastService.cs │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ ├── Error.cshtml │ │ │ ├── FetchData.razor │ │ │ ├── Index.razor │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── SessionStorage.csproj │ │ ├── Shared │ │ │ ├── MainLayout.razor │ │ │ ├── NavMenu.razor │ │ │ └── SurveyPrompt.razor │ │ ├── Startup.cs │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ ├── bootstrap │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── open-iconic │ │ │ │ ├── FONT-LICENSE │ │ │ │ ├── ICON-LICENSE │ │ │ │ ├── README.md │ │ │ │ └── font │ │ │ │ │ ├── css │ │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ │ └── fonts │ │ │ │ │ ├── open-iconic.eot │ │ │ │ │ ├── open-iconic.otf │ │ │ │ │ ├── open-iconic.svg │ │ │ │ │ ├── open-iconic.ttf │ │ │ │ │ └── open-iconic.woff │ │ │ └── site.css │ │ │ └── favicon.ico │ └── readme.md └── TodoList │ ├── App.razor │ ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs │ ├── Models │ └── DisplayCompanyModel.cs │ ├── Pages │ ├── Counter.razor │ ├── Error.cshtml │ ├── Error.cshtml.cs │ ├── FetchData.razor │ ├── Index.razor │ ├── Todo.razor │ └── _Host.cshtml │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Shared │ ├── MainLayout.razor │ ├── MainLayout.razor.css │ ├── NavMenu.razor │ ├── NavMenu.razor.css │ └── SurveyPrompt.razor │ ├── Startup.cs │ ├── TodoItem.cs │ ├── TodoList.csproj │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ └── favicon.ico ├── 2023 ├── AutenticacaoAuth0.pptx ├── Parte1 │ ├── BlazorAPP1.pdf │ └── demo │ │ ├── App.razor │ │ ├── Data │ │ ├── WeatherForecast.cs │ │ └── WeatherForecastService.cs │ │ ├── Demo.sln │ │ ├── Features │ │ ├── Counter │ │ │ └── Counter.razor │ │ ├── FetchData │ │ │ └── FetchData.razor │ │ ├── Home │ │ │ ├── Card.cs │ │ │ └── Index.razor │ │ └── Layout │ │ │ ├── Header.razor │ │ │ ├── MainLayout.razor │ │ │ ├── MainLayout.razor.css │ │ │ ├── NavMenu.razor │ │ │ ├── NavMenu.razor.css │ │ │ └── SurveyPrompt.razor │ │ ├── Pages │ │ ├── Error.cshtml │ │ ├── Error.cshtml.cs │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── demo.csproj │ │ └── wwwroot │ │ ├── css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ │ ├── css │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ └── fonts │ │ │ │ ├── open-iconic.eot │ │ │ │ ├── open-iconic.otf │ │ │ │ ├── open-iconic.svg │ │ │ │ ├── open-iconic.ttf │ │ │ │ └── open-iconic.woff │ │ └── site.css │ │ ├── data │ │ └── cards.json │ │ ├── favicon.png │ │ └── images │ │ └── logo.png └── Parte2 │ ├── BlazorAPP2.pdf │ ├── BlazorAPP3.pdf │ ├── DataLayer │ ├── CardModel.cs │ ├── CardRepository.cs │ ├── DataLayer.csproj │ ├── ICardRepository.cs │ ├── ISqlDataAccess.cs │ └── SqlDataAccess.cs │ └── demo │ ├── App.razor │ ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs │ ├── Demo.sln │ ├── Features │ ├── Counter │ │ └── Counter.razor │ ├── FetchData │ │ └── FetchData.razor │ ├── Home │ │ ├── Card.cs │ │ ├── CardComponent.razor │ │ └── Index.razor │ └── Layout │ │ ├── Header.razor │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ ├── NavMenu.razor.css │ │ └── SurveyPrompt.razor │ ├── Pages │ ├── Error.cshtml │ ├── Error.cshtml.cs │ └── _Host.cshtml │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── demo.csproj │ └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ ├── data │ └── cards.json │ ├── favicon.png │ └── images │ └── logo.png ├── ..bfg-report └── 2021-05-13 │ └── 22-16-39 │ ├── cache-stats.txt │ ├── deleted-files.txt │ ├── object-id-map.old-new.txt │ └── protected-dirt │ └── e13b43ba-HEAD.csv └── .gitignore /..bfg-report/2021-05-13/22-16-39/cache-stats.txt: -------------------------------------------------------------------------------- 1 | (apply,CacheStats{hitCount=35, missCount=36, loadSuccessCount=35, loadExceptionCount=0, totalLoadTime=220783435, evictionCount=0}) 2 | (tree,CacheStats{hitCount=126, missCount=231, loadSuccessCount=214, loadExceptionCount=0, totalLoadTime=463564636, evictionCount=0}) 3 | (commit,CacheStats{hitCount=20, missCount=19, loadSuccessCount=19, loadExceptionCount=0, totalLoadTime=93856889, evictionCount=0}) 4 | (tag,CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}) 5 | -------------------------------------------------------------------------------- /..bfg-report/2021-05-13/22-16-39/deleted-files.txt: -------------------------------------------------------------------------------- 1 | 70f099f391c068c56b5e07427a80cd7fb613eb97 130 appsettings.json 2 | d9d9a9bff6fd6f3ee7ea00de958f135a4a28c6e6 182 appsettings.json 3 | da73b3d5e68b66a9de04954df1aa6072a539706a 427 appsettings.json 4 | 35f84619887fc371b6e4235838f14eb63b99509f 732 appsettings.json 5 | 82115a4dd2af30c67c71479b657a96a973719f1c 505 appsettings.json 6 | c31835b87b04df6aceb68245255ce392634b1a8a 311 appsettings.json 7 | ecd466d2e3b8c1af4e22a007a602cd6941f4f392 431 appsettings.json 8 | -------------------------------------------------------------------------------- /..bfg-report/2021-05-13/22-16-39/protected-dirt/e13b43ba-HEAD.csv: -------------------------------------------------------------------------------- 1 | d9d9a9bff6fd6f3ee7ea00de958f135a4a28c6e6,DELETE,regular-file,DemoBlazor_jsInterop/BlazorApp/appsettings.json,182, 2 | c31835b87b04df6aceb68245255ce392634b1a8a,DELETE,regular-file,DemoUI/BlazorDemoUI/appsettings.json,311, 3 | e37e1f50f84a4950ca72a4b2c51f933042e0105c,DELETE,regular-file,FormExample/BlazorApp/appsettings.json,230, 4 | 70f099f391c068c56b5e07427a80cd7fb613eb97,DELETE,regular-file,HelpDesk/SyncfusionHelpDeskClient-main/Client/wwwroot/appsettings.json,130, 5 | 35f84619887fc371b6e4235838f14eb63b99509f,DELETE,regular-file,HelpDesk/SyncfusionHelpDeskClient-main/Server/appsettings.json,732, 6 | d9d9a9bff6fd6f3ee7ea00de958f135a4a28c6e6,DELETE,regular-file,SessionStorage/SessionStorage/appsettings.json,182, 7 | da73b3d5e68b66a9de04954df1aa6072a539706a,DELETE,regular-file,TodoList/appsettings.json,427, 8 | da73b3d5e68b66a9de04954df1aa6072a539706a,DELETE,regular-file,TodoList/bin/Debug/net5.0/appsettings.json,427, 9 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/BlazorApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Counter/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Home/AmiiboCard.razor: -------------------------------------------------------------------------------- 1 |
2 | @amiibo.Name 3 |
4 |
@amiibo.Name
5 |
6 | 7 | @amiibo.AmiiboSeries 8 |
9 |
10 |
11 | @code { 12 | [Parameter, EditorRequired] 13 | public Amiibo amiibo { get; set; } = default!; 14 | } -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Home/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @inject HttpClient Http 3 | 4 | @if (_amiibos == null) 5 | { 6 |

Loading amiibos...

7 | } 8 | else 9 | { 10 |
11 | @foreach (var amiibo in _amiibos) 12 | { 13 | 14 | } 15 |
16 | } 17 | 18 | @code{ 19 | private IEnumerable? _amiibos; 20 | protected override async Task OnInitializedAsync() 21 | { 22 | try 23 | { 24 | _amiibos = await Http.GetFromJsonAsync >("http://localhost:5266/amiibos/amiiboData.json"); 25 | } 26 | catch (HttpRequestException ex) 27 | { 28 | Console.WriteLine($"There was a problem loading amiibos data: {ex.Message}"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Layout/Header.razor: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | BlazorApp 4 | 5 |
6 |
7 |
8 | 9 |
10 | @Body 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Layout/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .top-row, article { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  9 | 10 | 25 | 26 | @code { 27 | private bool collapseNavMenu = true; 28 | 29 | private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; 30 | 31 | private void ToggleNavMenu() 32 | { 33 | collapseNavMenu = !collapseNavMenu; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Layout/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | 63 | .nav-scrollable { 64 | /* Allow sidebar to scroll for tall menus */ 65 | height: calc(100vh - 3.5rem); 66 | overflow-y: auto; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Shared/Amiibo.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorApp.Features.Home; 2 | 3 | public class Amiibo 4 | { 5 | public string AmiiboSeries { get; set; } = ""; 6 | public string Character { get; set; } = ""; 7 | public string GameSeries { get; set; } = ""; 8 | public string Image { get; set; } = ""; 9 | public string Name { get; set; } = ""; 10 | public string Type { get; set; } = ""; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model BlazorApp.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

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

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Shared/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BlazorApp.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Features/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Microsoft.AspNetCore.Components.Web 3 | @namespace BlazorApp.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | An error has occurred. This application may no longer respond until reloaded. 24 | 25 | 26 | An unhandled exception has occurred. See browser dev tools for details. 27 | 28 | Reload 29 | 🗙 30 |
31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | using Microsoft.AspNetCore.Components.Web; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | // Add services to the container. 7 | builder.Services.AddRazorPages(); 8 | builder.Services.AddServerSideBlazor(); 9 | builder.Services.AddHttpClient(); 10 | 11 | var app = builder.Build(); 12 | 13 | // Configure the HTTP request pipeline. 14 | if (!app.Environment.IsDevelopment()) 15 | { 16 | app.UseExceptionHandler("/Error"); 17 | } 18 | 19 | 20 | app.UseStaticFiles(); 21 | 22 | 23 | 24 | app.UseRouting(); 25 | 26 | app.MapBlazorHub(); 27 | app.MapFallbackToPage("/_Host"); 28 | 29 | app.Run(); 30 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:47155", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "http": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5266", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using BlazorApp 10 | @using BlazorApp.Features.Layout 11 | @using BlazorApp.Features.Shared 12 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/amiibos/amiiboData.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "amiiboSeries": "Super Smash Bros.", 4 | "character": "Mario", 5 | "gameSeries": "Super Mario", 6 | "image": "https://raw.githubusercontent.com/N3evin/AmiiboAPI/master/images/icon_00000000-00000002.png", 7 | "name": "Mario", 8 | "type": "Figure" 9 | }, 10 | { 11 | "amiiboSeries": "Super Mario Bros.", 12 | "character": "Mario", 13 | "gameSeries": "Super Mario", 14 | "image": "https://raw.githubusercontent.com/N3evin/AmiiboAPI/master/images/icon_00000000-00340102.png", 15 | "name": "Mario", 16 | "type": "Figure" 17 | } 18 | ] -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | :root { 4 | --brand: #448922; 5 | --brand-hover: #5da030; 6 | } 7 | 8 | body { 9 | background-color: #f9f9f9; 10 | } 11 | 12 | a { 13 | color: var(--brand); 14 | text-decoration: underline; 15 | } 16 | 17 | a:hover { 18 | color: var(--brand-hover); 19 | text-decoration: none; 20 | } 21 | 22 | .navbar { 23 | border-bottom: 2px solid var(--brand); 24 | background: linear-gradient(90deg, rgba(255, 255, 255, 1) 5%, rgba(255, 255, 255, 0) 100%), url("../images/navbar-bg.jpg") no-repeat center; 25 | background-size: cover; 26 | } 27 | 28 | .btn-primary { 29 | background-color: var(--brand); 30 | border-color: var(--brand); 31 | } 32 | 33 | .btn-primary:hover { 34 | background-color: var(--brand-hover); 35 | border-color: var(--brand-hover); 36 | } 37 | 38 | .btn-outline-primary { 39 | border-color: var(--brand); 40 | color: var(--brand); 41 | } 42 | 43 | .btn-outline-primary:hover { 44 | background-color: var(--brand); 45 | border-color: var(--brand); 46 | } 47 | 48 | .grid { 49 | display: grid; 50 | grid-template-columns: repeat(3, 288px); 51 | column-gap: 123px; 52 | row-gap: 75px; 53 | } 54 | 55 | #blazor-error-ui { 56 | background: lightyellow; 57 | bottom: 0; 58 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 59 | display: none; 60 | left: 0; 61 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 62 | position: fixed; 63 | width: 100%; 64 | z-index: 1000; 65 | } 66 | 67 | #blazor-error-ui .dismiss { 68 | cursor: pointer; 69 | position: absolute; 70 | right: 0.75rem; 71 | top: 0.5rem; 72 | } 73 | .card-img-top{ 74 | max-width: fit-content; 75 | max-height: fit-content; 76 | align-self: center; 77 | } -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/favicon.png -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/images/logo.png -------------------------------------------------------------------------------- /2022/BlazorAppAmiibo/BlazorApp/wwwroot/images/navbar-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/BlazorAppAmiibo/BlazorApp/wwwroot/images/navbar-bg.jpg -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/BlazorApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorApp.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace BlazorApp.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

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

-------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using BlazorApp.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/JsInteropStuff.razor: -------------------------------------------------------------------------------- 1 | @page "/interop" 2 | @inject IJSRuntime JSRuntime 3 | 4 |

JS Interop

5 | 6 |

Create Alert

7 | 8 | 9 | 10 | @code{ 11 | async Task ShowAlert(){ 12 | await JSRuntime.InvokeVoidAsync("createAlert"); 13 | } 14 | } -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace BlazorApp.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | BlazorApp 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | An error has occurred. This application may no longer respond until reloaded. 26 | 27 | 28 | An unhandled exception has occurred. See browser dev tools for details. 29 | 30 | Reload 31 | 🗙 32 |
33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Hosting; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BlazorApp 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:37904", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "BlazorApp": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | @inject IJSRuntime JSRuntime 3 | 4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 | 18 | @code{ 19 | protected override async Task OnAfterRenderAsync(bool firstRender){ 20 | if (firstRender) 21 | { 22 | await JSRuntime.InvokeVoidAsync("loadEvent.play"); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 31 |
32 | 33 | @code { 34 | private bool collapseNavMenu = true; 35 | 36 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 37 | 38 | private void ToggleNavMenu() 39 | { 40 | collapseNavMenu = !collapseNavMenu; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Components; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Hosting; 11 | using BlazorApp.Data; 12 | 13 | namespace BlazorApp 14 | { 15 | public class Startup 16 | { 17 | public Startup(IConfiguration configuration) 18 | { 19 | Configuration = configuration; 20 | } 21 | 22 | public IConfiguration Configuration { get; } 23 | 24 | // This method gets called by the runtime. Use this method to add services to the container. 25 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 26 | public void ConfigureServices(IServiceCollection services) 27 | { 28 | services.AddRazorPages(); 29 | services.AddServerSideBlazor(); 30 | services.AddSingleton(); 31 | } 32 | 33 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 34 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 35 | { 36 | if (env.IsDevelopment()) 37 | { 38 | app.UseDeveloperExceptionPage(); 39 | } 40 | else 41 | { 42 | app.UseExceptionHandler("/Error"); 43 | } 44 | 45 | app.UseStaticFiles(); 46 | 47 | app.UseRouting(); 48 | 49 | app.UseEndpoints(endpoints => 50 | { 51 | endpoints.MapBlazorHub(); 52 | endpoints.MapFallbackToPage("/_Host"); 53 | }); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using BlazorApp 9 | @using BlazorApp.Shared 10 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/BlazorApp/wwwroot/js/interop.js: -------------------------------------------------------------------------------- 1 | //object created to support windows events 2 | window.loadEvent = { 3 | play: () => { 4 | testeAlert(); 5 | } 6 | }; 7 | function testeAlert(){ 8 | alert("This is a new Alert"); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /2022/DemoBlazor_jsInterop/readme.md: -------------------------------------------------------------------------------- 1 | # Example showing the use of Interop for calling javascript functions 2 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/BlazorDemoUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorDemoUI.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace BlazorDemoUI.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Models/DisplayPersonModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace BlazorDemoUI.Models 8 | { 9 | public class DisplayPersonModel 10 | { 11 | [Required] 12 | [StringLength(15, ErrorMessage = "First Name is too long.")] 13 | [MinLength(5, ErrorMessage = "First Name is too short.")] 14 | public string FirstName { get; set; } 15 | 16 | [Required] 17 | [StringLength(15, ErrorMessage = "Last Name is too long.")] 18 | [MinLength(5, ErrorMessage = "Last Name is too short.")] 19 | public string LastName { get; set; } 20 | 21 | [Required] 22 | [EmailAddress] 23 | public string EmailAddress { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

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

-------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using BlazorDemoUI.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/MyPages/People.razor: -------------------------------------------------------------------------------- 1 | @page "/Data/People" 2 | 3 | @using DataAccessLibrary 4 | @using DataAccessLibrary.Models 5 | @using BlazorDemoUI.Models 6 | 7 | @inject IPeopleData _db 8 | 9 |

People Page

10 | 11 |

Insert New Person

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

Current People

24 | @if (people is null) 25 | { 26 |

Loading...

27 | } 28 | else 29 | { 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | @foreach (var person in people) 40 | { 41 | 42 | 43 | 44 | 45 | 46 | } 47 | 48 |
First NameLast NameEmail Address
@person.FirstName@person.LastName@person.EmailAddress
49 | } 50 | 51 | @code { 52 | private List people; 53 | private DisplayPersonModel newPerson = new DisplayPersonModel(); 54 | 55 | protected override async Task OnInitializedAsync() 56 | { 57 | people = await _db.GetPeople(); 58 | } 59 | 60 | private async Task InsertPerson() 61 | { 62 | PersonModel p = new PersonModel 63 | { 64 | FirstName = newPerson.FirstName, 65 | LastName = newPerson.LastName, 66 | EmailAddress = newPerson.EmailAddress 67 | }; 68 | 69 | await _db.InsertPerson(p); 70 | 71 | people.Add(p); 72 | 73 | newPerson = new DisplayPersonModel(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace BlazorDemoUI.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | BlazorDemoUI 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | An error has occurred. This application may no longer respond until reloaded. 26 | 27 | 28 | An unhandled exception has occurred. See browser dev tools for details. 29 | 30 | Reload 31 | 🗙 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Hosting; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BlazorDemoUI 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:62404", 7 | "sslPort": 44347 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "BlazorDemoUI": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 31 |
32 | 33 | @code { 34 | private bool collapseNavMenu = true; 35 | 36 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 37 | 38 | private void ToggleNavMenu() 39 | { 40 | collapseNavMenu = !collapseNavMenu; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Components; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.AspNetCore.HttpsPolicy; 9 | using Microsoft.Extensions.Configuration; 10 | using Microsoft.Extensions.DependencyInjection; 11 | using Microsoft.Extensions.Hosting; 12 | using BlazorDemoUI.Data; 13 | using DataAccessLibrary; 14 | 15 | namespace BlazorDemoUI 16 | { 17 | public class Startup 18 | { 19 | public Startup(IConfiguration configuration) 20 | { 21 | Configuration = configuration; 22 | } 23 | 24 | public IConfiguration Configuration { get; } 25 | 26 | // This method gets called by the runtime. Use this method to add services to the container. 27 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | services.AddRazorPages(); 31 | services.AddServerSideBlazor(); 32 | services.AddSingleton(); 33 | services.AddTransient(); 34 | services.AddTransient(); 35 | } 36 | 37 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 38 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 39 | { 40 | if (env.IsDevelopment()) 41 | { 42 | app.UseDeveloperExceptionPage(); 43 | } 44 | else 45 | { 46 | app.UseExceptionHandler("/Error"); 47 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 48 | app.UseHsts(); 49 | } 50 | 51 | app.UseHttpsRedirection(); 52 | app.UseStaticFiles(); 53 | 54 | app.UseRouting(); 55 | 56 | app.UseEndpoints(endpoints => 57 | { 58 | endpoints.MapBlazorHub(); 59 | endpoints.MapFallbackToPage("/_Host"); 60 | }); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using BlazorDemoUI 9 | @using BlazorDemoUI.Shared 10 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "ConnectionStrings": { 11 | "Default": "Data Source=DESKTOP-3JOE1B0;Initial Catalog=HelpDeskTest;Integrated Security=True" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | icon name 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoUI/BlazorDemoUI/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/DemoUI/BlazorDemoUI/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/DemoUI/BlazorDemoUI/wwwroot/favicon.ico -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/DataAccessLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/IPeopleData.cs: -------------------------------------------------------------------------------- 1 | using DataAccessLibrary.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace DataAccessLibrary 6 | { 7 | public interface IPeopleData 8 | { 9 | Task> GetPeople(); 10 | Task InsertPerson(PersonModel person); 11 | } 12 | } -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/ISqlDataAccess.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace DataAccessLibrary 5 | { 6 | public interface ISqlDataAccess 7 | { 8 | string ConnectionStringName { get; set; } 9 | 10 | Task> LoadData(string sql, U parameters); 11 | Task SaveData(string sql, T parameters); 12 | } 13 | } -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/Models/PersonModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DataAccessLibrary.Models 6 | { 7 | public class PersonModel 8 | { 9 | public string FirstName { get; set; } 10 | public string LastName { get; set; } 11 | public string EmailAddress { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/PeopleData.cs: -------------------------------------------------------------------------------- 1 | using DataAccessLibrary.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DataAccessLibrary 8 | { 9 | public class PeopleData : IPeopleData 10 | { 11 | private readonly ISqlDataAccess _db; 12 | 13 | public PeopleData(ISqlDataAccess db) 14 | { 15 | _db = db; 16 | } 17 | 18 | public Task> GetPeople() 19 | { 20 | string sql = "select * from dbo.Person"; 21 | 22 | return _db.LoadData(sql, new { }); 23 | } 24 | 25 | public Task InsertPerson(PersonModel person) 26 | { 27 | string sql = @"insert into dbo.Person (FirstName, LastName, EmailAddress) 28 | values (@FirstName, @LastName, @EmailAddress);"; 29 | 30 | return _db.SaveData(sql, person); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /2022/DemoUI/DataAccessLibrary/SqlDataAccess.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Microsoft.Extensions.Configuration; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Data; 6 | using System.Data.SqlClient; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace DataAccessLibrary 12 | { 13 | public class SqlDataAccess : ISqlDataAccess 14 | { 15 | private readonly IConfiguration _config; 16 | 17 | public string ConnectionStringName { get; set; } = "Default"; 18 | 19 | public SqlDataAccess(IConfiguration config) 20 | { 21 | _config = config; 22 | } 23 | 24 | public async Task> LoadData(string sql, U parameters) 25 | { 26 | string connectionString = _config.GetConnectionString(ConnectionStringName); 27 | 28 | using (IDbConnection connection = new SqlConnection(connectionString)) 29 | { 30 | var data = await connection.QueryAsync(sql, parameters); 31 | 32 | return data.ToList(); 33 | } 34 | } 35 | 36 | public async Task SaveData(string sql, T parameters) 37 | { 38 | string connectionString = _config.GetConnectionString(ConnectionStringName); 39 | 40 | using (IDbConnection connection = new SqlConnection(connectionString)) 41 | { 42 | await connection.ExecuteAsync(sql, parameters); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/DemoUI/DatabaseDDL/PersonTable.sql: -------------------------------------------------------------------------------- 1 | USE [HelpDeskTest] 2 | GO 3 | 4 | /****** Object: Table [dbo].[Person] Script Date: 13/01/2021 23:25:45 ******/ 5 | SET ANSI_NULLS ON 6 | GO 7 | 8 | SET QUOTED_IDENTIFIER ON 9 | GO 10 | 11 | CREATE TABLE [dbo].[Person]( 12 | [id] [int] IDENTITY(1,1) NOT NULL, 13 | [FirstName] [varchar](50) NULL, 14 | [LastName] [varchar](50) NULL, 15 | [EmailAddress] [varchar](50) NULL, 16 | CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED 17 | ( 18 | [id] ASC 19 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 20 | ) ON [PRIMARY] 21 | GO 22 | 23 | -------------------------------------------------------------------------------- /2022/Documentation/IntroduçãoBlazor2022.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/Documentation/IntroduçãoBlazor2022.pdf -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/BlazorApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | net5.0 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorApp.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace BlazorApp.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Models/DisplayPublicationModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | 8 | namespace BlazorApp.Models 9 | { 10 | public class DisplayPublicationModel 11 | { 12 | [Required] 13 | [StringLength(15, ErrorMessage = "Title is too long.")] 14 | [MinLength(5, ErrorMessage = "Title is too short.")] 15 | public string Title { get; set; } 16 | 17 | [Required] 18 | public int Year { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model BlazorApp.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

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

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.AspNetCore.Mvc.RazorPages; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace BlazorApp.Pages 11 | { 12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 13 | [IgnoreAntiforgeryToken] 14 | public class ErrorModel : PageModel 15 | { 16 | public string RequestId { get; set; } 17 | 18 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 19 | 20 | private readonly ILogger _logger; 21 | 22 | public ErrorModel(ILogger logger) 23 | { 24 | _logger = logger; 25 | } 26 | 27 | public void OnGet() 28 | { 29 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using BlazorApp.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/Fetchandinsertdata.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchandinsertdata" 2 | @using dataAcess 3 | @using dataAcess.Models 4 | @using BlazorApp.Models 5 | 6 | @inject IPublicationData _db 7 | 8 |

Fetch and Insert Data

9 | 10 |

Insert New Publication

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 |

Publications Page

23 | 24 | @if (publication is null) 25 | { 26 |

Loading...

27 | } 28 | else 29 | { 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | @foreach (var p in publication) 39 | { 40 | 41 | 42 | 43 | 44 | } 45 | 46 |
TitleYear
@p.Title@p.Year
47 | } 48 | @code { 49 | private List publication; 50 | 51 | private String year; 52 | private DisplayPublicationModel newPublication = new DisplayPublicationModel(); 53 | 54 | protected override async Task OnInitializedAsync() 55 | { 56 | publication = await _db.GetPublication(); 57 | } 58 | 59 | private async Task InsertPublication() 60 | { 61 | PublicationModel p = new PublicationModel 62 | { 63 | Title = newPublication.Title, 64 | Year = newPublication.Year, 65 | }; 66 | 67 | await _db.InsertPerson(p); 68 | 69 | publication.Add(p); 70 | 71 | newPublication = new DisplayPublicationModel(); 72 | } 73 | } -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | 8 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace BlazorApp.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | BlazorApp 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | An error has occurred. This application may no longer respond until reloaded. 25 | 26 | 27 | An unhandled exception has occurred. See browser dev tools for details. 28 | 29 | Reload 30 | 🗙 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace BlazorApp 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:25085", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "BlazorApp": { 19 | "commandName": "Project", 20 | "dotnetRunMessages": "true", 21 | "launchBrowser": true, 22 | "applicationUrl": "http://localhost:5000", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .main > div { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 31 |
32 | 33 | @code { 34 | private bool collapseNavMenu = true; 35 | 36 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 37 | 38 | private void ToggleNavMenu() 39 | { 40 | collapseNavMenu = !collapseNavMenu; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Components; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Hosting; 11 | using BlazorApp.Data; 12 | using dataAcess; 13 | 14 | namespace BlazorApp 15 | { 16 | public class Startup 17 | { 18 | public Startup(IConfiguration configuration) 19 | { 20 | Configuration = configuration; 21 | } 22 | 23 | public IConfiguration Configuration { get; } 24 | 25 | // This method gets called by the runtime. Use this method to add services to the container. 26 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 27 | public void ConfigureServices(IServiceCollection services) 28 | { 29 | services.AddRazorPages(); 30 | services.AddServerSideBlazor(); 31 | services.AddSingleton(); 32 | services.AddTransient(); 33 | services.AddTransient(); 34 | } 35 | 36 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 37 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 38 | { 39 | if (env.IsDevelopment()) 40 | { 41 | app.UseDeveloperExceptionPage(); 42 | } 43 | else 44 | { 45 | app.UseExceptionHandler("/Error"); 46 | } 47 | 48 | app.UseStaticFiles(); 49 | 50 | app.UseRouting(); 51 | 52 | app.UseEndpoints(endpoints => 53 | { 54 | endpoints.MapBlazorHub(); 55 | endpoints.MapFallbackToPage("/_Host"); 56 | }); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using BlazorApp 10 | @using BlazorApp.Shared 11 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "ConnectionStrings": { 11 | "Default": "" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/FormExample/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | .content { 18 | padding-top: 1.1rem; 19 | } 20 | 21 | .valid.modified:not([type=checkbox]) { 22 | outline: 1px solid #26b050; 23 | } 24 | 25 | .invalid { 26 | outline: 1px solid red; 27 | } 28 | 29 | .validation-message { 30 | color: red; 31 | } 32 | 33 | #blazor-error-ui { 34 | background: lightyellow; 35 | bottom: 0; 36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 37 | display: none; 38 | left: 0; 39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 40 | position: fixed; 41 | width: 100%; 42 | z-index: 1000; 43 | } 44 | 45 | #blazor-error-ui .dismiss { 46 | cursor: pointer; 47 | position: absolute; 48 | right: 0.75rem; 49 | top: 0.5rem; 50 | } 51 | 52 | form { 53 | width: 80%; 54 | } 55 | 56 | label, 57 | input { 58 | /* In order to define widths */ 59 | display: inline-block; 60 | } 61 | 62 | label { 63 | width: 30%; 64 | /* Positions the label text beside the input */ 65 | } 66 | 67 | label+input { 68 | width: 30%; 69 | /* Large margin-right to force the next element to the new-line 70 | and margin-left to create a gutter between the label and input */ 71 | margin: 0 30% 0 4%; 72 | } 73 | 74 | 75 | /* Only the submit button is matched by this selector, 76 | but to be sure you could use an id or class for that button */ 77 | input+input { 78 | float: right; 79 | } 80 | -------------------------------------------------------------------------------- /2022/FormExample/BlazorApp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/FormExample/BlazorApp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/ PublicationData.cs: -------------------------------------------------------------------------------- 1 | using dataAcess.Models; 2 | using System.Threading.Tasks; 3 | using System.Collections.Generic; 4 | using System.Transactions; 5 | using System.Data.SqlClient; 6 | using System.Data; 7 | using Dapper; 8 | 9 | 10 | namespace dataAcess 11 | { 12 | public class PublicationData : IPublicationData 13 | { 14 | private readonly ISqlDataAccess _db; 15 | 16 | public PublicationData(ISqlDataAccess db) 17 | { 18 | _db = db; 19 | } 20 | public Task> GetPublication() 21 | { 22 | string sql = "select * from dbo.Publications"; 23 | 24 | return _db.LoadData(sql, new { }); 25 | } 26 | 27 | public Task InsertPerson(PublicationModel publication) 28 | { 29 | string sql = @"insert into dbo.Publications (Title, Year) 30 | values (@Title, @Year);"; 31 | 32 | return _db.SaveData(sql, publication); 33 | } 34 | 35 | public Task InsertMultiplePersons(PublicationModel publication) 36 | { 37 | 38 | string sql = @"insert into dbo.Publications (Title, Year) 39 | values (@Title, @Year);"; 40 | return _db.SaveTransactionScopedData(sql, publication); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/IPublicationData.cs: -------------------------------------------------------------------------------- 1 | using dataAcess.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace dataAcess 6 | { 7 | public interface IPublicationData 8 | { 9 | Task> GetPublication(); 10 | Task InsertPerson(PublicationModel publication); 11 | } 12 | } -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/ISqlDataAccess.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace dataAcess 5 | { 6 | public interface ISqlDataAccess 7 | { 8 | string ConnectionStringName { get; set; } 9 | 10 | Task> LoadData(string sql, U parameters); 11 | Task SaveData(string sql, T parameters); 12 | 13 | Task SaveTransactionScopedData(string sql, T parameters); 14 | } 15 | } -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/Models/PublicationModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace dataAcess.Models 6 | { 7 | public class PublicationModel 8 | { 9 | public string Title { get; set; } 10 | public int Year { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/SqlDataAcess.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Microsoft.Extensions.Configuration; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Data; 6 | using System.Data.SqlClient; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Transactions; 11 | 12 | namespace dataAcess 13 | { 14 | public class SqlDataAccess : ISqlDataAccess 15 | { 16 | private readonly IConfiguration _config; 17 | 18 | public string ConnectionStringName { get; set; } = "Default"; 19 | 20 | public SqlDataAccess(IConfiguration config) 21 | { 22 | _config = config; 23 | } 24 | 25 | public async Task> LoadData(string sql, U parameters) 26 | { 27 | string connectionString = _config.GetConnectionString(ConnectionStringName); 28 | 29 | using (IDbConnection connection = new SqlConnection(connectionString)) 30 | { 31 | var data = await connection.QueryAsync(sql, parameters); 32 | 33 | return data.ToList(); 34 | } 35 | } 36 | 37 | public async Task SaveData(string sql, T parameters) 38 | { 39 | string connectionString = _config.GetConnectionString(ConnectionStringName); 40 | 41 | using (IDbConnection connection = new SqlConnection(connectionString)) 42 | { 43 | await connection.ExecuteAsync(sql, parameters); 44 | } 45 | } 46 | 47 | public async Task SaveTransactionScopedData(string sql, T parameters) 48 | { 49 | string connectionString = _config.GetConnectionString(ConnectionStringName); 50 | 51 | using (var transaction = new TransactionScope()) 52 | { 53 | 54 | using (var connection = new SqlConnection(connectionString)) 55 | { 56 | connection.Open(); 57 | 58 | await connection.ExecuteAsync(sql, parameters); 59 | } 60 | 61 | transaction.Complete(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /2022/FormExample/DataAcessLibrary/dataAcess/dataAcess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /2022/FormExample/readme.md: -------------------------------------------------------------------------------- 1 | # Form example with data update in real time 2 | -------------------------------------------------------------------------------- /2022/FormExample/workspace.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "BlazorApp" 5 | }, 6 | { 7 | "path": "DataAcessLibrary" 8 | } 9 | ], 10 | "settings": {} 11 | } -------------------------------------------------------------------------------- /2022/README.md: -------------------------------------------------------------------------------- 1 | # Blazor_Course - Repositório de exemplos 2 | 3 | ## Pasta documentação 4 | Contém a apresentação realizada 5 | 6 | ## Projeto Amiibos 7 | - .NET core 7 8 | - CLI/VSCODE 9 | 10 | Projeto que demonstra alguns aspetos básicos de desenvolvimento em blazor 11 | 12 | São ainda disponibilizados os seguintes projetos em .NET ore 3.1 explorados em sessões de anos anteriores onde foi utilizad o Visual Studio 2019 e SQL Server (com Dapper) 13 | 14 | ## Descrição dos projetos: 15 | 16 | 1. DemoUI: Exemplo de projeto com Blazor Server que demonstra um website simplificado (tendo por base o website de exemplo do Blazor) que através de um item específico (People) suporta a ligação à base de dados (SQL - DDL disponível na pasta Database que recria a tabela people sem dados), permitindo listar a adicionar novos elemenentos na página (que surgem de imediato na listagem). 17 | - Contém ainda um projeto: DataAccessLibrary que é uma biblioteca que encapsula a lógica necessária de acesso à base e dados utilizando a biblioteca Dapper. 18 | 19 | - Passos para execução: 20 | 1. Abrir o projeto, 21 | 2. criar uma base de dados e recriar a tabela, 22 | 3. No visual studio, em particular na tab: "SQL Server Object Explorer", estabelecer a ligação, em propriedades copiar a connection string e substituir a string de conexão no ficheiro appsetting.json. 23 | 24 | - Uma DataAcess Library pode ser criada através do comando: 25 | ``` dotnet new classlib -o bullDocDBAcess ``` 26 | - O Dapper pode ser instalado através do comando: 27 | ``` dotnet add package Dapper --version 2.0.90 ``` 28 | - Dependências necessárias 29 | 1. Extension Package: 30 | ``` dotnet add package Microsoft.Extensions.Configuration --version 5.0.0``` 31 | 2. Data Client Package 32 | ``` dotnet add package System.Data.SqlClient --version 4.8.2 ``` 33 | 3. Associar a Class library ao projeto 34 | ``` dotnet add reference ../stringUtility/stringUtility.csproj ``` 35 | É ainda necessário injetar as dependências, consultar projeto de exemplo 36 | 37 | 2. HelpDesk: Exemplo com base de dados (backup na pasta Database) utilizando a Entity Framework. Inclui um exemplo de autenticação utilizador comum e administrador) e um formulário que utiliza componentes third party (neste caso da syncfusion). Na pasta documentação está incluído um ebook que explica o processo. 38 | 39 | 3. TodoList: Exemplo simples que demonstra um pequena lista de tarefas (sem base de dados) e que permite visualizar como uma tarefa tipicamente implementada recorrendo a javascript pode ser implementada com blazor. 40 | 41 | 4. Exemplo de Session Storage com um componente Blazored: https://github.com/Blazored 42 | 43 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31112.23 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionStorage", "SessionStorage\SessionStorage.csproj", "{687D6081-9B24-4BF9-993E-F2B3B7DC5750}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {687D6081-9B24-4BF9-993E-F2B3B7DC5750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {687D6081-9B24-4BF9-993E-F2B3B7DC5750}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {687D6081-9B24-4BF9-993E-F2B3B7DC5750}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {687D6081-9B24-4BF9-993E-F2B3B7DC5750}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {3787FFC4-47A5-4CFA-9034-BF7FFB743D15} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SessionStorage.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace SessionStorage.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | @inject Blazored.SessionStorage.ISessionStorageService sessionStorage 4 | 5 |

Session Storage: @name

6 | 7 | 8 | 9 | 10 | 11 | @code { 12 | string name { get; set; } = string.Empty; 13 | 14 | private async void updateStorage() 15 | { 16 | await sessionStorage.SetItemAsync("name", name); 17 | } 18 | 19 | 20 | protected override async Task OnAfterRenderAsync(bool firstRender) 21 | { 22 | if (firstRender) 23 | { 24 | name = await sessionStorage.GetItemAsync("name"); 25 | StateHasChanged(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

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

17 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using SessionStorage.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | 8 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace SessionStorage.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | SessionStorage 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | An error has occurred. This application may no longer respond until reloaded. 26 | 27 | 28 | An unhandled exception has occurred. See browser dev tools for details. 29 | 30 | Reload 31 | 🗙 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.Hosting; 5 | using Microsoft.Extensions.Logging; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Threading.Tasks; 11 | 12 | namespace SessionStorage 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:9784", 7 | "sslPort": 44313 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "SessionStorage": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/SessionStorage.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 26 |
27 | 28 | @code { 29 | private bool collapseNavMenu = true; 30 | 31 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 32 | 33 | private void ToggleNavMenu() 34 | { 35 | collapseNavMenu = !collapseNavMenu; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/Startup.cs: -------------------------------------------------------------------------------- 1 | using Blazored.SessionStorage; 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Components; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.AspNetCore.HttpsPolicy; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.DependencyInjection; 8 | using Microsoft.Extensions.Hosting; 9 | using SessionStorage.Data; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Threading.Tasks; 14 | 15 | namespace SessionStorage 16 | { 17 | public class Startup 18 | { 19 | public Startup(IConfiguration configuration) 20 | { 21 | Configuration = configuration; 22 | } 23 | 24 | public IConfiguration Configuration { get; } 25 | 26 | // This method gets called by the runtime. Use this method to add services to the container. 27 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | services.AddRazorPages(); 31 | services.AddServerSideBlazor(); 32 | services.AddSingleton(); 33 | services.AddBlazoredSessionStorage(); 34 | } 35 | 36 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 37 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 38 | { 39 | if (env.IsDevelopment()) 40 | { 41 | app.UseDeveloperExceptionPage(); 42 | } 43 | else 44 | { 45 | app.UseExceptionHandler("/Error"); 46 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 47 | app.UseHsts(); 48 | } 49 | 50 | app.UseHttpsRedirection(); 51 | app.UseStaticFiles(); 52 | 53 | app.UseRouting(); 54 | 55 | app.UseEndpoints(endpoints => 56 | { 57 | endpoints.MapBlazorHub(); 58 | endpoints.MapFallbackToPage("/_Host"); 59 | }); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using SessionStorage 9 | @using SessionStorage.Shared 10 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/SessionStorage/SessionStorage/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/SessionStorage/SessionStorage/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/SessionStorage/SessionStorage/wwwroot/favicon.ico -------------------------------------------------------------------------------- /2022/SessionStorage/readme.md: -------------------------------------------------------------------------------- 1 | # Session Storage com Blazored 2 | 3 | Blazored SessionStorage is a library that provides access to the browsers session storage APIs for Blazor applications. An additional benefit of using this library is that it will handle serializing and deserializing values when saving or retrieving them. 4 | 5 | - Source: https://github.com/Blazored/SessionStorage -------------------------------------------------------------------------------- /2022/TodoList/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /2022/TodoList/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TodoList.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2022/TodoList/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace TodoList.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/TodoList/Models/DisplayCompanyModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | 8 | namespace TodoList.Models 9 | { 10 | public class DisplayCompanyModel 11 | { 12 | [Required] 13 | [StringLength(15, ErrorMessage = "Company Name is too long.")] 14 | [MinLength(3, ErrorMessage = "Company Name is too short.")] 15 | public string CompanyName { get; set; } 16 | 17 | [Required] 18 | [StringLength(9, ErrorMessage = " NIF is too long.")] 19 | [MinLength(9, ErrorMessage = "NIF is too short.")] 20 | public string NIF { get; set; } 21 | 22 | [Required] 23 | [EmailAddress] 24 | public string EmailAddress { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /2022/TodoList/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model TodoList.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

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

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.AspNetCore.Mvc.RazorPages; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace TodoList.Pages 11 | { 12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 13 | [IgnoreAntiforgeryToken] 14 | public class ErrorModel : PageModel 15 | { 16 | public string RequestId { get; set; } 17 | 18 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 19 | 20 | private readonly ILogger _logger; 21 | 22 | public ErrorModel(ILogger logger) 23 | { 24 | _logger = logger; 25 | } 26 | 27 | public void OnGet() 28 | { 29 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using TodoList.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | 8 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/Todo.razor: -------------------------------------------------------------------------------- 1 | @page "/todo" 2 | 3 |

Todo (@todos.Count(todo => !todo.IsDone))

4 | 5 |
    6 | @foreach (var todo in todos) 7 | { 8 |
  • 9 | 10 | 11 |
  • 12 | } 13 |
14 | 15 | 16 | 17 | 18 | @code { 19 | private IList todos = new List(); 20 | private string newTodo; 21 | private void AddTodo() 22 | { 23 | // Todo: Add the todo 24 | if (!string.IsNullOrWhiteSpace(newTodo)) 25 | { 26 | todos.Add(new TodoItem { Title = newTodo }); 27 | newTodo = string.Empty; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /2022/TodoList/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace TodoList.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | TodoList 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | An error has occurred. This application may no longer respond until reloaded. 25 | 26 | 27 | An unhandled exception has occurred. See browser dev tools for details. 28 | 29 | Reload 30 | 🗙 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /2022/TodoList/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace TodoList 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2022/TodoList/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:6988", 7 | "sslPort": 44377 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "TodoList": { 19 | "commandName": "Project", 20 | "dotnetRunMessages": "true", 21 | "launchBrowser": true, 22 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2022/TodoList/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /2022/TodoList/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .main > div { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /2022/TodoList/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 31 |
32 | 33 | @code { 34 | private bool collapseNavMenu = true; 35 | 36 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 37 | 38 | private void ToggleNavMenu() 39 | { 40 | collapseNavMenu = !collapseNavMenu; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2022/TodoList/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /2022/TodoList/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2022/TodoList/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Components; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.AspNetCore.HttpsPolicy; 9 | using Microsoft.Extensions.Configuration; 10 | using Microsoft.Extensions.DependencyInjection; 11 | using Microsoft.Extensions.Hosting; 12 | using TodoList.Data; 13 | 14 | 15 | namespace TodoList 16 | { 17 | public class Startup 18 | { 19 | public Startup(IConfiguration configuration) 20 | { 21 | Configuration = configuration; 22 | } 23 | 24 | public IConfiguration Configuration { get; } 25 | 26 | // This method gets called by the runtime. Use this method to add services to the container. 27 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | services.AddRazorPages(); 31 | services.AddServerSideBlazor(); 32 | services.AddSingleton(); 33 | } 34 | 35 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 36 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 37 | { 38 | if (env.IsDevelopment()) 39 | { 40 | app.UseDeveloperExceptionPage(); 41 | } 42 | else 43 | { 44 | app.UseExceptionHandler("/Error"); 45 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 46 | app.UseHsts(); 47 | } 48 | 49 | app.UseHttpsRedirection(); 50 | app.UseStaticFiles(); 51 | 52 | app.UseRouting(); 53 | 54 | app.UseEndpoints(endpoints => 55 | { 56 | endpoints.MapBlazorHub(); 57 | endpoints.MapFallbackToPage("/_Host"); 58 | }); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /2022/TodoList/TodoItem.cs: -------------------------------------------------------------------------------- 1 | public class TodoItem 2 | { 3 | public string Title { get; set; } 4 | public bool IsDone { get; set; } 5 | } -------------------------------------------------------------------------------- /2022/TodoList/TodoList.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /2022/TodoList/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using TodoList 10 | @using TodoList.Shared 11 | -------------------------------------------------------------------------------- /2022/TodoList/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2022/TodoList/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "ConnectionStrings": { 11 | "Default": "Data Source=DESKTOP-3JOE1B0;Initial Catalog=HelpDeskTest;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | icon name 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/TodoList/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | .content { 18 | padding-top: 1.1rem; 19 | } 20 | 21 | .valid.modified:not([type=checkbox]) { 22 | outline: 1px solid #26b050; 23 | } 24 | 25 | .invalid { 26 | outline: 1px solid red; 27 | } 28 | 29 | .validation-message { 30 | color: red; 31 | } 32 | 33 | #blazor-error-ui { 34 | background: lightyellow; 35 | bottom: 0; 36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 37 | display: none; 38 | left: 0; 39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 40 | position: fixed; 41 | width: 100%; 42 | z-index: 1000; 43 | } 44 | 45 | #blazor-error-ui .dismiss { 46 | cursor: pointer; 47 | position: absolute; 48 | right: 0.75rem; 49 | top: 0.5rem; 50 | } 51 | -------------------------------------------------------------------------------- /2022/TodoList/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2022/TodoList/wwwroot/favicon.ico -------------------------------------------------------------------------------- /2023/AutenticacaoAuth0.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/AutenticacaoAuth0.pptx -------------------------------------------------------------------------------- /2023/Parte1/BlazorAPP1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/BlazorAPP1.pdf -------------------------------------------------------------------------------- /2023/Parte1/demo/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Data; 2 | 3 | public class WeatherForecast 4 | { 5 | public DateOnly Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Data; 2 | 3 | public class WeatherForecastService 4 | { 5 | private static readonly string[] Summaries = new[] 6 | { 7 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 8 | }; 9 | 10 | public Task GetForecastAsync(DateOnly startDate) 11 | { 12 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 13 | { 14 | Date = startDate.AddDays(index), 15 | TemperatureC = Random.Shared.Next(-20, 55), 16 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 17 | }).ToArray()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.002.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "demo", "demo.csproj", "{96D718E7-1E08-4983-9A74-408FCCA6445B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {64D1BBB3-353A-44EE-9DD0-A2EE3B09E660} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Counter/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/FetchData/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @using demo.Data 3 | @inject WeatherForecastService ForecastService 4 | 5 | Weather forecast 6 | 7 |

Weather forecast

8 | 9 |

This component demonstrates fetching data from a service.

10 | 11 | @if (forecasts == null) 12 | { 13 |

Loading...

14 | } 15 | else 16 | { 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | @foreach (var forecast in forecasts) 28 | { 29 | 30 | 31 | 32 | 33 | 34 | 35 | } 36 | 37 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
38 | } 39 | 40 | @code { 41 | private WeatherForecast[]? forecasts; 42 | 43 | protected override async Task OnInitializedAsync() 44 | { 45 | forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Home/Card.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Features.Home; 2 | public class Card 3 | { 4 | public int Id { get; set; } 5 | public string Name { get; set; } = ""; 6 | public string Description { get; set; } = ""; 7 | public string Image { get; set; } = ""; 8 | } 9 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Home/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @inject HttpClient Http 3 | @inject NavigationManager NavigationManager; 4 | 5 | 6 | Index 7 | 8 | @if (_cards == null) 9 | { 10 |

Loading cards...

11 | } 12 | else 13 | { 14 |
15 | @foreach (var card in _cards) 16 | { 17 |
18 | @card.Name 19 |
20 |
@card.Name
21 |
22 | 23 | @card.Name 24 |
25 |
26 | 27 | 28 | @card.Description 29 | 30 | 31 | 32 | @card.Description 33 | 34 |
35 | 38 |
39 |
40 | } 41 |
42 | } 43 | 44 | 45 | @code{ 46 | private IEnumerable? _cards; 47 | protected override async Task OnInitializedAsync(){ 48 | try{ 49 | string domainName = NavigationManager.Uri; 50 | _cards = await Http.GetFromJsonAsync>(domainName+"data/cards.json"); 51 | } 52 | catch (HttpRequestException ex){ 53 | Console.WriteLine($"There was a problem loading amiibos data: {ex.Message}"); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/Header.razor: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 |
3 | 4 |
5 | @Body 6 |
7 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .top-row, article { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  9 | 10 | 29 | 30 | @code { 31 | private bool collapseNavMenu = true; 32 | 33 | private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; 34 | 35 | private void ToggleNavMenu() 36 | { 37 | collapseNavMenu = !collapseNavMenu; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | 63 | .nav-scrollable { 64 | /* Allow sidebar to scroll for tall menus */ 65 | height: calc(100vh - 3.5rem); 66 | overflow-y: auto; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Features/Layout/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model demo.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

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

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace demo.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Microsoft.AspNetCore.Components.Web 3 | @namespace demo.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | An error has occurred. This application may no longer respond until reloaded. 25 | 26 | 27 | An unhandled exception has occurred. See browser dev tools for details. 28 | 29 | Reload 30 | 🗙 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | using Microsoft.AspNetCore.Components.Web; 3 | using demo.Data; 4 | 5 | var builder = WebApplication.CreateBuilder(args); 6 | 7 | // Add services to the container. 8 | builder.Services.AddRazorPages(); 9 | builder.Services.AddServerSideBlazor(); 10 | builder.Services.AddSingleton(); 11 | builder.Services.AddHttpClient(); 12 | 13 | 14 | var app = builder.Build(); 15 | 16 | // Configure the HTTP request pipeline. 17 | if (!app.Environment.IsDevelopment()) 18 | { 19 | app.UseExceptionHandler("/Error"); 20 | } 21 | 22 | 23 | app.UseStaticFiles(); 24 | 25 | app.UseRouting(); 26 | 27 | app.MapBlazorHub(); 28 | app.MapFallbackToPage("/_Host"); 29 | 30 | app.Run(); 31 | -------------------------------------------------------------------------------- /2023/Parte1/demo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:46711", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "http": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5211", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2023/Parte1/demo/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using demo.Features 10 | @using demo.Features.Layout 11 | @using demo.Features.Home 12 | 13 | -------------------------------------------------------------------------------- /2023/Parte1/demo/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /2023/Parte1/demo/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /2023/Parte1/demo/demo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/data/cards.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "name": "Card 1", 5 | "description": "Card 1 description", 6 | "image": "https://static.vecteezy.com/system/resources/previews/000/595/201/original/community-people-care-logo-and-symbols-vector.jpg" 7 | }, 8 | { 9 | "id": 2, 10 | "name": "Card 2", 11 | "description": "Card 2 description", 12 | "image": "https://s3.amazonaws.com/thumbnails.venngage.com/template/537555f5-d940-45bd-97bb-5b65b018b2f2.png" 13 | } 14 | ] -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/favicon.png -------------------------------------------------------------------------------- /2023/Parte1/demo/wwwroot/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte1/demo/wwwroot/images/logo.png -------------------------------------------------------------------------------- /2023/Parte2/BlazorAPP2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/BlazorAPP2.pdf -------------------------------------------------------------------------------- /2023/Parte2/BlazorAPP3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/BlazorAPP3.pdf -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/CardModel.cs: -------------------------------------------------------------------------------- 1 | namespace DataLayer; 2 | public record CardModel 3 | { 4 | public string? _Id { get; set; } 5 | public int Id { get; } 6 | public string Name { get; set; } = ""; 7 | public string Description { get; set; } = ""; 8 | public string Image { get; set; } = ""; 9 | public DateTime? Date { get; set; } 10 | public int TimeInMinutes { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/CardRepository.cs: -------------------------------------------------------------------------------- 1 | namespace DataLayer; 2 | public class CardRepository : ICardRepository 3 | { 4 | private ISqlDataAccess _db; 5 | public CardRepository(ISqlDataAccess db) 6 | { 7 | _db = db; 8 | } 9 | public Task Find(int id) 10 | { 11 | throw new NotImplementedException(); 12 | } 13 | public Task> FindAll() 14 | { 15 | string sql = "select * from Cards"; 16 | return _db.LoadData(sql, new { }); 17 | } 18 | } -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/DataLayer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/ICardRepository.cs: -------------------------------------------------------------------------------- 1 | namespace DataLayer; 2 | public interface ICardRepository{ 3 | Task Find(int id); 4 | Task> FindAll(); 5 | } 6 | -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/ISqlDataAccess.cs: -------------------------------------------------------------------------------- 1 | namespace DataLayer; 2 | public interface ISqlDataAccess 3 | { 4 | string ConnectionStringName { get; set; } 5 | Task> LoadData(string sql, U parameters); 6 | Task SaveData(string sql, T parameters); 7 | } 8 | -------------------------------------------------------------------------------- /2023/Parte2/DataLayer/SqlDataAccess.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Data.SqlClient; 3 | using Dapper; 4 | using Microsoft.Extensions.Configuration; 5 | 6 | namespace DataLayer; 7 | 8 | public class SqlDataAccess : ISqlDataAccess 9 | { 10 | private readonly IConfiguration _config; 11 | public string ConnectionStringName { get; set; } = "Default"; 12 | public SqlDataAccess(IConfiguration config) 13 | { 14 | _config = config; 15 | } 16 | public async Task> LoadData(string sql, U parameters) 17 | { 18 | string? connectionString = _config.GetConnectionString(ConnectionStringName); 19 | using IDbConnection connection = new SqlConnection(connectionString); 20 | var data = await connection.QueryAsync(sql, parameters); 21 | return data.ToList(); 22 | } 23 | public async Task SaveData(string sql, T parameters) 24 | { 25 | string? connectionString = _config.GetConnectionString(ConnectionStringName); 26 | using (IDbConnection connection = new SqlConnection(connectionString)) 27 | { 28 | await connection.ExecuteAsync(sql, parameters); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /2023/Parte2/demo/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Data; 2 | 3 | public class WeatherForecast 4 | { 5 | public DateOnly Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Data; 2 | 3 | public class WeatherForecastService 4 | { 5 | private static readonly string[] Summaries = new[] 6 | { 7 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 8 | }; 9 | 10 | public Task GetForecastAsync(DateOnly startDate) 11 | { 12 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 13 | { 14 | Date = startDate.AddDays(index), 15 | TemperatureC = Random.Shared.Next(-20, 55), 16 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 17 | }).ToArray()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.002.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "demo", "demo.csproj", "{96D718E7-1E08-4983-9A74-408FCCA6445B}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataLayer", "..\DataLayer\DataLayer.csproj", "{49AB670C-8089-4CEC-AC8B-5DAA832E7C7A}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {96D718E7-1E08-4983-9A74-408FCCA6445B}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {49AB670C-8089-4CEC-AC8B-5DAA832E7C7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {49AB670C-8089-4CEC-AC8B-5DAA832E7C7A}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {49AB670C-8089-4CEC-AC8B-5DAA832E7C7A}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {49AB670C-8089-4CEC-AC8B-5DAA832E7C7A}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {64D1BBB3-353A-44EE-9DD0-A2EE3B09E660} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Counter/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/FetchData/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @using DataLayer 3 | 4 | @inject ICardRepository _db 5 | 6 | Cards List 7 | 8 |

Cards List

9 | 10 |

This component demonstrates fetching data from a database.

11 | 12 | @if (cards == null) 13 | { 14 |

Loading...

15 | } 16 | else 17 | { 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | @foreach (var card in cards) 28 | { 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 | 37 |
idnamedescription
@card.Id@card.Name@card.Description
38 | } 39 | 40 | @code { 41 | private List cards; 42 | 43 | protected override async Task OnInitializedAsync() 44 | { 45 | cards = await _db.FindAll(); 46 | } 47 | } -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Home/Card.cs: -------------------------------------------------------------------------------- 1 | namespace demo.Features.Home; 2 | public class Card 3 | { 4 | public int Id { get; set; } 5 | public string Name { get; set; } = ""; 6 | public string Description { get; set; } = ""; 7 | public string Image { get; set; } = ""; 8 | } 9 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Home/CardComponent.razor: -------------------------------------------------------------------------------- 1 | @using DataLayer; 2 | 3 |
4 | @card.Name 5 |
6 |
@card.Name
7 |
8 | 9 | @card.Name 10 |
11 |
12 |
13 | @code { 14 | [Parameter, EditorRequired] 15 | public CardModel card { get; set; } = default!; 16 | } 17 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Home/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @inject HttpClient Http 3 | @inject NavigationManager NavigationManager; 4 | @using DataLayer 5 | 6 | @inject ICardRepository _db 7 | 8 | Index 9 | 10 | @if (_cards == null) 11 | { 12 |

Loading cards...

13 | } 14 | else 15 | { 16 |
17 | @foreach (var card in _cards) 18 | { 19 | 20 | } 21 |
22 | } 23 | 24 | 25 | @code { 26 | private List _cards; 27 | protected override async Task OnInitializedAsync() 28 | { 29 | _cards = await _db.FindAll(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/Header.razor: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 |
3 | 4 |
5 | @Body 6 |
7 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .top-row, article { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  9 | 10 | 29 | 30 | @code { 31 | private bool collapseNavMenu = true; 32 | 33 | private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; 34 | 35 | private void ToggleNavMenu() 36 | { 37 | collapseNavMenu = !collapseNavMenu; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | 63 | .nav-scrollable { 64 | /* Allow sidebar to scroll for tall menus */ 65 | height: calc(100vh - 3.5rem); 66 | overflow-y: auto; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Features/Layout/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model demo.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

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

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace demo.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Microsoft.AspNetCore.Components.Web 3 | @namespace demo.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | An error has occurred. This application may no longer respond until reloaded. 25 | 26 | 27 | An unhandled exception has occurred. See browser dev tools for details. 28 | 29 | Reload 30 | 🗙 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | using Microsoft.AspNetCore.Components.Web; 3 | using demo.Data; 4 | using demo; 5 | using DataLayer; 6 | 7 | var builder = WebApplication.CreateBuilder(args); 8 | 9 | // Add services to the container. 10 | builder.Services.AddRazorPages(); 11 | builder.Services.AddServerSideBlazor(); 12 | builder.Services.AddSingleton(); 13 | builder.Services.AddHttpClient(); 14 | builder.Services.AddTransient(); 15 | builder.Services.AddTransient(); 16 | 17 | 18 | 19 | var app = builder.Build(); 20 | 21 | // Configure the HTTP request pipeline. 22 | if (!app.Environment.IsDevelopment()) 23 | { 24 | app.UseExceptionHandler("/Error"); 25 | } 26 | 27 | 28 | app.UseStaticFiles(); 29 | 30 | app.UseRouting(); 31 | 32 | app.MapBlazorHub(); 33 | app.MapFallbackToPage("/_Host"); 34 | 35 | app.Run(); 36 | -------------------------------------------------------------------------------- /2023/Parte2/demo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:46711", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "http": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5211", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2023/Parte2/demo/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using demo.Features 10 | @using demo.Features.Layout 11 | @using demo.Features.Home -------------------------------------------------------------------------------- /2023/Parte2/demo/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /2023/Parte2/demo/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "Default": "Server=DESKTOP-Q629G6J\\SQLEXPRESS;Database=cards;Trusted_Connection=True;MultipleActiveResultSets=true" 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /2023/Parte2/demo/demo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/data/cards.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "name": "Card 1", 5 | "description": "Card 1 description", 6 | "image": "https://static.vecteezy.com/system/resources/previews/000/595/201/original/community-people-care-logo-and-symbols-vector.jpg" 7 | }, 8 | { 9 | "id": 2, 10 | "name": "Card 2", 11 | "description": "Card 2 description", 12 | "image": "https://s3.amazonaws.com/thumbnails.venngage.com/template/537555f5-d940-45bd-97bb-5b65b018b2f2.png" 13 | } 14 | ] -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/favicon.png -------------------------------------------------------------------------------- /2023/Parte2/demo/wwwroot/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobmo/Blazor_Course/84ded90e5242392bb8691ddd005f3410a22dc044/2023/Parte2/demo/wwwroot/images/logo.png --------------------------------------------------------------------------------