Create example Blazor WebAssembly project#139
Create example Blazor WebAssembly project#139NeoXtreem wants to merge 2 commits intotradingview:masterfrom
Conversation
| @@ -0,0 +1,16 @@ | |||
| using Microsoft.AspNetCore.Blazor.Hosting; | |||
|
|
|||
| namespace WebApplication1 | |||
There was a problem hiding this comment.
It would be clearer if the project's name matches the language of an example
| namespace WebApplication1 | |
| namespace BlazorWasmExample |
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width" /> | ||
| <title>WebApplication1</title> |
There was a problem hiding this comment.
Probably need change project's name string everywhere in the code
| <title>WebApplication1</title> | |
| <title>BlazorWasmExample</title> |
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netstandard2.0</TargetFramework> |
There was a problem hiding this comment.
At the time being the current version of Blazor supports netstandard2.1
| <TargetFramework>netstandard2.0</TargetFramework> | |
| <TargetFramework>netstandard2.1</TargetFramework> |
| var tvWidget = null; | ||
| window.tradingViewChartWrapper = { | ||
|
|
||
| initialize: function () { | ||
| const widgetOptions = { | ||
| symbol: 'AAPL', | ||
| // BEWARE: no trailing slash is expected in feed URL | ||
| datafeed: new window.Datafeeds.UDFCompatibleDatafeed('https://demo_feed.tradingview.com'), | ||
| interval: 'D', | ||
| container_id: 'tv_chart_container', | ||
| library_path: '/charting_library/', | ||
| locale: getLanguageFromUrl() || 'en', | ||
| disabled_features: ['use_localstorage_for_settings'], | ||
| enabled_features: ['study_templates'], | ||
| charts_storage_url: 'https://saveload.tradingview.com', | ||
| charts_storage_api_version: '1.1', | ||
| client_id: 'tradingview.com', | ||
| user_id: 'public_user_id', | ||
| fullscreen: false, | ||
| autosize: true, | ||
| studies_overrides: {} | ||
| }; | ||
|
|
||
| tvWidget = new TradingView.widget(widgetOptions); | ||
|
|
||
| tvWidget.onChartReady(() => { | ||
| tvWidget.headerReady().then(() => { | ||
| const button = tvWidget.createButton(); | ||
| button.setAttribute('title', 'Click to show a notification popup'); | ||
| button.classList.add('apply-common-tooltip'); | ||
| button.addEventListener('click', | ||
| () => tvWidget.showNoticeDialog({ | ||
| title: 'Notification', | ||
| body: 'TradingView Charting Library API works correctly', | ||
| callback: () => { | ||
| console.log('Noticed!'); | ||
| } | ||
| })); | ||
|
|
||
| button.innerHTML = 'Check API'; | ||
| }); | ||
| }); | ||
| } | ||
| }; |
There was a problem hiding this comment.
A better place to store the initialization script is a separate javascript file.
| <PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview1.19508.20" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview1.19508.20" PrivateAssets="all" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview1.19508.20" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview1.19508.20" PrivateAssets="all" /> |
There was a problem hiding this comment.
And all NuGet packages can be upgraded to latest preview 3.1.0-preview4.19579.2
| { | ||
| "version": 1, | ||
| "dgSpecHash": "NDuF6YjtcCoYqH0XbROA+FgH7zDmqssPRAdSQCy8cZ7aXxpdQUXARuoTOz6FDYThRBRWOs3lpPIjDvsFSuQF3A==", | ||
| "success": true | ||
| } No newline at end of file |
There was a problem hiding this comment.
/obj/ is a dynamically generated folder and should not be committed to a source control
hmG3
left a comment
There was a problem hiding this comment.
Just tried this example, everything works. Nice to see that Blazor is growing and gaining popularity.
| @@ -0,0 +1,24 @@ | |||
| <?xml version="1.0" encoding="utf-8" standalone="no"?> | |||
There was a problem hiding this comment.
This file is generated during package restore, it should be ignored from version control.
| @@ -0,0 +1,12 @@ | |||
| <?xml version="1.0" encoding="utf-8" standalone="no"?> | |||
There was a problem hiding this comment.
All the files in obj subdirectory are usually ignored from git.
|
Please, anyone, finish the merging. |
Add example checklist