├── BlazorInteropJs.Client
├── Pages
│ ├── _ViewImports.cshtml
│ ├── Index.cshtml
│ ├── Counter.cshtml
│ ├── Moedas.cshtml.cs
│ ├── FetchData.cshtml
│ └── Moedas.cshtml
├── wwwroot
│ ├── css
│ │ ├── open-iconic
│ │ │ ├── font
│ │ │ │ ├── fonts
│ │ │ │ │ ├── open-iconic.eot
│ │ │ │ │ ├── open-iconic.otf
│ │ │ │ │ ├── open-iconic.ttf
│ │ │ │ │ ├── open-iconic.woff
│ │ │ │ │ └── open-iconic.svg
│ │ │ │ └── css
│ │ │ │ │ └── open-iconic-bootstrap.min.css
│ │ │ ├── ICON-LICENSE
│ │ │ ├── README.md
│ │ │ └── FONT-LICENSE
│ │ └── site.css
│ ├── index.html
│ └── js
│ │ └── interop.js
├── _ViewImports.cshtml
├── App.cshtml
├── Shared
│ ├── MainLayout.cshtml
│ ├── SurveyPrompt.cshtml
│ └── NavMenu.cshtml
├── Program.cs
├── BlazorInteropJs.Client.csproj
└── Properties
│ └── launchSettings.json
├── global.json
├── BlazorInteropJs.Shared
├── BlazorInteropJs.Shared.csproj
├── WeatherForecast.cs
└── MoedaViewModel.cs
├── README.md
├── BlazorInteropJs.Server
├── Program.cs
├── Properties
│ └── launchSettings.json
├── BlazorInteropJs.Server.csproj
├── Controllers
│ ├── SampleDataController.cs
│ └── CotacoesController.cs
└── Startup.cs
├── BlazorInteropJs.sln
├── .gitattributes
└── .gitignore
/BlazorInteropJs.Client/Pages/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @layout MainLayout
2 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "2.1.300"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Pages/Index.cshtml:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 |
Hello, world!
4 |
5 | Welcome to your new app.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brunobritodev/BlazorInteropJS/master/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brunobritodev/BlazorInteropJS/master/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brunobritodev/BlazorInteropJS/master/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brunobritodev/BlazorInteropJS/master/BlazorInteropJs.Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using Microsoft.AspNetCore.Blazor.Layouts
3 | @using Microsoft.AspNetCore.Blazor.Routing
4 | @using BlazorInteropJs.Client
5 | @using BlazorInteropJs.Client.Shared
6 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/App.cshtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Shared/BlazorInteropJs.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 7.3
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Pages/Counter.cshtml:
--------------------------------------------------------------------------------
1 | @page "/counter"
2 |
3 | Counter
4 |
5 | Current count: @currentCount
6 |
7 |
8 |
9 | @functions {
10 | int currentCount = 0;
11 |
12 | void IncrementCount()
13 | {
14 | currentCount++;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Shared/MainLayout.cshtml:
--------------------------------------------------------------------------------
1 | @inherits BlazorLayoutComponent
2 |
3 |
6 |
7 |
8 |
11 |
12 |
13 | @Body
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Shared/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace BlazorInteropJs.Shared
6 | {
7 | public class WeatherForecast
8 | {
9 | public DateTime Date { get; set; }
10 | public int TemperatureC { get; set; }
11 | public string Summary { get; set; }
12 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Shared/SurveyPrompt.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
@Title
4 |
5 |
6 | Please take our
7 |
8 | brief survey
9 |
10 |
11 | and tell us what you think.
12 |
13 |
14 | @functions {
15 | [Parameter]
16 | string Title { get; set; } // Demonstrates how a parent component can supply parameters
17 | }
18 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Blazor.Browser.Rendering;
2 | using Microsoft.AspNetCore.Blazor.Browser.Services;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using System;
5 |
6 | namespace BlazorInteropJs.Client
7 | {
8 | public class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var serviceProvider = new BrowserServiceProvider(services =>
13 | {
14 | // Add any custom services here
15 | });
16 |
17 | new BrowserRenderer(serviceProvider).AddComponent("app");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/BlazorInteropJs.Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Exe
6 | 7.3
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Blazor - Interoperabilidade com Javascript
5 |
6 | Este projeto faz interoperabilidade entre o Blazor e o Javascript, gerando um PDF do conteúdo com o [JSPdf](https://github.com/MrRio/jsPDF)
7 |
8 | Tecnologias utilizadas:
9 |
10 | * Blazor
11 | * Versão da Framework 2.1 preview 2
12 | * ASP.NET Core
13 | * Bootstrap 4
14 |
15 | # Como rodar
16 |
17 | 1. Abra o projeto no Visual Studio
18 | 2. Pressione F5
19 |
20 |
21 | Detalhes da implementação disponivel em
22 |
23 | [SaindoDaCaixinha - Blazor Primeiros Passos](https://www.saindodacaixinha.com.br/blazor-interop-js)
24 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Configuration;
4 |
5 | namespace BlazorInteropJs.Server
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | BuildWebHost(args).Run();
12 | }
13 |
14 | public static IWebHost BuildWebHost(string[] args) =>
15 | WebHost.CreateDefaultBuilder(args)
16 | .UseConfiguration(new ConfigurationBuilder()
17 | .AddCommandLine(args)
18 | .Build())
19 | .UseStartup()
20 | .Build();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | BlazorInteropJs
7 |
8 |
9 |
10 |
11 |
12 | Loading...
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:64151/",
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 | "BlazorInteropJs.Client": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:64155/"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:64143/",
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 | "BlazorInteropJs.Server": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:64152/"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/BlazorInteropJs.Server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 | 7.3
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Shared/MoedaViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace BlazorInteropJs.Shared
6 | {
7 | public class ListaMoedas
8 | {
9 | public Dictionary data { get; set; }
10 |
11 | }
12 |
13 | public class Moeda
14 | {
15 | public int id { get; set; }
16 | public string name { get; set; }
17 | public string symbol { get; set; }
18 | public int rank { get; set; }
19 | public Dictionary quotes { get; set; }
20 | }
21 |
22 | public class Cotacao
23 | {
24 | public decimal price { get; set; }
25 | }
26 |
27 | public class MoedaViewModel
28 | {
29 | public int Id { get; set; }
30 | public string Nome { get; set; }
31 | public string Simbolo { get; set; }
32 | public int Rank { get; set; }
33 | public decimal Preco { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/Controllers/SampleDataController.cs:
--------------------------------------------------------------------------------
1 | using BlazorInteropJs.Shared;
2 | using Microsoft.AspNetCore.Mvc;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 |
8 | namespace BlazorInteropJs.Server.Controllers
9 | {
10 | [Route("api/[controller]")]
11 | public class SampleDataController : Controller
12 | {
13 | private static string[] Summaries = new[]
14 | {
15 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
16 | };
17 |
18 | [HttpGet("[action]")]
19 | public IEnumerable WeatherForecasts()
20 | {
21 | var rng = new Random();
22 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
23 | {
24 | Date = DateTime.Now.AddDays(index),
25 | TemperatureC = rng.Next(-20, 55),
26 | Summary = Summaries[rng.Next(Summaries.Length)]
27 | });
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/Controllers/CotacoesController.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Net.Http;
4 | using System.Threading.Tasks;
5 | using BlazorInteropJs.Shared;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Newtonsoft.Json;
8 |
9 | namespace BlazorInteropJs.Server.Controllers
10 | {
11 | public class CotacaoController : Controller
12 | {
13 | [Route("api/cotacao")]
14 | public async Task Index()
15 | {
16 | var client = new HttpClient();
17 | var conteudo = await client.GetStringAsync("https://api.coinmarketcap.com/v2/ticker/");
18 |
19 | var moedas = JsonConvert.DeserializeObject(conteudo).data.Select(s => new MoedaViewModel()
20 | {
21 | Id = s.Value.id,
22 | Nome = s.Value.name,
23 | Simbolo = s.Value.symbol,
24 | Rank = s.Value.rank,
25 | Preco = s.Value.quotes["USD"].price,
26 | }).ToList();
27 | return Ok(moedas);
28 | }
29 |
30 |
31 | }
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/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.
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Pages/Moedas.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 | using BlazorInteropJs.Shared;
5 | using Microsoft.AspNetCore.Blazor;
6 | using Microsoft.AspNetCore.Blazor.Browser.Interop;
7 | using Microsoft.AspNetCore.Blazor.Components;
8 |
9 | namespace BlazorInteropJs.Client.Pages
10 | {
11 |
12 | public class MoedasModel : BlazorComponent
13 | {
14 |
15 | [Inject]
16 | protected HttpClient Http { get; set; }
17 |
18 | protected List Moedas;
19 |
20 | protected override async Task OnInitAsync()
21 | {
22 | Moedas = await Http.GetJsonAsync>($"/api/cotacao");
23 | }
24 |
25 | protected override void OnAfterRender()
26 | {
27 | RegisteredFunction.Invoke("DocumentReady");
28 | }
29 | protected void CallJSMethod()
30 | {
31 | RegisteredFunction.Invoke("GerarPDF");
32 | }
33 |
34 |
35 | public static string ExecutarRotinaCSharp(string nome)
36 | {
37 | return $"O javascript informou: {nome}";
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Pages/FetchData.cshtml:
--------------------------------------------------------------------------------
1 | @using BlazorInteropJs.Shared
2 | @page "/fetchdata"
3 | @inject HttpClient Http
4 |
5 | Weather forecast
6 |
7 | This component demonstrates fetching data from the server.
8 |
9 | @if (forecasts == null)
10 | {
11 | Loading...
12 | }
13 | else
14 | {
15 |
16 |
17 |
18 | | Date |
19 | Temp. (C) |
20 | Temp. (F) |
21 | Summary |
22 |
23 |
24 |
25 | @foreach (var forecast in forecasts)
26 | {
27 |
28 | | @forecast.Date.ToShortDateString() |
29 | @forecast.TemperatureC |
30 | @forecast.TemperatureF |
31 | @forecast.Summary |
32 |
33 | }
34 |
35 |
36 | }
37 |
38 | @functions {
39 | WeatherForecast[] forecasts;
40 |
41 | protected override async Task OnInitAsync()
42 | {
43 | forecasts = await Http.GetJsonAsync("api/SampleData/WeatherForecasts");
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Shared/NavMenu.cshtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
27 |
28 | @functions {
29 | bool collapseNavMenu = true;
30 |
31 | void ToggleNavMenu()
32 | {
33 | collapseNavMenu = !collapseNavMenu;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/Pages/Moedas.cshtml:
--------------------------------------------------------------------------------
1 | @page "/moedas"
2 | @inherits BlazorInteropJs.Client.Pages.MoedasModel
3 |
4 | @if (Moedas == null)
5 | {
6 |
7 | }
8 | else
9 | {
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | | Nome |
26 | Simbolo |
27 | Rank |
28 | Preco |
29 |
30 |
31 |
32 | @foreach (var moeda in Moedas)
33 | {
34 |
35 | | @moeda.Nome |
36 | @moeda.Simbolo |
37 | @moeda.Rank |
38 | USD @moeda.Preco.ToString("N") |
39 |
40 | }
41 |
42 |
43 |
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Server/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Blazor.Server;
2 | using Microsoft.AspNetCore.Builder;
3 | using Microsoft.AspNetCore.Hosting;
4 | using Microsoft.AspNetCore.ResponseCompression;
5 | using Microsoft.Extensions.DependencyInjection;
6 | using Newtonsoft.Json.Serialization;
7 | using System.Linq;
8 | using System.Net.Mime;
9 |
10 | namespace BlazorInteropJs.Server
11 | {
12 | public class Startup
13 | {
14 | // This method gets called by the runtime. Use this method to add services to the container.
15 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
16 | public void ConfigureServices(IServiceCollection services)
17 | {
18 | services.AddMvc();
19 |
20 | services.AddResponseCompression(options =>
21 | {
22 | options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
23 | {
24 | MediaTypeNames.Application.Octet,
25 | WasmMediaTypeNames.Application.Wasm,
26 | });
27 | });
28 | }
29 |
30 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
31 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
32 | {
33 | app.UseResponseCompression();
34 |
35 | if (env.IsDevelopment())
36 | {
37 | app.UseDeveloperExceptionPage();
38 | }
39 |
40 | app.UseMvc(routes =>
41 | {
42 | routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
43 | });
44 |
45 | app.UseBlazor();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/BlazorInteropJs.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2035
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorInteropJs.Server", "BlazorInteropJs.Server\BlazorInteropJs.Server.csproj", "{73E08EFC-0B0C-4D76-9115-18362BA40036}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorInteropJs.Client", "BlazorInteropJs.Client\BlazorInteropJs.Client.csproj", "{D686CACE-38A2-4F76-A817-E46D3FDD4F9E}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorInteropJs.Shared", "BlazorInteropJs.Shared\BlazorInteropJs.Shared.csproj", "{A747175B-8193-44DC-B1AE-C8B5CE12E0FC}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {73E08EFC-0B0C-4D76-9115-18362BA40036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {73E08EFC-0B0C-4D76-9115-18362BA40036}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {73E08EFC-0B0C-4D76-9115-18362BA40036}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {73E08EFC-0B0C-4D76-9115-18362BA40036}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {D686CACE-38A2-4F76-A817-E46D3FDD4F9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {D686CACE-38A2-4F76-A817-E46D3FDD4F9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {D686CACE-38A2-4F76-A817-E46D3FDD4F9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {D686CACE-38A2-4F76-A817-E46D3FDD4F9E}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {A747175B-8193-44DC-B1AE-C8B5CE12E0FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {A747175B-8193-44DC-B1AE-C8B5CE12E0FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {A747175B-8193-44DC-B1AE-C8B5CE12E0FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {A747175B-8193-44DC-B1AE-C8B5CE12E0FC}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {1DBDAF33-5941-4DD2-899E-9C224D118E5E}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/wwwroot/js/interop.js:
--------------------------------------------------------------------------------
1 | Blazor.registerFunction('GerarPDF', function () {
2 | // PDF - Init the configs
3 | var pdf = new jsPDF('p', 'pt', 'letter');
4 | // source can be HTML-formatted string, or a reference
5 | // to an actual DOM element from which the text will be scraped.
6 | var source = $('#tabelaCotacoes')[0];
7 | // we support special element handlers. Register them with jQuery-style
8 | // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
9 | // There is no support for any other type of selectors
10 | // (class, of compound) at this time.
11 | var specialElementHandlers = {
12 | // element with id of "bypass" - jQuery style selector
13 | '#bypassme': function (element, renderer) {
14 | // true = "handled elsewhere, bypass text extraction"
15 | return true
16 | }
17 | };
18 | var margins = {
19 | top: 80,
20 | bottom: 60,
21 | left: 40,
22 | width: 522
23 | };
24 | // all coords and widths are in jsPDF instance's declared units
25 | // 'inches' in this case
26 | pdf.fromHTML(
27 | source, // HTML string or DOM elem ref.
28 | margins.left, // x coord
29 | margins.top, {// y coord
30 | 'width': margins.width, // max width of content on PDF
31 | 'elementHandlers': specialElementHandlers
32 | }, margins);
33 |
34 | // dispose: object with X, Y of the last line add to the PDF
35 | // this allow the insertion of new lines after html
36 | pdf.save('cotacoes.pdf');
37 | });
38 |
39 | Blazor.registerFunction("DocumentReady", function () {
40 | if (document.getElementById('btnJsToCs') == null)
41 | return;
42 |
43 | var events = $._data(document.getElementById('btnJsToCs'), "events");
44 | var hasEvents = (events != null);
45 | if (!hasEvents) {
46 | $("#btnJsToCs").on("click", function () {
47 |
48 | let resultAsJavaScriptString = Blazor.invokeDotNetMethod({
49 | type: {
50 | assembly: 'BlazorInteropJs.Client',
51 | name: 'BlazorInteropJs.Client.Pages.MoedasModel'
52 |
53 | },
54 | method: {
55 | name: 'ExecutarRotinaCSharp'
56 | }
57 | }, "Saindo Da Caixinha");
58 |
59 | $("#resultadoCSharp").text("Resultado do metodo: " + resultAsJavaScriptString);
60 | });
61 | }
62 | });
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/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 | app {
8 | position: relative;
9 | display: flex;
10 | flex-direction: column;
11 | }
12 |
13 | .top-row {
14 | height: 3.5rem;
15 | display: flex;
16 | align-items: center;
17 | }
18 |
19 | .main {
20 | flex: 1;
21 | }
22 |
23 | .main .top-row {
24 | background-color: #e6e6e6;
25 | border-bottom: 1px solid #d6d5d5;
26 | }
27 |
28 | .sidebar {
29 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
30 | }
31 |
32 | .sidebar .top-row {
33 | background-color: rgba(0,0,0,0.4);
34 | }
35 |
36 | .sidebar .navbar-brand {
37 | font-size: 1.1rem;
38 | }
39 |
40 | .sidebar .oi {
41 | width: 2rem;
42 | font-size: 1.1rem;
43 | vertical-align: text-top;
44 | top: -2px;
45 | }
46 |
47 | .nav-item {
48 | font-size: 0.9rem;
49 | padding-bottom: 0.5rem;
50 | }
51 |
52 | .nav-item:first-of-type {
53 | padding-top: 1rem;
54 | }
55 |
56 | .nav-item:last-of-type {
57 | padding-bottom: 1rem;
58 | }
59 |
60 | .nav-item a {
61 | color: #d7d7d7;
62 | border-radius: 4px;
63 | height: 3rem;
64 | display: flex;
65 | align-items: center;
66 | line-height: 3rem;
67 | }
68 |
69 | .nav-item a.active {
70 | background-color: rgba(255,255,255,0.25);
71 | color: white;
72 | }
73 |
74 | .nav-item a:hover {
75 | background-color: rgba(255,255,255,0.1);
76 | color: white;
77 | }
78 |
79 | .content {
80 | padding-top: 1.1rem;
81 | }
82 |
83 | .navbar-toggler {
84 | background-color: rgba(255, 255, 255, 0.1);
85 | }
86 |
87 | @media (max-width: 767.98px) {
88 | .main .top-row {
89 | display: none;
90 | }
91 | }
92 |
93 | @media (min-width: 768px) {
94 | app {
95 | flex-direction: row;
96 | }
97 |
98 | .sidebar {
99 | width: 250px;
100 | height: 100vh;
101 | position: sticky;
102 | top: 0;
103 | }
104 |
105 | .main .top-row {
106 | position: sticky;
107 | top: 0;
108 | }
109 |
110 | .main > div {
111 | padding-left: 2rem !important;
112 | padding-right: 1.5rem !important;
113 | }
114 |
115 | .navbar-toggler {
116 | display: none;
117 | }
118 |
119 | .sidebar .collapse {
120 | /* Never collapse the sidebar for wide screens */
121 | display: block;
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/BlazorInteropJs.Client/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 |
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* `