├── .gitattributes ├── .gitignore ├── BlazorBookExamples.sln ├── BookServer ├── App.razor ├── BookServer.csproj ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs ├── Geolocation │ └── Geolocation.cs ├── Pages │ ├── ClassLibConsumer.razor │ ├── Converter.razor │ ├── Counter.razor │ ├── Error.razor │ ├── FetchData.razor │ ├── FetchData.razor.cs │ ├── GeolocationExample.razor │ ├── Index.razor │ ├── RenderTreeExample.razor │ ├── WeeklyForecast.razor │ ├── _Host.cshtml │ └── _Layout.cshtml ├── Program.cs ├── Properties │ └── launchSettings.json ├── Shared │ ├── MainLayout.razor │ ├── NavMenu.razor │ ├── SurveyPrompt.razor │ ├── ThemeChooser.razor │ └── WeatherDay.razor ├── _Imports.razor ├── appsettings.Development.json ├── appsettings.json └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap-dark.css │ │ ├── bootstrap-light.css │ │ ├── bootstrap-light.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── dark.css │ ├── light.css │ ├── 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 │ ├── geolocation.js │ └── themeChooser.js ├── BookWasm ├── App.razor ├── BookWasm.csproj ├── Data │ └── WeatherForecast.cs ├── Geolocation │ └── Geolocation.cs ├── Pages │ ├── ClassLibConsumer.razor │ ├── Converter.razor │ ├── Counter.razor │ ├── FetchData.razor │ ├── FetchData.razor.cs │ ├── GeolocationExample.razor │ ├── Index.razor │ ├── RenderTreeExample.razor │ └── WeeklyForecast.razor ├── Program.cs ├── Properties │ └── launchSettings.json ├── Shared │ ├── MainLayout.razor │ ├── NavMenu.razor │ ├── SurveyPrompt.razor │ ├── ThemeChooser.razor │ └── WeatherDay.razor ├── _Imports.razor └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap-dark.css │ │ ├── bootstrap-light.css │ │ └── bootstrap-light.css.map │ ├── dark.css │ ├── light.css │ ├── 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 │ ├── index.html │ ├── js │ ├── geolocation.js │ └── themeChooser.js │ └── sample-data │ └── weather.json ├── README.md ├── RazorClassLibrary1 ├── Component1.razor ├── ExampleJsInterop.cs ├── RazorClassLibrary1.csproj ├── _Imports.razor └── wwwroot │ ├── background.png │ ├── exampleJsInterop.js │ └── styles.css ├── Telerik └── TelerikBlazorApp1 │ ├── Client │ ├── App.razor │ ├── Pages │ │ ├── Chart.razor │ │ ├── Form.razor │ │ ├── Grid.razor │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Services │ │ └── WeatherForecastService.cs │ ├── Shared │ │ ├── MainLayout.razor │ │ ├── NavMenu.razor │ │ └── ThemeChooser.razor │ ├── TelerikBlazorApp1.Client.csproj │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── bootstrap │ │ │ ├── bootstrap-dark.css │ │ │ ├── bootstrap-light.css │ │ │ └── bootstrap-light.css.map │ │ ├── dark.css │ │ ├── light.css │ │ ├── material-dark.css │ │ ├── material-light.css │ │ └── 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 │ │ ├── favicon.ico │ │ ├── index.html │ │ └── themeChooser.js │ ├── NuGet.Config │ ├── Server │ ├── Controllers │ │ └── WeatherForecastController.cs │ ├── Pages │ │ ├── Error.cshtml │ │ ├── Error.cshtml.cs │ │ └── Shared │ │ │ └── _Layout.cshtml │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ └── TelerikBlazorApp1.Server.csproj │ ├── Shared │ ├── DropDownModel.cs │ ├── MenuItem.cs │ ├── Person.cs │ ├── TelerikBlazorApp1.Shared.csproj │ └── WeatherForecast.cs │ └── TelerikBlazorApp1.sln ├── _config.yml └── docs └── YouTube.png /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /BlazorBookExamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29924.181 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookWasm", "BookWasm\BookWasm.csproj", "{CD2DD165-BDD3-4A4B-821A-B7E0B1F5473F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookServer", "BookServer\BookServer.csproj", "{F62FB0EB-CA4F-4F79-A153-F1FB1C80C3B1}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorClassLibrary1", "RazorClassLibrary1\RazorClassLibrary1.csproj", "{DDEE9C71-BA61-4B50-9C74-0F15C78C212E}" 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 | {CD2DD165-BDD3-4A4B-821A-B7E0B1F5473F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {CD2DD165-BDD3-4A4B-821A-B7E0B1F5473F}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {CD2DD165-BDD3-4A4B-821A-B7E0B1F5473F}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {CD2DD165-BDD3-4A4B-821A-B7E0B1F5473F}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {F62FB0EB-CA4F-4F79-A153-F1FB1C80C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {F62FB0EB-CA4F-4F79-A153-F1FB1C80C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {F62FB0EB-CA4F-4F79-A153-F1FB1C80C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {F62FB0EB-CA4F-4F79-A153-F1FB1C80C3B1}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {DDEE9C71-BA61-4B50-9C74-0F15C78C212E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {DDEE9C71-BA61-4B50-9C74-0F15C78C212E}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {DDEE9C71-BA61-4B50-9C74-0F15C78C212E}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {DDEE9C71-BA61-4B50-9C74-0F15C78C212E}.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 = {D0CDF8E3-F0D0-46F3-8A25-85D12D9496A9} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /BookServer/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /BookServer/BookServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BookServer/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BookServer.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; } = string.Empty; 14 | 15 | public bool Selected { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BookServer/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace BookServer.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 | "Cloudy", "Rainy", "Sunny" 13 | }; 14 | 15 | public Task GetForecastAsync(DateTime startDate) 16 | { 17 | var rng = new Random(); 18 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 19 | { 20 | Date = startDate.AddDays(index), 21 | TemperatureC = rng.Next(-20, 55), 22 | Summary = Summaries[rng.Next(Summaries.Length)] 23 | }).ToArray()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BookServer/Geolocation/Geolocation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | using System; 3 | using System.Threading.Tasks; 4 | 5 | namespace BookServer.Geolocation 6 | { 7 | public class Geolocation 8 | { 9 | private Action? OnGetPosition; 10 | private Action? OnGetPositionError; 11 | 12 | private readonly IJSRuntime js; 13 | public Geolocation(IJSRuntime js) 14 | { 15 | this.js = js; 16 | } 17 | 18 | public async ValueTask HasGeolocationFeature() => 19 | await js.InvokeAsync("blazorGeolocation.hasGeolocaitonFeature"); 20 | 21 | 22 | [JSInvokable] 23 | public void RaiseOnGetPosition(Position p) => OnGetPosition?.Invoke(p); 24 | 25 | [JSInvokable] 26 | public void RaiseOnGetPositionError(PositionError err) => OnGetPositionError?.Invoke(err); 27 | 28 | public async ValueTask GetCurrentPosition(Action onSuccess, Action onError, PositionOptions? options = null) 29 | { 30 | OnGetPosition = onSuccess; 31 | OnGetPositionError = onError; 32 | await js.InvokeVoidAsync("blazorGeolocation.getCurrentPosition", DotNetObjectReference.Create(this), options); 33 | } 34 | } 35 | 36 | public class PositionOptions 37 | { 38 | public bool EnableHighAccuracy { get; set; } = false; 39 | public int Timeout { get; set; } 40 | public int MaximumAge { get; set; } = 0; 41 | } 42 | 43 | public class Coords 44 | { 45 | public double Latitude { get; set; } 46 | public double Longitude { get; set; } 47 | } 48 | 49 | public class Position 50 | { 51 | public Coords? Coords { get; set; } 52 | public DateTime Timestamp { get; set; } 53 | } 54 | 55 | public enum PositionError 56 | { 57 | PERMISSION_DENIED = 1, 58 | POSITION_UNAVAILABLE, 59 | TIMEOUT 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BookServer/Pages/ClassLibConsumer.razor: -------------------------------------------------------------------------------- 1 | @page "/classlib" 2 | @inject IJSRuntime js 3 | 4 |

ClassLib Consumer

5 | 6 |

Hello, @message!

7 | 8 | 9 | 10 | 11 | @code { 12 | string message = "world"; 13 | async Task ShowPrompt() 14 | { 15 | message = await ExampleJsInterop.Prompt(js, "Say hello:"); 16 | } 17 | } -------------------------------------------------------------------------------- /BookServer/Pages/Converter.razor: -------------------------------------------------------------------------------- 1 | @page "/converter" 2 |

Converter

3 | 4 | 5 | 8 | = 9 | 12 | 13 | 14 | @code { 15 | double inches = 1; // default value 16 | public double Inches 17 | { 18 | get => inches; 19 | set 20 | { 21 | centimeters = value * 2.54; 22 | inches = value; 23 | } 24 | } 25 | 26 | double centimeters = 2.54; // default value 27 | public double Centimeters 28 | { 29 | get => centimeters; 30 | set 31 | { 32 | inches = value / 2.54; 33 | centimeters = value; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /BookServer/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 | -------------------------------------------------------------------------------- /BookServer/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 |

-------------------------------------------------------------------------------- /BookServer/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 |

Weather forecast

4 | 5 |

This component demonstrates fetching data from a service.

6 | 7 | @if (forecasts == null) 8 | { 9 |

Loading...

10 | } 11 | else 12 | { 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach (var forecast in forecasts) 24 | { 25 | 26 | 27 | 28 | 29 | 30 | 31 | } 32 | 33 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
34 | } 35 | -------------------------------------------------------------------------------- /BookServer/Pages/FetchData.razor.cs: -------------------------------------------------------------------------------- 1 | using BookServer.Data; 2 | using Microsoft.AspNetCore.Components; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace BookServer.Pages 7 | { 8 | public partial class FetchData 9 | { 10 | [Inject] 11 | WeatherForecastService ForecastService { get; set; } = null!; 12 | 13 | private WeatherForecast[]? forecasts; 14 | 15 | protected override async Task OnInitializedAsync() 16 | { 17 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BookServer/Pages/GeolocationExample.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime js 2 | @using Geolocation 3 | @page "/geo" 4 | 5 |

Hello, world!

6 | 7 | @if (hasGeoLocation) 8 | { 9 |

Browser has GeoLocation

10 | } 11 | 12 | @if (position != null) 13 | { 14 |

Current position: @position.Coords.Latitude Lat, @position.Coords.Longitude Long

15 |

Position reported at: @position.Timestamp

16 | } 17 | 18 | @switch (error) 19 | { 20 | case PositionError.PERMISSION_DENIED: 21 |

GeoLocation Permisson Denied

22 | break; 23 | case PositionError.POSITION_UNAVAILABLE: 24 |

GeoLocation Position Unavailable

25 | break; 26 | case PositionError.TIMEOUT: 27 |

GeoLocation Timeout

28 | break; 29 | default: 30 | break; 31 | } 32 | 33 | @code { 34 | Position position; 35 | PositionError error; 36 | bool hasGeoLocation; 37 | 38 | void OnSuccess(Position p) { 39 | position = p; 40 | StateHasChanged(); 41 | } 42 | 43 | void OnError(PositionError e) { 44 | error = e; 45 | StateHasChanged(); 46 | } 47 | 48 | protected override async Task OnAfterRenderAsync(bool firstRender) 49 | { 50 | if (firstRender) 51 | { 52 | var geo = new Geolocation(js); 53 | hasGeoLocation = await geo.HasGeolocationFeature(); 54 | StateHasChanged(); 55 | 56 | var options = new PositionOptions() { EnableHighAccuracy = false, Timeout = 200, MaximumAge = 0 }; 57 | await geo.GetCurrentPosition(OnSuccess, OnError, options); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /BookServer/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | 8 | -------------------------------------------------------------------------------- /BookServer/Pages/RenderTreeExample.razor: -------------------------------------------------------------------------------- 1 | @page "/rendertreeexample" 2 |

RenderTree Example

3 |

See source code to toggle the key attribute.

4 | 5 |
    6 | @foreach (var item in items) 7 | { 8 | @* remove key attribute to see the effect on checkbox *@ 9 |
  • 10 |

    @item.Value

    11 | 12 |
  • 13 | } 14 |
15 | 16 | 17 | @code { 18 | // class Color {int Id, string Value} 19 | IEnumerable items = new Color[] { 20 | new Color {Id = 0, Value = "Green" }, 21 | new Color {Id = 1, Value = "Blue" }, 22 | new Color {Id = 2, Value = "Orange" }, 23 | new Color {Id = 3, Value = "Purple" } 24 | }; 25 | } 26 | 27 | @code { 28 | public class Color 29 | { 30 | public int Id { get; set; } 31 | public string Value { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BookServer/Pages/WeeklyForecast.razor: -------------------------------------------------------------------------------- 1 | @page "/weeklyforecast" 2 | @using BookServer.Data 3 | @inject WeatherForecastService ForecastService 4 | 5 |

WeeklyForecast

6 | 7 |
8 | @if (forecasts == null) 9 | { 10 | No Data 11 | } 12 | else 13 | { 14 | @foreach (var forecast in forecasts) 15 | { 16 | 21 | 22 | @if (forecast.Summary == "Rainy") 23 | { 24 |
25 | Tornado Warning! 26 |
27 | } 28 |
29 |
30 | } 31 | } 32 |
33 | 34 | @code { 35 | private WeatherForecast[] forecasts; 36 | 37 | protected override async Task OnInitializedAsync() 38 | { 39 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 40 | } 41 | 42 | void HandleItemSelected(DayOfWeek selectedValue) 43 | { 44 | // Clear selections 45 | foreach (var item in forecasts) 46 | item.Selected = false; 47 | forecasts.First(f => f.Date.DayOfWeek == selectedValue).Selected = true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /BookServer/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace BookServer.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = "_Layout"; 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /BookServer/Pages/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Components.Web 2 | @namespace BookServer.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | @RenderBody() 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 | -------------------------------------------------------------------------------- /BookServer/Program.cs: -------------------------------------------------------------------------------- 1 | using BookServer.Data; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | // Add services to the container. 6 | builder.Services.AddRazorPages(); 7 | builder.Services.AddServerSideBlazor(); 8 | builder.Services.AddSingleton(); 9 | 10 | var app = builder.Build(); 11 | 12 | // Configure the HTTP request pipeline. 13 | if (!app.Environment.IsDevelopment()) 14 | { 15 | app.UseExceptionHandler("/Error"); 16 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 17 | app.UseHsts(); 18 | } 19 | 20 | app.UseHttpsRedirection(); 21 | 22 | app.UseStaticFiles(); 23 | 24 | app.UseRouting(); 25 | 26 | app.MapBlazorHub(); 27 | app.MapFallbackToPage("/_Host"); 28 | 29 | app.Run(); 30 | -------------------------------------------------------------------------------- /BookServer/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:30052", 7 | "sslPort": 44344 8 | } 9 | }, 10 | "profiles": { 11 | "BookServer": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7134;http://localhost:5134", 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 | -------------------------------------------------------------------------------- /BookServer/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | BookServer 4 | 5 | 8 | 9 |
10 |
11 | About 12 |
13 | 14 |
15 | @Body 16 |
17 |
18 | -------------------------------------------------------------------------------- /BookServer/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 51 |
52 | 53 | @code { 54 | private bool collapseNavMenu = true; 55 | 56 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 57 | 58 | private void ToggleNavMenu() 59 | { 60 | collapseNavMenu = !collapseNavMenu; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /BookServer/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 | -------------------------------------------------------------------------------- /BookServer/Shared/ThemeChooser.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime js 2 |
3 | Click here to switch themes 4 | 5 |
6 | 7 | @code { 8 | 9 | bool isDark; 10 | string SetThemeName => isDark ? "Dark" : "Light"; 11 | 12 | async Task SwapTheme() { 13 | isDark = !isDark; 14 | await js.InvokeVoidAsync("themeChooser.setTheme", SetThemeName); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BookServer/Shared/WeatherDay.razor: -------------------------------------------------------------------------------- 1 | 
2 |
3 | 4 |

@TemperatureC C°

5 | @CustomMessage 6 |

7 | @Summary weather expected @DayOfWeek 8 |

9 |
10 |
11 | 12 | @code { 13 | 14 | string IconCssClass => 15 | Summary == "Cloudy" ? "cloud" : 16 | Summary == "Rainy" ? "rain" : 17 | "sun"; 18 | 19 | [Parameter] 20 | public string Summary { get; set; } 21 | 22 | [Parameter] 23 | public int TemperatureC { get; set; } 24 | 25 | [Parameter] 26 | public DayOfWeek DayOfWeek { get; set; } 27 | 28 | [Parameter] 29 | public RenderFragment CustomMessage { get; set; } 30 | 31 | [Parameter] 32 | public EventCallback OnSelected { get; set; } 33 | 34 | void HandleOnSelected() 35 | { 36 | OnSelected.InvokeAsync(this.DayOfWeek); 37 | } 38 | 39 | [Parameter] 40 | public bool Selected { get; set; } 41 | 42 | private string SelectedCss => Selected ? 43 | "bg-primary text-white" : "bg-light"; 44 | } -------------------------------------------------------------------------------- /BookServer/_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 BookServer 10 | @using BookServer.Shared 11 | @using RazorClassLibrary1 -------------------------------------------------------------------------------- /BookServer/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 | -------------------------------------------------------------------------------- /BookServer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /BookServer/wwwroot/css/dark.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-dark.css'); 2 | @import url('site.css'); -------------------------------------------------------------------------------- /BookServer/wwwroot/css/light.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-light.css'); 2 | @import url('site.css'); -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /BookServer/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. -------------------------------------------------------------------------------- /BookServer/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 | -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookServer/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /BookServer/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 | #app { 18 | position: relative; 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | 23 | .top-row { 24 | height: 3.5rem; 25 | display: flex; 26 | align-items: center; 27 | } 28 | 29 | .main { 30 | flex: 1; 31 | } 32 | 33 | .main .top-row { 34 | background-color: #f7f7f7; 35 | border-bottom: 1px solid #d6d5d5; 36 | justify-content: flex-end; 37 | } 38 | 39 | .main .top-row > a, .main .top-row .btn-link { 40 | white-space: nowrap; 41 | margin-left: 1.5rem; 42 | } 43 | 44 | .main .top-row a:first-child { 45 | overflow: hidden; 46 | text-overflow: ellipsis; 47 | } 48 | 49 | .sidebar { 50 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 51 | } 52 | 53 | .sidebar .top-row { 54 | background-color: rgba(0,0,0,0.4); 55 | } 56 | 57 | .sidebar .navbar-brand { 58 | font-size: 1.1rem; 59 | } 60 | 61 | .sidebar .oi { 62 | width: 2rem; 63 | font-size: 1.1rem; 64 | vertical-align: text-top; 65 | top: -2px; 66 | } 67 | 68 | .sidebar .nav-item { 69 | font-size: 0.9rem; 70 | padding-bottom: 0.5rem; 71 | } 72 | 73 | .sidebar .nav-item:first-of-type { 74 | padding-top: 1rem; 75 | } 76 | 77 | .sidebar .nav-item:last-of-type { 78 | padding-bottom: 1rem; 79 | } 80 | 81 | .sidebar .nav-item a { 82 | color: #d7d7d7; 83 | border-radius: 4px; 84 | height: 3rem; 85 | display: flex; 86 | align-items: center; 87 | line-height: 3rem; 88 | } 89 | 90 | .sidebar .nav-item a.active { 91 | background-color: rgba(255,255,255,0.25); 92 | color: white; 93 | } 94 | 95 | .sidebar .nav-item a:hover { 96 | background-color: rgba(255,255,255,0.1); 97 | color: white; 98 | } 99 | 100 | .content { 101 | padding-top: 1.1rem; 102 | } 103 | 104 | .navbar-toggler { 105 | background-color: rgba(255, 255, 255, 0.1); 106 | } 107 | 108 | .valid.modified:not([type=checkbox]) { 109 | outline: 1px solid #26b050; 110 | } 111 | 112 | .invalid { 113 | outline: 1px solid red; 114 | } 115 | 116 | .validation-message { 117 | color: red; 118 | } 119 | 120 | #blazor-error-ui { 121 | background: lightyellow; 122 | bottom: 0; 123 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 124 | display: none; 125 | left: 0; 126 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 127 | position: fixed; 128 | width: 100%; 129 | z-index: 1000; 130 | } 131 | 132 | #blazor-error-ui .dismiss { 133 | cursor: pointer; 134 | position: absolute; 135 | right: 0.75rem; 136 | top: 0.5rem; 137 | } 138 | 139 | @media (max-width: 767.98px) { 140 | .main .top-row:not(.auth) { 141 | display: none; 142 | } 143 | 144 | .main .top-row.auth { 145 | justify-content: space-between; 146 | } 147 | 148 | .main .top-row a, .main .top-row .btn-link { 149 | margin-left: 0; 150 | } 151 | } 152 | 153 | @media (min-width: 768px) { 154 | #app { 155 | flex-direction: row; 156 | } 157 | 158 | .sidebar { 159 | width: 250px; 160 | height: 100vh; 161 | position: sticky; 162 | top: 0; 163 | } 164 | 165 | .main .top-row { 166 | position: sticky; 167 | top: 0; 168 | } 169 | 170 | .main > div { 171 | padding-left: 2rem !important; 172 | padding-right: 1.5rem !important; 173 | } 174 | 175 | .navbar-toggler { 176 | display: none; 177 | } 178 | 179 | .sidebar .collapse { 180 | /* Never collapse the sidebar for wide screens */ 181 | display: block; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /BookServer/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookServer/wwwroot/favicon.ico -------------------------------------------------------------------------------- /BookServer/wwwroot/js/geolocation.js: -------------------------------------------------------------------------------- 1 | window.blazorGeolocation = { 2 | toSerializeable: function (e) 3 | { 4 | return { 5 | "coords": { 6 | "latitude": e.coords.latitude, 7 | "longitude": e.coords.longitude 8 | }, "timestamp": new Date(e.timestamp) 9 | }; 10 | }, 11 | getCurrentPosition: function (geolocationRef, options) { 12 | function onSuccess(result) { 13 | return geolocationRef.invokeMethodAsync('RaiseOnGetPosition', blazorGeolocation.toSerializeable(result)); 14 | }; 15 | 16 | function onError(er) { 17 | return geolocationRef.invokeMethodAsync('RaiseOnGetPositionError', er.code); 18 | }; 19 | 20 | navigator.geolocation.getCurrentPosition(onSuccess, onError, options); 21 | }, 22 | 23 | hasGeolocaitonFeature: function () { 24 | return navigator.geolocation ? true : false; 25 | } 26 | }; 27 | 28 | 29 | 30 | //Position.coords.latitude 31 | //Position.coords.longitude 32 | 33 | //Position { 34 | // coords: { 35 | // latitude: 38.2099893, 36 | // longitude: -85.21792610000001, … 37 | // }, 38 | // timestamp: 1583430690849 39 | //} -------------------------------------------------------------------------------- /BookServer/wwwroot/js/themeChooser.js: -------------------------------------------------------------------------------- 1 | window.themeChooser = { 2 | setTheme: function (themeName) { 3 | 4 | // Build the new css link 5 | let newLink = document.createElement("link"); 6 | newLink.setAttribute("id", "theme"); 7 | newLink.setAttribute("rel", "stylesheet"); 8 | newLink.setAttribute("type", "text/css"); 9 | newLink.setAttribute("href", `css/${themeName}.css`); 10 | 11 | // Remove and replace the theme 12 | let head = document.getElementsByTagName("head")[0]; 13 | head.querySelector("#theme").remove(); 14 | head.appendChild(newLink); 15 | } 16 | } -------------------------------------------------------------------------------- /BookWasm/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /BookWasm/BookWasm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /BookWasm/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace BookWasm.Data 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateTime Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public string Summary { get; set; } = string.Empty; 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public bool Selected { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BookWasm/Geolocation/Geolocation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | using System; 3 | using System.Threading.Tasks; 4 | 5 | namespace BookWasm.Geolocation 6 | { 7 | public class Geolocation 8 | { 9 | private Action? OnGetPosition; 10 | private Action? OnGetPositionError; 11 | 12 | private readonly IJSRuntime js; 13 | public Geolocation(IJSRuntime js) 14 | { 15 | this.js = js; 16 | } 17 | 18 | public async ValueTask HasGeolocationFeature() => 19 | await js.InvokeAsync("blazorGeolocation.hasGeolocaitonFeature"); 20 | 21 | 22 | [JSInvokable] 23 | public void RaiseOnGetPosition(Position p) => OnGetPosition?.Invoke(p); 24 | 25 | [JSInvokable] 26 | public void RaiseOnGetPositionError(PositionError err) => OnGetPositionError?.Invoke(err); 27 | 28 | public async ValueTask GetCurrentPosition(Action onSuccess, Action onError, PositionOptions? options = null) 29 | { 30 | OnGetPosition = onSuccess; 31 | OnGetPositionError = onError; 32 | await js.InvokeVoidAsync("blazorGeolocation.getCurrentPosition", DotNetObjectReference.Create(this), options); 33 | } 34 | } 35 | 36 | public class PositionOptions 37 | { 38 | public bool EnableHighAccuracy { get; set; } = false; 39 | public int Timeout { get; set; } 40 | public int MaximumAge { get; set; } = 0; 41 | } 42 | 43 | public class Coords 44 | { 45 | public double Latitude { get; set; } 46 | public double Longitude { get; set; } 47 | } 48 | 49 | public class Position 50 | { 51 | public Coords? Coords { get; set; } 52 | public DateTime Timestamp { get; set; } 53 | } 54 | 55 | public enum PositionError 56 | { 57 | PERMISSION_DENIED = 1, 58 | POSITION_UNAVAILABLE, 59 | TIMEOUT 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BookWasm/Pages/ClassLibConsumer.razor: -------------------------------------------------------------------------------- 1 | @page "/classlib" 2 | @inject IJSRuntime js 3 | 4 |

ClassLib Consumer

5 | 6 |

Hello, @message!

7 | 8 | 9 | 10 | 11 | @code { 12 | string message = "world"; 13 | async Task ShowPrompt() 14 | { 15 | message = await ExampleJsInterop.Prompt(js, "Say hello:"); 16 | } 17 | } -------------------------------------------------------------------------------- /BookWasm/Pages/Converter.razor: -------------------------------------------------------------------------------- 1 | @page "/converter" 2 |

Converter

3 | 4 | 5 | 8 | = 9 | 12 | 13 | 14 | @code { 15 | double inches = 1; // default value 16 | public double Inches 17 | { 18 | get => inches; 19 | set 20 | { 21 | centimeters = value * 2.54; 22 | inches = value; 23 | } 24 | } 25 | 26 | double centimeters = 2.54; // default value 27 | public double Centimeters 28 | { 29 | get => centimeters; 30 | set 31 | { 32 | inches = value / 2.54; 33 | centimeters = value; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /BookWasm/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 | -------------------------------------------------------------------------------- /BookWasm/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 |

Weather forecast

4 | Weekly Forecast 5 |

This component demonstrates fetching data from the server.

6 | 7 | @if (forecasts == null) 8 | { 9 |

Loading...

10 | } 11 | else 12 | { 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach (var forecast in forecasts) 24 | { 25 | 26 | 27 | 28 | 29 | 30 | 31 | } 32 | 33 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
34 | } -------------------------------------------------------------------------------- /BookWasm/Pages/FetchData.razor.cs: -------------------------------------------------------------------------------- 1 | using BookWasm.Data; 2 | using Microsoft.AspNetCore.Components; 3 | using System.Net.Http.Json; 4 | 5 | namespace BookWasm.Pages 6 | { 7 | public partial class FetchData 8 | { 9 | [Inject] HttpClient Http { get; set; } = null!; 10 | 11 | private WeatherForecast[]? forecasts; 12 | 13 | protected override async Task OnInitializedAsync() 14 | { 15 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BookWasm/Pages/GeolocationExample.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime js 2 | @using Geolocation 3 | @page "/geo" 4 | 5 |

Hello, world!

6 | 7 | @if (hasGeoLocation) 8 | { 9 |

Browser has GeoLocation

10 | } 11 | 12 | @if (position != null) 13 | { 14 |

Current position: @position.Coords.Latitude Lat, @position.Coords.Longitude Long

15 |

Position reported at: @position.Timestamp

16 | } 17 | 18 | @switch (error) 19 | { 20 | case PositionError.PERMISSION_DENIED: 21 |

GeoLocation Permisson Denied

22 | break; 23 | case PositionError.POSITION_UNAVAILABLE: 24 |

GeoLocation Position Unavailable

25 | break; 26 | case PositionError.TIMEOUT: 27 |

GeoLocation Timeout

28 | break; 29 | default: 30 | break; 31 | } 32 | 33 | @code { 34 | Position position; 35 | PositionError error; 36 | bool hasGeoLocation; 37 | 38 | void OnSuccess(Position p) { 39 | position = p; 40 | StateHasChanged(); 41 | } 42 | 43 | void OnError(PositionError e) { 44 | error = e; 45 | StateHasChanged(); 46 | } 47 | 48 | protected override async Task OnAfterRenderAsync(bool firstRender) 49 | { 50 | if (firstRender) 51 | { 52 | var geo = new Geolocation(js); 53 | hasGeoLocation = await geo.HasGeolocationFeature(); 54 | StateHasChanged(); 55 | 56 | var options = new PositionOptions() { EnableHighAccuracy = false, Timeout = 200, MaximumAge = 0 }; 57 | await geo.GetCurrentPosition(OnSuccess, OnError, options); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /BookWasm/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | This repo contains examples from the 8 | Free Blazor Ebook 9 | 10 | 11 | -------------------------------------------------------------------------------- /BookWasm/Pages/RenderTreeExample.razor: -------------------------------------------------------------------------------- 1 | @page "/rendertreeexample" 2 |

RenderTree Example

3 |

See source code to toggle the key attribute.

4 | 5 |
    6 | @foreach (var item in items) 7 | { 8 | @* remove key attribute to see the effect on checkbox *@ 9 |
  • 10 |

    @item.Value

    11 | 12 |
  • 13 | } 14 |
15 | 16 | 17 | @code { 18 | // class Color {int Id, string Value} 19 | IEnumerable items = new Color[] { 20 | new Color {Id = 0, Value = "Green" }, 21 | new Color {Id = 1, Value = "Blue" }, 22 | new Color {Id = 2, Value = "Orange" }, 23 | new Color {Id = 3, Value = "Purple" } 24 | }; 25 | } 26 | 27 | @code { 28 | public class Color 29 | { 30 | public int Id { get; set; } 31 | public string Value { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BookWasm/Pages/WeeklyForecast.razor: -------------------------------------------------------------------------------- 1 | @page "/weeklyforecast" 2 | @inject HttpClient Http 3 | 4 |

WeeklyForecast

5 | 6 |
7 | @if (forecasts == null) 8 | { 9 | No Data 10 | } 11 | else 12 | { 13 | @foreach (var forecast in forecasts) 14 | { 15 | 20 | 21 | @if (forecast.Summary == "Rainy") 22 | { 23 |
24 | Tornado Warning! 25 |
26 | } 27 |
28 |
29 | } 30 | } 31 |
32 | 33 | @code { 34 | private WeatherForecast[] forecasts; 35 | 36 | protected override async Task OnInitializedAsync() 37 | { 38 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); 39 | } 40 | 41 | void HandleItemSelected(DayOfWeek selectedValue) 42 | { 43 | // Clear selections 44 | foreach (var item in forecasts) 45 | item.Selected = false; 46 | forecasts.First(f => f.Date.DayOfWeek == selectedValue).Selected = true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /BookWasm/Program.cs: -------------------------------------------------------------------------------- 1 | using BookWasm; 2 | using Microsoft.AspNetCore.Components.Web; 3 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 4 | 5 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 6 | builder.RootComponents.Add("#app"); 7 | builder.RootComponents.Add("head::after"); 8 | 9 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 10 | 11 | await builder.Build().RunAsync(); 12 | -------------------------------------------------------------------------------- /BookWasm/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:7189", 7 | "sslPort": 44309 8 | } 9 | }, 10 | "profiles": { 11 | "BookWasm": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 16 | "applicationUrl": "https://localhost:7028;http://localhost:5028", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BookWasm/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /BookWasm/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 51 |
52 | 53 | @code { 54 | private bool collapseNavMenu = true; 55 | 56 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 57 | 58 | private void ToggleNavMenu() 59 | { 60 | collapseNavMenu = !collapseNavMenu; 61 | } 62 | } -------------------------------------------------------------------------------- /BookWasm/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 | -------------------------------------------------------------------------------- /BookWasm/Shared/ThemeChooser.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime js 2 |
3 | Click here to switch themes 4 | 5 |
6 | 7 | @code { 8 | 9 | bool isDark; 10 | string SetThemeName => isDark ? "Dark" : "Light"; 11 | 12 | async Task SwapTheme() { 13 | isDark = !isDark; 14 | await js.InvokeVoidAsync("themeChooser.setTheme", SetThemeName); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BookWasm/Shared/WeatherDay.razor: -------------------------------------------------------------------------------- 1 | 
2 |
3 | 4 |

@TemperatureC C°

5 | @CustomMessage 6 |

7 | @Summary weather expected @DayOfWeek 8 |

9 |
10 |
11 | 12 | @code { 13 | 14 | string IconCssClass => 15 | Summary == "Cloudy" ? "cloud" : 16 | Summary == "Rainy" ? "rain" : 17 | "sun"; 18 | 19 | [Parameter] 20 | public string Summary { get; set; } 21 | 22 | [Parameter] 23 | public int TemperatureC { get; set; } 24 | 25 | [Parameter] 26 | public DayOfWeek DayOfWeek { get; set; } 27 | 28 | [Parameter] 29 | public RenderFragment CustomMessage { get; set; } 30 | 31 | [Parameter] 32 | public EventCallback OnSelected { get; set; } 33 | 34 | void HandleOnSelected() 35 | { 36 | OnSelected.InvokeAsync(this.DayOfWeek); 37 | } 38 | 39 | [Parameter] 40 | public bool Selected { get; set; } 41 | 42 | private string SelectedCss => Selected ? 43 | "bg-primary text-white" : "bg-light"; 44 | } -------------------------------------------------------------------------------- /BookWasm/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using BookWasm 10 | @using BookWasm.Shared 11 | @using BookWasm.Data 12 | @using RazorClassLibrary1 -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/dark.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-dark.css'); 2 | @import url('site.css'); -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/light.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-light.css'); 2 | @import url('site.css'); -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /BookWasm/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. -------------------------------------------------------------------------------- /BookWasm/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 | -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /BookWasm/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 | #app { 18 | position: relative; 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | 23 | .top-row { 24 | height: 3.5rem; 25 | display: flex; 26 | align-items: center; 27 | } 28 | 29 | .main { 30 | flex: 1; 31 | } 32 | 33 | .main .top-row { 34 | background-color: #f7f7f7; 35 | border-bottom: 1px solid #d6d5d5; 36 | justify-content: flex-end; 37 | } 38 | 39 | .main .top-row > a, .main .top-row .btn-link { 40 | white-space: nowrap; 41 | margin-left: 1.5rem; 42 | } 43 | 44 | .main .top-row a:first-child { 45 | overflow: hidden; 46 | text-overflow: ellipsis; 47 | } 48 | 49 | .sidebar { 50 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 51 | } 52 | 53 | .sidebar .top-row { 54 | background-color: rgba(0,0,0,0.4); 55 | } 56 | 57 | .sidebar .navbar-brand { 58 | font-size: 1.1rem; 59 | } 60 | 61 | .sidebar .oi { 62 | width: 2rem; 63 | font-size: 1.1rem; 64 | vertical-align: text-top; 65 | top: -2px; 66 | } 67 | 68 | .sidebar .nav-item { 69 | font-size: 0.9rem; 70 | padding-bottom: 0.5rem; 71 | } 72 | 73 | .sidebar .nav-item:first-of-type { 74 | padding-top: 1rem; 75 | } 76 | 77 | .sidebar .nav-item:last-of-type { 78 | padding-bottom: 1rem; 79 | } 80 | 81 | .sidebar .nav-item a { 82 | color: #d7d7d7; 83 | border-radius: 4px; 84 | height: 3rem; 85 | display: flex; 86 | align-items: center; 87 | line-height: 3rem; 88 | } 89 | 90 | .sidebar .nav-item a.active { 91 | background-color: rgba(255,255,255,0.25); 92 | color: white; 93 | } 94 | 95 | .sidebar .nav-item a:hover { 96 | background-color: rgba(255,255,255,0.1); 97 | color: white; 98 | } 99 | 100 | .content { 101 | padding-top: 1.1rem; 102 | } 103 | 104 | .navbar-toggler { 105 | background-color: rgba(255, 255, 255, 0.1); 106 | } 107 | 108 | .valid.modified:not([type=checkbox]) { 109 | outline: 1px solid #26b050; 110 | } 111 | 112 | .invalid { 113 | outline: 1px solid red; 114 | } 115 | 116 | .validation-message { 117 | color: red; 118 | } 119 | 120 | #blazor-error-ui { 121 | background: lightyellow; 122 | bottom: 0; 123 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 124 | display: none; 125 | left: 0; 126 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 127 | position: fixed; 128 | width: 100%; 129 | z-index: 1000; 130 | } 131 | 132 | #blazor-error-ui .dismiss { 133 | cursor: pointer; 134 | position: absolute; 135 | right: 0.75rem; 136 | top: 0.5rem; 137 | } 138 | 139 | @media (max-width: 767.98px) { 140 | .main .top-row:not(.auth) { 141 | display: none; 142 | } 143 | 144 | .main .top-row.auth { 145 | justify-content: space-between; 146 | } 147 | 148 | .main .top-row a, .main .top-row .btn-link { 149 | margin-left: 0; 150 | } 151 | } 152 | 153 | @media (min-width: 768px) { 154 | app { 155 | flex-direction: row; 156 | } 157 | 158 | .sidebar { 159 | width: 250px; 160 | height: 100vh; 161 | position: sticky; 162 | top: 0; 163 | } 164 | 165 | .main .top-row { 166 | position: sticky; 167 | top: 0; 168 | } 169 | 170 | .main > div { 171 | padding-left: 2rem !important; 172 | padding-right: 1.5rem !important; 173 | } 174 | 175 | .navbar-toggler { 176 | display: none; 177 | } 178 | 179 | .sidebar .collapse { 180 | /* Never collapse the sidebar for wide screens */ 181 | display: block; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /BookWasm/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/BookWasm/wwwroot/favicon.ico -------------------------------------------------------------------------------- /BookWasm/wwwroot/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | BookWasm 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
Loading...
18 | 19 |
20 | An unhandled error has occurred. 21 | Reload 22 | 🗙 23 |
24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BookWasm/wwwroot/js/geolocation.js: -------------------------------------------------------------------------------- 1 | window.blazorGeolocation = { 2 | toSerializeable: function (e) 3 | { 4 | return { 5 | "coords": { 6 | "latitude": e.coords.latitude, 7 | "longitude": e.coords.longitude 8 | }, "timestamp": new Date(e.timestamp) 9 | }; 10 | }, 11 | getCurrentPosition: function (geolocationRef, options) { 12 | function onSuccess(result) { 13 | return geolocationRef.invokeMethodAsync('RaiseOnGetPosition', blazorGeolocation.toSerializeable(result)); 14 | }; 15 | 16 | function onError(er) { 17 | return geolocationRef.invokeMethodAsync('RaiseOnGetPositionError', er.code); 18 | }; 19 | 20 | navigator.geolocation.getCurrentPosition(onSuccess, onError, options); 21 | }, 22 | 23 | hasGeolocaitonFeature: function () { 24 | return navigator.geolocation ? true : false; 25 | } 26 | }; 27 | 28 | 29 | 30 | //Position.coords.latitude 31 | //Position.coords.longitude 32 | 33 | //Position { 34 | // coords: { 35 | // latitude: 38.2099893, 36 | // longitude: -85.21792610000001, … 37 | // }, 38 | // timestamp: 1583430690849 39 | //} -------------------------------------------------------------------------------- /BookWasm/wwwroot/js/themeChooser.js: -------------------------------------------------------------------------------- 1 | window.themeChooser = { 2 | setTheme: function (themeName) { 3 | 4 | // Build the new css link 5 | let newLink = document.createElement("link"); 6 | newLink.setAttribute("id", "theme"); 7 | newLink.setAttribute("rel", "stylesheet"); 8 | newLink.setAttribute("type", "text/css"); 9 | newLink.setAttribute("href", `css/${themeName}.css`); 10 | 11 | // Remove and replace the theme 12 | let head = document.getElementsByTagName("head")[0]; 13 | head.querySelector("#theme").remove(); 14 | head.appendChild(newLink); 15 | } 16 | } -------------------------------------------------------------------------------- /BookWasm/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Rainy", 6 | "temperatureF": 33 7 | }, 8 | { 9 | "date": "2018-05-07", 10 | "temperatureC": 14, 11 | "summary": "Cloudy", 12 | "temperatureF": 57 13 | }, 14 | { 15 | "date": "2018-05-08", 16 | "temperatureC": -13, 17 | "summary": "Rainy", 18 | "temperatureF": 9 19 | }, 20 | { 21 | "date": "2018-05-09", 22 | "temperatureC": -16, 23 | "summary": "Sun", 24 | "temperatureF": 4 25 | }, 26 | { 27 | "date": "2018-05-10", 28 | "temperatureC": -2, 29 | "summary": "Chilly", 30 | "temperatureF": 29 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blazor Book Examples 2 | 3 | [This repo](https://github.com/EdCharbeneau/BlazorBookExamples) contains the examples from the Book [Blazor: A Beginner's Guide 4 | A quick start guide to productivity with Blazor](https://www.telerik.com/campaigns/blazor/wp-beginners-guide-ebook) 5 | 6 | [![Get the Free Blazor E-book](https://edcharbeneau.com/img/posts/1200x628_Facebook-Twitter-LinkedIn-Reddit.png)](https://www.telerik.com/campaigns/blazor/wp-beginners-guide-ebook) 7 | 8 | At the 2017 Microsoft MVP (Most Valuable Professional) Summit I watched Steve Sanderson unveil his experimental framework to a room full of .NET developers. I watched the room fill with excitement and give rounds of standing applause. The excitement validated my own opinion that this was something .NET developers like myself have always wanted for the web. I wrote this book to help the .NET community quickly grasp what Blazor has to offer and share in the excitement we all felt at the MVP Summit. 9 | 10 | Since that moment I have made many blog posts about the topic which have become outdated with each monthly release of Blazor. I have taken the best of those blog posts, reviewed, updated, and rewrote portions of them into the book along with **a wealth of brand-new material**. By compiling my best works into a single piece as an e-book, this single source of knowledge can be kept up to date with new releases. 11 | 12 | What you'll find in the Free Blazor e-book: 13 | 14 | - What is WebAssembly 15 | - Component Basics 16 | - Blazor Code Behind 17 | - Data Binding 18 | - JavaScript Interop 19 | - Razor Class Libraries 20 | - and much more... 21 | 22 | ## What are people saying? 23 | 24 | > "it has great design, ninjas and tons of code - if you are looking for compelling read, there is not nothing better I can recommend" -Jon Galloway (Microsoft, Program Manager) 25 | 26 | ## Quick Examples with Telerik REPL for Blazor 27 | 28 | - [Button Click](https://blazorrepl.telerik.com/GlFkPCly54uhbfhx35), binding button events. 29 | - [WeatherForecast](https://blazorrepl.telerik.com/ccudOFPD24TrVFCP19) using HttpClient, displayed in a table element. 30 | - [WeeklyForecast](https://blazorrepl.telerik.com/QmaHumvK448wvklt45) using foreach in Razor to display a list of cards. 31 | - [WeatherDay](https://blazorrepl.telerik.com/mcaxkQvU47G5SEz128), creating a component and repending it with foreach. 32 | - [Basic parameters](https://blazorrepl.telerik.com/QmuHEmvg50eQ6FDG11), using parameters and one-way binding. 33 | - [Working with data](https://blazorrepl.telerik.com/cmYdOQlB04ZVhS8P09), dynamically populate components based on a collection of data. 34 | - [Templates](https://blazorrepl.telerik.com/cwExYQbL11b3N2U218), using RenderFragment to create a template region. 35 | - [Event Handling](https://blazorrepl.telerik.com/wQunacFL31Ge1VrL18), using EventCallback to create interactive components. 36 | - [Two-way binding](https://blazorrepl.telerik.com/QmuxucbC142kbvwY09), using data binding to convert inches to centimeters. 37 | - [JavaScript Interop](https://blazorrepl.telerik.com/QcExaxPg30en4lpy24), using JavaScript to access Geolocation APIs. 38 | - [Telerik Grid](https://blazorrepl.telerik.com/GwadYdbU18aWeg5m42), using the Telerik UI for Blazor Grid to simplify development. 39 | 40 | ## Videos 41 | 42 | [![Book Examples Video 1](docs/YouTube.png)](https://youtu.be/4uH2Ahz6fIE) 43 | 44 | [![Book Examples Video 2](docs/YouTube.png)](https://youtu.be/0fuV9Zp0Wl0) 45 | 46 | ## How do I get it 47 | 48 | If you're interested in Blazor and would like to learn how to be productive in just a quick 120 page read, then get your free copy of the Blazor E-book from the link below. 49 | 50 | [Get the Free Blazor E-book](https://www.telerik.com/campaigns/blazor/wp-beginners-guide-ebook) 51 | -------------------------------------------------------------------------------- /RazorClassLibrary1/Component1.razor: -------------------------------------------------------------------------------- 1 | 
2 | This Blazor component is defined in the RazorClassLibrary1 package. 3 |
4 | -------------------------------------------------------------------------------- /RazorClassLibrary1/ExampleJsInterop.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | using System.Threading.Tasks; 3 | 4 | namespace RazorClassLibrary1 5 | { 6 | public class ExampleJsInterop 7 | { 8 | public static ValueTask Prompt(IJSRuntime jsRuntime, string message) 9 | { 10 | // Implemented in exampleJsInterop.js 11 | return jsRuntime.InvokeAsync( 12 | "exampleJsFunctions.showPrompt", 13 | message); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /RazorClassLibrary1/RazorClassLibrary1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /RazorClassLibrary1/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Components.Web 2 | -------------------------------------------------------------------------------- /RazorClassLibrary1/wwwroot/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/RazorClassLibrary1/wwwroot/background.png -------------------------------------------------------------------------------- /RazorClassLibrary1/wwwroot/exampleJsInterop.js: -------------------------------------------------------------------------------- 1 | // This file is to show how a library package may provide JavaScript interop features 2 | // wrapped in a .NET API 3 | 4 | window.exampleJsFunctions = { 5 | showPrompt: function (message) { 6 | return prompt(message, 'Type anything here'); 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /RazorClassLibrary1/wwwroot/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | This file is to show how CSS and other static resources (such as images) can be 3 | used from a library project/package. 4 | */ 5 | 6 | .my-component { 7 | border: 2px dashed red; 8 | padding: 1em; 9 | margin: 1em 0; 10 | background-image: url('background.png'); 11 | } 12 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Pages/Chart.razor: -------------------------------------------------------------------------------- 1 | @page "/chart" 2 | 3 | @using TelerikBlazorApp1.Shared 4 | @using TelerikBlazorApp1.Services 5 | @inject WeatherForecastService ForecastService 6 | 7 |
8 |
9 |
10 | @if (forecasts?.Count > 0) 11 | { 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | } 46 | else 47 | { 48 |
No data available.
49 | } 50 |
51 |
52 |

Telerik UI for Blazor Chart

53 |

The Telerik UI for Blazor Charts provide high quality graphical data visualization options.

54 | 55 |

56 | They include a variety of chart types and styles that have extensive configuration options. This 57 | flexibility allows you to quickly and easily create the exact chart you need to fit your specific 58 | requirements for functionality and appearance. 59 |

60 | 61 |

62 | This example uses the following features: 63 |

77 |

78 |
79 |
80 |
81 | 82 | @code{ 83 | List forecasts { get; set; } 84 | 85 | protected override async Task OnInitializedAsync() 86 | { 87 | DateTime currDate = DateTime.Now.Date; 88 | var allForecasts = await ForecastService.GetForecastListAsync(currDate); 89 | // use only dates within the last month as a reasonable range of data considering the BaseUnit 90 | forecasts = allForecasts.Where(f => currDate.Subtract(f.Date.Date) < new TimeSpan(30, 0, 0, 0) ).ToList(); 91 | } 92 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Pages/Form.razor: -------------------------------------------------------------------------------- 1 | @page "/form" 2 | 3 | @using TelerikBlazorApp1.Shared 4 | 5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 | User Details 16 | 17 |
18 | 21 | 22 |
23 |
24 | 27 | 28 |
29 |
30 | 33 | 36 | 37 |
38 |
39 | 42 | 43 |
44 |
45 | 46 |
47 | Team Preferences 48 |
49 | 52 | 53 |
54 |
55 | 58 | 61 |
62 |
63 | 64 | 65 | 66 | @if (ShowSuccessMessage) 67 | { 68 |
69 | Application form submitted Successfully, we will get back to you 70 |
71 | } 72 | 73 |
74 | Cancel 75 | Submit 76 |
77 |
78 |
79 |
80 |
81 |
82 | 83 |
84 |
85 |

Telerik UI for Blazor Form

86 |

Telerik UI for Blazor provides comprehensive support for building forms.

87 | 88 |

89 | For more information on implementing validation and labels, refer to the article 90 | on Input Validation support by Telerik UI for Blazor 91 | . 92 |

93 |
94 |
95 |
96 | 97 | @code{ 98 | Person person { get; set; } 99 | bool ShowSuccessMessage { get; set; } 100 | 101 | protected override Task OnInitializedAsync() 102 | { 103 | GetDefaultPerson(); 104 | 105 | return base.OnInitializedAsync(); 106 | } 107 | 108 | async void HandleValidSubmit() 109 | { 110 | // implement actual data storage here 111 | ShowSuccessMessage = true; 112 | await Task.Delay(2000); 113 | ShowSuccessMessage = false; 114 | GetDefaultPerson(); 115 | StateHasChanged(); 116 | } 117 | 118 | void CancelForm() 119 | { 120 | GetDefaultPerson(); 121 | } 122 | 123 | void GetDefaultPerson() 124 | { 125 | // in reality you may be pulling data from a service or authentication logic 126 | // not only for the form model, but also for the data sources below 127 | person = new Person() 128 | { 129 | StartDate = DateTime.Now.AddDays(7) 130 | }; 131 | } 132 | 133 | IEnumerable genders = new List 134 | { 135 | new DropDownModel {Text = "female", Id = 1}, 136 | new DropDownModel {Text = "male", Id = 2}, 137 | new DropDownModel {Text = "other", Id = 3}, 138 | new DropDownModel {Text = "I'd rather not say", Id = 4} 139 | }; 140 | 141 | List Teams = new List 142 | { 143 | "Blazor", "Python", "Ruby", "Java", "JavaScript", "Assembler" 144 | }; 145 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Pages/Grid.razor: -------------------------------------------------------------------------------- 1 | @page "/grid" 2 | 3 | @using TelerikBlazorApp1.Shared 4 | @using TelerikBlazorApp1.Services 5 | @inject WeatherForecastService ForecastService 6 | 7 |
8 |
9 |
10 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | Update 25 | Edit 26 | Delete 27 | Cancel 28 | 29 | 30 | 31 | Add Forecast 32 | 33 | 34 |
35 |
36 |

Telerik UI for Blazor Grid

37 |

38 | The Telerik UI for Blazor Data Grid includes a comprehensive set of ready-to-use 39 | features covering 40 | everything from paging, sorting, filtering, editing, and grouping to row virtualization and 41 | accessibility/keyboard support. 42 |

43 | 44 |

45 | This example demonstrates CRUD operations with data from a service. In a real application, you would 46 | probably replace the service with something suitable (for example, EF for a server-side app or HTTP endpoints 47 | for a WASM app). Depending on how you store the grid data, you may also need to update the view model data - 48 | read more about this in the code comments. 49 |

50 |
51 |
52 |
53 | 54 | @code { 55 | List forecasts { get; set; } 56 | 57 | protected override async Task OnInitializedAsync() 58 | { 59 | await GetForecasts(); 60 | } 61 | 62 | async Task GetForecasts() 63 | { 64 | forecasts = await ForecastService.GetForecastListAsync(DateTime.Now); 65 | } 66 | 67 | // Sample CUD operations below that call a service 68 | // they also update the local view data - this is required when the grid data is not tied 69 | // directly to an IQueriable that fetches from an EF context (possible only in server blazor) 70 | // this sample uses the item from the grid immediately, but in a real app 71 | // you may return an updated/inserted/deleted item data from the service and use that instead 72 | // or add code to fetch all the grid data anew (which might be a performance hit but for data that updates often may be helpful) 73 | 74 | public async Task DeleteHandler(GridCommandEventArgs args) 75 | { 76 | WeatherForecast currItem = args.Item as WeatherForecast; 77 | 78 | await ForecastService.DeleteForecastAsync(currItem); 79 | 80 | // update the view data 81 | forecasts.Remove(currItem); 82 | } 83 | 84 | public async Task CreateHandler(GridCommandEventArgs args) 85 | { 86 | WeatherForecast currItem = args.Item as WeatherForecast; 87 | 88 | await ForecastService.InsertForecastAsync(currItem); 89 | 90 | // update the view data 91 | currItem.Id = forecasts.Count + 1; 92 | forecasts.Insert(0, currItem); 93 | } 94 | 95 | public async Task UpdateHandler(GridCommandEventArgs args) 96 | { 97 | WeatherForecast currItem = args.Item as WeatherForecast; 98 | 99 | await ForecastService.UpdateForecastAsync(currItem); 100 | 101 | // update the view data 102 | var matchingItem = forecasts.FirstOrDefault(c => c.Id == currItem.Id); 103 | if (matchingItem != null) 104 | { 105 | matchingItem.Summary = currItem.Summary; 106 | matchingItem.TemperatureC = currItem.TemperatureC; 107 | matchingItem.Date = currItem.Date; 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | 20 | @if (!IsWindowVisible) 21 | { 22 |
23 |

24 | You closed the TelerikWindow component. There's so many good links in that window, 25 | if you would like to see it again click here 26 | Show Window 27 |

28 |
29 | } 30 | 31 | 32 |

About this template

33 |
34 | 35 |
36 |
37 |

Welcome

38 |

Welcome to your new Telerik UI for Blazor application.

39 |

Blazor gives you the ability to write rich web apps with C# rather than JavaScript. Telerik UI for Blazor components have been built from the ground-up to ensure you experience shorter development cycles, quick iterations and cut time to market.

40 | 41 |
42 |
43 |

Examples

44 |

45 | In this template you'll find a few examples to help you get familiar with your new components. 46 |

47 |
    48 |
  • Data Grid /Grid.razor
  • 49 |
  • Chart /Chart.razor
  • 50 |
  • Forms, inputs, validation /Form.razor
  • 51 |
  • Menu /shared/NavMenu.razor
  • 52 |
  • Window /Index.razor
  • 53 |
  • AnimationContainer /Index.razor
  • 54 |
  • Button /Index.razor
  • 55 |
56 | More Info 57 |
58 |
59 |

Useful Links

60 |

61 | Here are some resources to help you get started 62 |

63 | 80 |

Did you know that Telerik UI for Blazor can do:

81 | 98 |

99 | Wait there's more! Try our example apps: 100 |

101 | 109 |
110 |
111 |
112 | 113 | 114 | 115 |
116 | 117 |
118 | 119 |
120 |

121 | 122 | You can navigate your application with the TelerikMenu. Edit the menu in /shared/NavMenu.razor. 123 |

124 |
125 |
126 |
127 | 128 | @code { 129 | public bool IsWindowVisible { get; set; } = true; 130 | 131 | public TelerikAnimationContainer AnimationContainer { get; set; } 132 | 133 | public async void Show(MouseEventArgs args) 134 | { 135 | await AnimationContainer.ShowAsync(); 136 | 137 | await Task.Delay(6000); 138 | 139 | await AnimationContainer.HideAsync(); 140 | } 141 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using TelerikBlazorApp1.Services; 7 | 8 | namespace TelerikBlazorApp1.Client 9 | { 10 | public class Program 11 | { 12 | public static async Task Main(string[] args) 13 | { 14 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 15 | builder.RootComponents.Add("app"); 16 | 17 | builder.Services.AddTelerikBlazor(); 18 | builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 19 | builder.Services.AddScoped(); 20 | await builder.Build().RunAsync(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:62353/", 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 | "TelerikBlazorApp1.Client": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:62355/" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Services/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Threading.Tasks; 7 | using TelerikBlazorApp1.Shared; 8 | using Microsoft.AspNetCore.Components; 9 | using System.Net.Http.Json; 10 | 11 | namespace TelerikBlazorApp1.Services 12 | { 13 | public class WeatherForecastService 14 | { 15 | [Inject] 16 | private HttpClient Http { get; set; } 17 | 18 | public WeatherForecastService(HttpClient client) 19 | { 20 | Http = client; 21 | } 22 | 23 | public async Task> GetForecastListAsync(DateTime startDate) 24 | { 25 | var data = await Http.GetFromJsonAsync>("WeatherForecast?startDate=" + startDate.ToString(CultureInfo.InvariantCulture)); 26 | return data; 27 | } 28 | 29 | public async Task UpdateForecastAsync(WeatherForecast forecastToUpdate) 30 | { 31 | await Http.PostAsJsonAsync("WeatherForecast", forecastToUpdate); 32 | } 33 | 34 | public async Task DeleteForecastAsync(WeatherForecast forecastToRemove) 35 | { 36 | await Http.DeleteAsync("WeatherForecast?idToRemove=" + forecastToRemove.Id); 37 | } 38 | 39 | public async Task InsertForecastAsync(WeatherForecast forecastToInsert) 40 | { 41 | await Http.PutAsJsonAsync("WeatherForecast", forecastToInsert); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 4 |
5 |
6 | 7 |
8 | 9 |
10 | @Body 11 |
12 |
13 |
-------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | @using TelerikBlazorApp1.Shared 2 | 3 | 4 | 5 | @{ 6 | 11 | @item.Text 12 | 13 | } 14 | 15 | 16 | 17 | @code { 18 | List MenuItems { get; set; } 19 | 20 | MenuItem SelectedMenuItem { get; set; } 21 | 22 | bool IsInternalPage(string url) 23 | { 24 | if (string.IsNullOrEmpty(url)) return false; 25 | 26 | var protocols = new string[] { "//", "http://", "https://" }; 27 | return !protocols.Any(p => url.StartsWith(p.ToLower())); 28 | } 29 | 30 | protected override void OnInitialized() 31 | { 32 | MenuItems = new List() 33 | { 34 | new MenuItem() 35 | { 36 | Text = "Home", 37 | Url = "/", 38 | }, 39 | new MenuItem() 40 | { 41 | Text = "Grid", 42 | Url = "/grid" 43 | }, 44 | new MenuItem() 45 | { 46 | Text = "Chart", 47 | Url = "/chart" 48 | }, 49 | new MenuItem() 50 | { 51 | Text = "Form", 52 | Url = "/form" 53 | }, 54 | new MenuItem() 55 | { 56 | Text = "Telerik UI for Blazor", 57 | Url = "https://www.telerik.com/blazor-ui", 58 | Items = new List() 59 | { 60 | new MenuItem() 61 | { 62 | Text = "Documentation", 63 | Url = "https://docs.telerik.com/blazor-ui/introduction" 64 | }, 65 | new MenuItem() 66 | { 67 | Text = "Live Demos", 68 | Url = "https://demos.telerik.com/blazor-ui" 69 | } 70 | , 71 | new MenuItem() 72 | { 73 | Text = "Theme Builder", 74 | Url = "https://themebuilder.telerik.com" 75 | } 76 | } 77 | } 78 | }; 79 | } 80 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/Shared/ThemeChooser.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime js 2 |
3 | Click here to switch themes 4 | 5 |
6 | 7 | @code { 8 | 9 | bool isDark; 10 | string SetThemeName => isDark ? "Dark" : "Light"; 11 | 12 | async Task SwapTheme() 13 | { 14 | isDark = !isDark; 15 | await js.InvokeVoidAsync("themeChooser.setTheme", SetThemeName); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/TelerikBlazorApp1.Client.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.1 5 | 3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Components.Forms 3 | @using Microsoft.AspNetCore.Components.Routing 4 | @using Microsoft.AspNetCore.Components.Web 5 | @using Microsoft.JSInterop 6 | @using TelerikBlazorApp1.Client 7 | @using TelerikBlazorApp1.Client.Shared 8 | @using Telerik.Blazor 9 | @using Telerik.Blazor.Components 10 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/dark.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-dark.css'); 2 | @import url('material-dark.css'); 3 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 4 | 5 | html, body { 6 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 7 | background-color: #343a40; 8 | } 9 | 10 | .k-nav.k-link { 11 | padding: 6px 12px; 12 | line-height: 1.4285714286; 13 | } 14 | 15 | .k-nav.k-state-active { 16 | font-weight: bold; 17 | color: #00bcd4; 18 | } 19 | 20 | .k-menu-group .k-item > .k-menu-link { 21 | line-height: 1.4285714286; 22 | padding: 4px 8px; 23 | padding-right: 32px; 24 | display: -ms-flexbox; 25 | display: flex; 26 | -ms-flex-direction: row; 27 | flex-direction: row; 28 | -ms-flex-align: center; 29 | align-items: center; 30 | position: relative; 31 | } 32 | 33 | .k-textbox { 34 | color:white; 35 | } 36 | 37 | .k-nav.k-state-active { 38 | color: #00bcd4; 39 | } 40 | 41 | a, .btn-link { 42 | color: #00bcd4; 43 | } 44 | 45 | app { 46 | display: flex; 47 | flex-direction: column; 48 | } 49 | 50 | .top-row { 51 | min-height: 3.5rem; 52 | display: flex; 53 | align-items: center; 54 | } 55 | 56 | .main { 57 | flex: 1; 58 | } 59 | 60 | .main .top-row { 61 | border-bottom: 1px solid rgba(0, 0, 0, 0.2); 62 | justify-content: flex-end; 63 | } 64 | 65 | .main .top-row > a, .main .top-row .btn-link { 66 | white-space: nowrap; 67 | margin-left: 1.5rem; 68 | } 69 | 70 | .main .top-row a:first-child { 71 | overflow: hidden; 72 | text-overflow: ellipsis; 73 | } 74 | 75 | .content { 76 | padding-top: 1.1rem; 77 | } 78 | 79 | .valid.modified:not([type=checkbox]) { 80 | outline: 1px solid #26b050; 81 | } 82 | 83 | .invalid { 84 | outline: 1px solid red; 85 | } 86 | 87 | .validation-message { 88 | color: red; 89 | } 90 | 91 | #blazor-error-ui { 92 | background: lightyellow; 93 | bottom: 0; 94 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 95 | display: none; 96 | left: 0; 97 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 98 | position: fixed; 99 | width: 100%; 100 | z-index: 1000; 101 | } 102 | 103 | #blazor-error-ui .dismiss { 104 | cursor: pointer; 105 | position: absolute; 106 | right: 0.75rem; 107 | top: 0.5rem; 108 | } 109 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/light.css: -------------------------------------------------------------------------------- 1 | @import url('bootstrap/bootstrap-light.css'); 2 | @import url('material-light.css'); 3 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 4 | 5 | html, body { 6 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 7 | } 8 | 9 | .k-nav.k-link { 10 | padding: 6px 12px; 11 | line-height: 1.4285714286; 12 | } 13 | 14 | .k-nav.k-state-active { 15 | font-weight: bold; 16 | color: #656565; 17 | } 18 | 19 | .k-menu-group .k-item > .k-menu-link { 20 | line-height: 1.4285714286; 21 | padding: 4px 8px; 22 | padding-right: 32px; 23 | display: -ms-flexbox; 24 | display: flex; 25 | -ms-flex-direction: row; 26 | flex-direction: row; 27 | -ms-flex-align: center; 28 | align-items: center; 29 | position: relative; 30 | } 31 | 32 | a, .btn-link { 33 | color: #0366d6; 34 | } 35 | 36 | .btn-primary { 37 | color: #fff; 38 | background-color: #1b6ec2; 39 | border-color: #1861ac; 40 | } 41 | 42 | app { 43 | display: flex; 44 | flex-direction: column; 45 | } 46 | 47 | .top-row { 48 | min-height: 3.5rem; 49 | display: flex; 50 | align-items: center; 51 | } 52 | 53 | .main { 54 | flex: 1; 55 | } 56 | 57 | .main .top-row { 58 | background-color: #f8f9fa; 59 | border-bottom: 1px solid #d6d5d5; 60 | justify-content: flex-end; 61 | } 62 | 63 | .main .top-row > a, .main .top-row .btn-link { 64 | white-space: nowrap; 65 | margin-left: 1.5rem; 66 | } 67 | 68 | .main .top-row a:first-child { 69 | overflow: hidden; 70 | text-overflow: ellipsis; 71 | } 72 | 73 | .content { 74 | padding-top: 1.1rem; 75 | } 76 | 77 | .valid.modified:not([type=checkbox]) { 78 | outline: 1px solid #26b050; 79 | } 80 | 81 | .invalid { 82 | outline: 1px solid red; 83 | } 84 | 85 | .validation-message { 86 | color: red; 87 | } 88 | 89 | #blazor-error-ui { 90 | background: lightyellow; 91 | bottom: 0; 92 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 93 | display: none; 94 | left: 0; 95 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 96 | position: fixed; 97 | width: 100%; 98 | z-index: 1000; 99 | } 100 | 101 | #blazor-error-ui .dismiss { 102 | cursor: pointer; 103 | position: absolute; 104 | right: 0.75rem; 105 | top: 0.5rem; 106 | } 107 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/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. -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/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 | 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 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/Telerik/TelerikBlazorApp1/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/Telerik/TelerikBlazorApp1/Client/wwwroot/favicon.ico -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | BlankClientAspNetHostedBlazorApp 7 | 8 | 9 | 10 | 11 | 12 | 13 | Loading... 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Client/wwwroot/themeChooser.js: -------------------------------------------------------------------------------- 1 | window.themeChooser = { 2 | setTheme: function (themeName) { 3 | 4 | // Build the new css link 5 | let newLink = document.createElement("link"); 6 | newLink.setAttribute("id", "theme"); 7 | newLink.setAttribute("rel", "stylesheet"); 8 | newLink.setAttribute("type", "text/css"); 9 | newLink.setAttribute("href", `css/${themeName}.css`); 10 | 11 | // Remove and replace the theme 12 | let head = document.getElementsByTagName("head")[0]; 13 | head.querySelector("#theme").remove(); 14 | head.appendChild(newLink); 15 | } 16 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using TelerikBlazorApp1.Shared; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace TelerikBlazorApp1.Server.Controllers 10 | { 11 | [ApiController] 12 | [Route("[controller]")] 13 | public class WeatherForecastController : ControllerBase 14 | { 15 | private static readonly string[] Summaries = new[] 16 | { 17 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 18 | }; 19 | 20 | private readonly ILogger logger; 21 | 22 | public WeatherForecastController(ILogger logger) 23 | { 24 | this.logger = logger; 25 | } 26 | 27 | // this static list acts as our "database" in this sample 28 | private static List _forecasts { get; set; } 29 | 30 | [HttpGet] 31 | public Task> Get([FromQuery]DateTime startDate) 32 | { 33 | if (_forecasts == null) 34 | { 35 | var rng = new Random(); 36 | _forecasts = Enumerable.Range(1, 150).Select(index => new WeatherForecast 37 | { 38 | Id = index, 39 | Date = startDate.AddDays(index), 40 | TemperatureC = rng.Next(-20, 55), 41 | Summary = Summaries[rng.Next(Summaries.Length)] 42 | }).ToList(); 43 | } 44 | 45 | return Task.FromResult(_forecasts); 46 | } 47 | 48 | [HttpPost] 49 | public async Task Update(WeatherForecast forecastToUpdate) 50 | { 51 | //implement proper error handling here, and then actual data source operations 52 | if (_forecasts == null) 53 | { 54 | return; 55 | } 56 | 57 | var index = _forecasts.FindIndex(i => i.Id == forecastToUpdate.Id); 58 | if (index != -1) 59 | { 60 | _forecasts[index] = forecastToUpdate; 61 | } 62 | } 63 | 64 | [HttpDelete] 65 | public async Task Delete(int idToRemove) 66 | { 67 | //implement proper error handling here, and then actual data source operations 68 | if (_forecasts == null) 69 | { 70 | return; 71 | } 72 | 73 | WeatherForecast forecastToDelete = _forecasts.Where(f => f.Id == idToRemove).First(); 74 | if (forecastToDelete != null) 75 | { 76 | _forecasts.Remove(forecastToDelete); 77 | } 78 | } 79 | 80 | [HttpPut] 81 | public async Task Put(WeatherForecast forecastToInsert) 82 | { 83 | //implement proper error handling here, and then actual data source operations 84 | if (_forecasts == null) 85 | { 86 | return; 87 | } 88 | 89 | WeatherForecast insertedForecast = new WeatherForecast() 90 | { 91 | Id = _forecasts.Count + 1, 92 | Date = forecastToInsert.Date, 93 | TemperatureC = forecastToInsert.TemperatureC, 94 | Summary = forecastToInsert.Summary 95 | }; 96 | 97 | _forecasts.Insert(0, insertedForecast); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model BlazorApp1.Server.Pages.ErrorModel 3 | @{ 4 | Layout = "_Layout"; 5 | ViewData["Title"] = "Error"; 6 | } 7 | 8 |

Error.

9 |

An error occurred while processing your request.

10 | 11 | @if (Model.ShowRequestId) 12 | { 13 |

14 | Request ID: @Model.RequestId 15 |

16 | } 17 | 18 |

Development Mode

19 |

20 | Swapping to the Development environment displays detailed information about the error that occurred. 21 |

22 |

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

28 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/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 BlazorApp1.Server.Pages 11 | { 12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 13 | public class ErrorModel : PageModel 14 | { 15 | public string RequestId { get; set; } 16 | 17 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 18 | 19 | private readonly ILogger _logger; 20 | 21 | public ErrorModel(ILogger logger) 22 | { 23 | _logger = logger; 24 | } 25 | 26 | public void OnGet() 27 | { 28 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | BlankClientAspNetHostedBlazorApp 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | @RenderBody() 17 |
18 |
19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.Hosting; 5 | 6 | namespace TelerikBlazorApp1.Server 7 | { 8 | public class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | CreateHostBuilder(args).Build().Run(); 13 | } 14 | 15 | public static IHostBuilder CreateHostBuilder(string[] args) => 16 | Host.CreateDefaultBuilder(args) 17 | .ConfigureWebHostDefaults(webBuilder => 18 | { 19 | webBuilder.UseStartup(); 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:62352/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | }, 17 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" 18 | }, 19 | "ClientApp.Server": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | }, 25 | "applicationUrl": "http://localhost:62353/", 26 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace TelerikBlazorApp1.Server 8 | { 9 | public class Startup 10 | { 11 | public Startup(IConfiguration configuration) 12 | { 13 | Configuration = configuration; 14 | } 15 | 16 | public IConfiguration Configuration { get; } 17 | // This method gets called by the runtime. Use this method to add services to the container. 18 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 19 | public void ConfigureServices(IServiceCollection services) 20 | { 21 | services.AddControllersWithViews(); 22 | services.AddRazorPages(); 23 | } 24 | 25 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 26 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 27 | { 28 | if (env.IsDevelopment()) 29 | { 30 | app.UseDeveloperExceptionPage(); 31 | app.UseWebAssemblyDebugging(); 32 | } 33 | else 34 | { 35 | app.UseExceptionHandler("/Error"); 36 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 37 | app.UseHsts(); 38 | } 39 | 40 | app.UseHttpsRedirection(); 41 | app.UseBlazorFrameworkFiles(); 42 | app.UseStaticFiles(); 43 | 44 | app.UseRouting(); 45 | 46 | app.UseEndpoints(endpoints => 47 | { 48 | endpoints.MapRazorPages(); 49 | endpoints.MapControllers(); 50 | endpoints.MapFallbackToFile("index.html"); 51 | }); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Server/TelerikBlazorApp1.Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Shared/DropDownModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace TelerikBlazorApp1.Shared 7 | { 8 | public class DropDownModel 9 | { 10 | public int? Id { get; set; } 11 | public string Text { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Shared/MenuItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace TelerikBlazorApp1.Shared 6 | { 7 | public class MenuItem 8 | { 9 | public string Text { get; set; } 10 | public string Url { get; set; } 11 | public List Items { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Shared/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace TelerikBlazorApp1.Shared 8 | { 9 | public class Person 10 | { 11 | [Required(ErrorMessage = "Enter your first name")] 12 | [StringLength(10, ErrorMessage = "That name is too long")] 13 | public string FirstName { get; set; } 14 | 15 | [Required(ErrorMessage = "Enter your last name")] 16 | [StringLength(15, ErrorMessage = "That name is too long")] 17 | public string LastName { get; set; } 18 | 19 | [Required(ErrorMessage = "An email is required")] 20 | [EmailAddress(ErrorMessage = "Please provide a valid email address.")] 21 | public string Email { get; set; } 22 | 23 | public int? Gender { get; set; } 24 | 25 | 26 | [Required] 27 | [Range(typeof(DateTime), "1/1/2020", "1/12/2030", 28 | ErrorMessage = "Value for {0} must be between {1:dd MMM yyyy} and {2:dd MMM yyyy}")] 29 | public DateTime StartDate { get; set; } 30 | 31 | [Required(ErrorMessage = "Choose the team and technology you want to work on")] 32 | public string PreferredTeam { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Shared/TelerikBlazorApp1.Shared.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/Shared/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace TelerikBlazorApp1.Shared 6 | { 7 | public class WeatherForecast 8 | { 9 | public int Id { get; set; } 10 | 11 | public DateTime Date { get; set; } 12 | 13 | public int TemperatureC { get; set; } 14 | 15 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 16 | 17 | public string Summary { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Telerik/TelerikBlazorApp1/TelerikBlazorApp1.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30001.183 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelerikBlazorApp1.Server", "Server\TelerikBlazorApp1.Server.csproj", "{F0B6034B-81D0-422E-B547-0FF780C130A0}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelerikBlazorApp1.Shared", "Shared\TelerikBlazorApp1.Shared.csproj", "{1758B0A1-60BC-4F84-BDCA-C66844B23E1D}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelerikBlazorApp1.Client", "Client\TelerikBlazorApp1.Client.csproj", "{DE3E0FF0-DDCF-4A0A-A3A9-582652A27996}" 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 | {F0B6034B-81D0-422E-B547-0FF780C130A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {F0B6034B-81D0-422E-B547-0FF780C130A0}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {F0B6034B-81D0-422E-B547-0FF780C130A0}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {F0B6034B-81D0-422E-B547-0FF780C130A0}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {1758B0A1-60BC-4F84-BDCA-C66844B23E1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {1758B0A1-60BC-4F84-BDCA-C66844B23E1D}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {1758B0A1-60BC-4F84-BDCA-C66844B23E1D}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {1758B0A1-60BC-4F84-BDCA-C66844B23E1D}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {DE3E0FF0-DDCF-4A0A-A3A9-582652A27996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {DE3E0FF0-DDCF-4A0A-A3A9-582652A27996}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {DE3E0FF0-DDCF-4A0A-A3A9-582652A27996}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {DE3E0FF0-DDCF-4A0A-A3A9-582652A27996}.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 = {0346BA14-5112-4A04-864D-96B3880A4C0C} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-tactile -------------------------------------------------------------------------------- /docs/YouTube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdCharbeneau/BlazorBookExamples/7b8c9dca9a1b535f9f55f53b2b4664e4423d295a/docs/YouTube.png --------------------------------------------------------------------------------