-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create example Blazor WebAssembly project #139
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,16 @@ | |||
using Microsoft.AspNetCore.Blazor.Hosting; | |||
|
|||
namespace WebApplication1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And all NuGet packages can be upgraded to latest preview 3.1.0-preview4.19579.2
{ | ||
"version": 1, | ||
"dgSpecHash": "NDuF6YjtcCoYqH0XbROA+FgH7zDmqssPRAdSQCy8cZ7aXxpdQUXARuoTOz6FDYThRBRWOs3lpPIjDvsFSuQF3A==", | ||
"success": true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/obj/ is a dynamically generated folder and should not be committed to a source control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the files in obj subdirectory are usually ignored from git.
Please, anyone, finish the merging. |
Add example checklist