├── .DS_Store ├── .gitignore ├── Assets ├── Blazor Utitlies.png ├── MessagingCenter Sample.gif └── MessagingCenter.png ├── LICENSE ├── README.md └── src ├── .DS_Store ├── AKSoftware.Blazor.Utilities.sln ├── AKSoftware.Blazor.Utilities ├── AKSoftware.Blazor.Utilities.csproj ├── Blazor Utitlies.png ├── LICENSE ├── MessagingCenter.cs └── _Imports.razor ├── BlazorUtilitiesSample ├── App.razor ├── BlazorUtilitiesSample.csproj ├── Pages │ ├── Counter.razor │ ├── FetchData.razor │ ├── Index.razor │ ├── MyAccount.razor │ └── MyAccount.razor.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── Shared │ ├── MainLayout.razor │ ├── MainLayout.razor.css │ ├── NavMenu.razor │ ├── NavMenu.razor.css │ └── SurveyPrompt.razor ├── UserSettings.cs ├── _Imports.razor └── wwwroot │ ├── css │ ├── app.css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ └── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ ├── css │ │ └── open-iconic-bootstrap.min.css │ │ └── fonts │ │ ├── open-iconic.eot │ │ ├── open-iconic.otf │ │ ├── open-iconic.svg │ │ ├── open-iconic.ttf │ │ └── open-iconic.woff │ ├── favicon.ico │ ├── index.html │ └── sample-data │ └── weather.json └── ShoppingCartSample ├── App.razor ├── Components ├── ProductsList.razor ├── ProductsList.razor.cs ├── ProductsList.razor.css ├── ShoppingCart.razor ├── ShoppingCart.razor.cs └── ShoppingCart.razor.css ├── Models ├── CartItem.cs ├── Item.cs └── ShoppingCartItem.cs ├── Pages ├── Counter.razor ├── FetchData.razor └── Index.razor ├── Program.cs ├── Properties └── launchSettings.json ├── Services ├── IItemsService.cs └── ItemsService.cs ├── Shared ├── MainLayout.razor ├── MainLayout.razor.cs ├── MainLayout.razor.css ├── NavMenu.razor ├── NavMenu.razor.css └── SurveyPrompt.razor ├── ShoppingCartSample.csproj ├── _Imports.razor └── wwwroot ├── Images ├── duo-2.webp ├── duo.webp ├── go.webp ├── laptop-4.webp ├── laptop-studio.webp ├── pro-8.webp ├── pro-x.webp └── studio.webp ├── css ├── app.css ├── bootstrap │ ├── bootstrap.min.css │ └── bootstrap.min.css.map └── open-iconic │ ├── FONT-LICENSE │ ├── ICON-LICENSE │ ├── README.md │ └── font │ ├── css │ └── open-iconic-bootstrap.min.css │ └── fonts │ ├── open-iconic.eot │ ├── open-iconic.otf │ ├── open-iconic.svg │ ├── open-iconic.ttf │ └── open-iconic.woff ├── favicon.ico ├── index.html └── sample-data └── weather.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/.DS_Store -------------------------------------------------------------------------------- /.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 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /Assets/Blazor Utitlies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/Assets/Blazor Utitlies.png -------------------------------------------------------------------------------- /Assets/MessagingCenter Sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/Assets/MessagingCenter Sample.gif -------------------------------------------------------------------------------- /Assets/MessagingCenter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/Assets/MessagingCenter.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ahmad Mozaffar 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to Messaging Center Blazor Utitlity! 2 | 3 | 4 | drawing 5 | 6 | ### AKSoftware.Blazor.Utilities 7 | 8 | #### ⚡ ⚡ 🚀 Send data across your components fluently with the Messaging Center ⚡ ⚡ 🚀 9 | Paramters, Cascading Parameters and Event Callbacks are ways to send data across components but MessagingCenter is much easier and straightforward 10 | ![MessagingCenter](https://github.com/aksoftware98/blazor-utilities/blob/main/Assets/MessagingCenter%20Sample.gif?raw=true) 11 | 12 | 13 | If you are a Xamarin.Forms developer, you definitely passed across the MessagingCenter class that was being used to send messages across objects, this class helps a lot by pushing data across components in the system effiecently. 14 | And now for Blazor Messaging Center is a great tool to use to solve the issue of sending the data across components and updating them. 15 | Using MessagingCenter you will be able to send data from one component to another or to a set of other components just with one line of code despite the relationship between those components (Parent - Child .etc...) 16 | The following illustration shows the benefits of using MessagingCenter to send data between the components. 17 | 18 | ### Messaging Center Quick Explanation: 19 | ![enter image description here](https://github.com/aksoftware98/blazor-utilities/blob/main/Assets/MessagingCenter.png?raw=true) 20 | ## Package Content: 21 | For now package the **AKSoftware.Blazor.Utilities** just contains the ***MessagingCenter*** service which is the same that is implemented in Xamarin.Forms to be used in Blazor projects as a service to send the data across the components using the Publish - Subscription pattern in addition to the existing model of Parameters & Event Callbacks. 22 | 23 | > **Note:** The messaging center class with the current package is the same class and cloned from the Xamarin.Forms repository from the following link [Xamarin.Forms](https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Core/MessagingCenter.cs) 24 | 25 | ## Check out the sample project: 26 | In the current repository you can find a sample project to use the MessagingCenter service in Blazor that shows how to send a string value from one component to two other components without a direct relationship between them and update their states. 27 | The example shows using updating the username in a form component then using MessagingCenter we can send that update to the NavMenu component and the MainLayout and update the value there. 28 | Check out the following folder: 29 | 30 | ## 🌎 👷 Get Started with Blazor MessagingCenter ⛳ 31 | Make sure to instal the NuGet package of the library using the ***NuGet command*** 32 | ``` 33 | Install-Package AKSoftware.Blazor.Utilities 34 | ``` 35 | 36 | Or through the ***.NET CLI*** 37 | ``` 38 | dotnet package install AKSoftware.Blazor.Utilities 39 | ``` 40 | 41 | Now in the **_imports.razor** and add the following namesapce 42 | ``` Razor 43 | @using AKSoftware.Blazor.Utilities 44 | ``` 45 | 46 | ## ⚡ 🚀 Publish a message 🚀 ⚡ 47 | From the component that you want to send data from example a sample string like the example in the repository 48 | 49 | > The code takes a the sender object as a parameter, the filter of the message like for this example "greeting_message" which will be used by other components to receive the message, and the last parameter is the value to be sent 50 | 51 | ``` C# 52 | public void SendMessage() 53 | { 54 | string valueToSend = "Hi from Component 1"; 55 | MessagingCenter.Send(this, "greeting_message", valueToSend); 56 | } 57 | ``` 58 | 59 | ## ✈️ Receive a message from destination component ✈️ 60 | 61 | In the destination component all you can do is calling the subscribe method to subscribe for a target of messaging 62 | 63 | Blazor WebAssembly 64 | 65 | ``` C# 66 | public void SubscribeToMessage() 67 | { 68 | MessagingCenter.Subscribe(this, "greeting_message", (sender, value) => 69 | { 70 | // Do actions against the value 71 | // If the value is updating the component make sure to call 72 | string greeting = $"Welcome {value}"; 73 | StateHasChanged(); // To update the state of the component 74 | }); 75 | } 76 | ``` 77 | 78 | ## 🚧⚠️ Blazor Server Notice 🚧⚠️ 79 | 80 | Becuase Blazor Server working on thread make sure to call that InvokeAsync within the callback 81 | **Note:** This will be resolved and updated in the version 1.0.1 82 | Special thanks for **[Ferenc Czirok](https://github.com/czirok)** for mentioning the note and the following code snippet 83 | 84 | ``` C# 85 | public void SubscribeToMessage() 86 | { 87 | MessagingCenter.Subscribe(this, "greeting_message", async (sender, value) => 88 | { 89 | // Do actions against the value 90 | // If the value is updating the component make sure to call 91 | // Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state 92 | await InvokeAsync(() => { 93 | string greeting = $"Welcome {value}"; 94 | StateHasChanged(); // To update the state of the component 95 | }); 96 | }); 97 | } 98 | ``` 99 | 100 | ### Enjoy it 🎢 101 | 102 | ## 🚧 How to contribute 103 | Contributions are welcomed to the current repository you can get started by 104 | 105 | - Cloning the project 106 | - Add your own features 107 | - Submit a PR 108 | - You can find me here https://ahmadmozaffar.net 109 | 110 | ## ⚠️ You have problems??? 111 | Feel free to open any issue directly from the issues section here [GitHub Issues](https://github.com/aksoftware98/blazor-utilities/issues) 112 | 113 | 114 | #### Developed with all ❤️ by 💻 [Ahmad Mozaffar](https://ahmadmozaffar.net) 115 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/.DS_Store -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31710.8 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AKSoftware.Blazor.Utilities", "AKSoftware.Blazor.Utilities\AKSoftware.Blazor.Utilities.csproj", "{710AC5DE-E9AF-489E-A5DB-1E0BCB5BA296}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorUtilitiesSample", "BlazorUtilitiesSample\BlazorUtilitiesSample.csproj", "{B6911471-D8E8-4661-A48F-D52160FA283A}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShoppingCartSample", "ShoppingCartSample\ShoppingCartSample.csproj", "{3F4900EC-A3F1-4AC2-A886-94FBB342D63A}" 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 | {710AC5DE-E9AF-489E-A5DB-1E0BCB5BA296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {710AC5DE-E9AF-489E-A5DB-1E0BCB5BA296}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {710AC5DE-E9AF-489E-A5DB-1E0BCB5BA296}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {710AC5DE-E9AF-489E-A5DB-1E0BCB5BA296}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {B6911471-D8E8-4661-A48F-D52160FA283A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {B6911471-D8E8-4661-A48F-D52160FA283A}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {B6911471-D8E8-4661-A48F-D52160FA283A}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {B6911471-D8E8-4661-A48F-D52160FA283A}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {3F4900EC-A3F1-4AC2-A886-94FBB342D63A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {3F4900EC-A3F1-4AC2-A886-94FBB342D63A}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {3F4900EC-A3F1-4AC2-A886-94FBB342D63A}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {3F4900EC-A3F1-4AC2-A886-94FBB342D63A}.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 = {0F92AE52-0868-4AD8-BFDA-54ED97C29B5B} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities/AKSoftware.Blazor.Utilities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | AKSoftware.Blazor.Utilities is a helper package that contains for now a MessagingCenter class that allows developers to write components and send data across them instantly if a super effice way. 6 | MessaingCenter idea for Blazor was inspired from Xamarin.Forms's MessagingCenter 7 | false 8 | 1.1 9 | Ahmad Mozaffar 10 | Ahmad Mozaffar 2024 11 | https://github.com/aksoftware98/blazor-utlities 12 | Upgrade the package to .NET 8.0 13 | aksoftware, blazor, messagingcenter, messagin, xamarin.forms 14 | AKSoftware.Blazor.Utilities 15 | Blazor Utitlies.png 16 | https://github.com/aksoftware98/blazor-utilities 17 | git 18 | True 19 | LICENSE 20 | True 21 | 22 | 23 | 24 | 25 | 4 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | True 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities/Blazor Utitlies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/AKSoftware.Blazor.Utilities/Blazor Utitlies.png -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ahmad Mozaffar 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities/MessagingCenter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AKSoftware.Blazor.Utilities 9 | { 10 | public interface IMessagingCenter 11 | { 12 | void Send(TSender sender, string message, TArgs args) where TSender : class; 13 | 14 | void Send(TSender sender, string message) where TSender : class; 15 | 16 | void Subscribe(object subscriber, string message, Action callback, TSender source = null) where TSender : class; 17 | 18 | void Subscribe(object subscriber, string message, Action callback, TSender source = null) where TSender : class; 19 | 20 | void Unsubscribe(object subscriber, string message) where TSender : class; 21 | 22 | void Unsubscribe(object subscriber, string message) where TSender : class; 23 | } 24 | 25 | public class MessagingCenter : IMessagingCenter 26 | { 27 | public static IMessagingCenter Instance { get; } = new MessagingCenter(); 28 | 29 | class Sender : Tuple 30 | { 31 | public Sender(string message, Type senderType, Type argType) : base(message, senderType, argType) 32 | { 33 | } 34 | } 35 | 36 | delegate bool Filter(object sender); 37 | 38 | class MaybeWeakReference 39 | { 40 | WeakReference DelegateWeakReference { get; } 41 | object DelegateStrongReference { get; } 42 | 43 | readonly bool _isStrongReference; 44 | 45 | public MaybeWeakReference(object subscriber, object delegateSource) 46 | { 47 | if (subscriber.Equals(delegateSource)) 48 | { 49 | // The target is the subscriber; we can use a weakreference 50 | DelegateWeakReference = new WeakReference(delegateSource); 51 | _isStrongReference = false; 52 | } 53 | else 54 | { 55 | DelegateStrongReference = delegateSource; 56 | _isStrongReference = true; 57 | } 58 | } 59 | 60 | public object Target => _isStrongReference ? DelegateStrongReference : DelegateWeakReference.Target; 61 | public bool IsAlive => _isStrongReference || DelegateWeakReference.IsAlive; 62 | } 63 | 64 | class Subscription : Tuple 65 | { 66 | public Subscription(object subscriber, object delegateSource, MethodInfo methodInfo, Filter filter) 67 | : base(new WeakReference(subscriber), new MaybeWeakReference(subscriber, delegateSource), methodInfo, filter) 68 | { 69 | } 70 | 71 | public WeakReference Subscriber => Item1; 72 | MaybeWeakReference DelegateSource => Item2; 73 | MethodInfo MethodInfo => Item3; 74 | Filter Filter => Item4; 75 | 76 | public void InvokeCallback(object sender, object args) 77 | { 78 | if (!Filter(sender)) 79 | { 80 | return; 81 | } 82 | 83 | if (MethodInfo.IsStatic) 84 | { 85 | MethodInfo.Invoke(null, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args }); 86 | return; 87 | } 88 | 89 | var target = DelegateSource.Target; 90 | 91 | if (target == null) 92 | { 93 | return; // Collected 94 | } 95 | 96 | MethodInfo.Invoke(target, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args }); 97 | } 98 | 99 | public bool CanBeRemoved() 100 | { 101 | return !Subscriber.IsAlive || !DelegateSource.IsAlive; 102 | } 103 | } 104 | 105 | readonly Dictionary> _subscriptions = 106 | new Dictionary>(); 107 | 108 | public static void Send(TSender sender, string message, TArgs args) where TSender : class 109 | { 110 | Instance.Send(sender, message, args); 111 | } 112 | 113 | void IMessagingCenter.Send(TSender sender, string message, TArgs args) 114 | { 115 | if (sender == null) 116 | throw new ArgumentNullException(nameof(sender)); 117 | InnerSend(message, typeof(TSender), typeof(TArgs), sender, args); 118 | } 119 | 120 | public static void Send(TSender sender, string message) where TSender : class 121 | { 122 | Instance.Send(sender, message); 123 | } 124 | 125 | void IMessagingCenter.Send(TSender sender, string message) 126 | { 127 | if (sender == null) 128 | throw new ArgumentNullException(nameof(sender)); 129 | InnerSend(message, typeof(TSender), null, sender, null); 130 | } 131 | 132 | public static void Subscribe(object subscriber, string message, Action callback, TSender source = null) where TSender : class 133 | { 134 | Instance.Subscribe(subscriber, message, callback, source); 135 | } 136 | 137 | void IMessagingCenter.Subscribe(object subscriber, string message, Action callback, TSender source) 138 | { 139 | if (subscriber == null) 140 | throw new ArgumentNullException(nameof(subscriber)); 141 | if (callback == null) 142 | throw new ArgumentNullException(nameof(callback)); 143 | 144 | var target = callback.Target; 145 | 146 | Filter filter = sender => 147 | { 148 | var send = (TSender)sender; 149 | return (source == null || send == source); 150 | }; 151 | 152 | InnerSubscribe(subscriber, message, typeof(TSender), typeof(TArgs), target, callback.GetMethodInfo(), filter); 153 | } 154 | 155 | public static void Subscribe(object subscriber, string message, Action callback, TSender source = null) where TSender : class 156 | { 157 | Instance.Subscribe(subscriber, message, callback, source); 158 | } 159 | 160 | void IMessagingCenter.Subscribe(object subscriber, string message, Action callback, TSender source) 161 | { 162 | if (subscriber == null) 163 | throw new ArgumentNullException(nameof(subscriber)); 164 | if (callback == null) 165 | throw new ArgumentNullException(nameof(callback)); 166 | 167 | var target = callback.Target; 168 | 169 | Filter filter = sender => 170 | { 171 | var send = (TSender)sender; 172 | return (source == null || send == source); 173 | }; 174 | 175 | InnerSubscribe(subscriber, message, typeof(TSender), null, target, callback.GetMethodInfo(), filter); 176 | } 177 | 178 | public static void Unsubscribe(object subscriber, string message) where TSender : class 179 | { 180 | Instance.Unsubscribe(subscriber, message); 181 | } 182 | 183 | void IMessagingCenter.Unsubscribe(object subscriber, string message) 184 | { 185 | InnerUnsubscribe(message, typeof(TSender), typeof(TArgs), subscriber); 186 | } 187 | 188 | public static void Unsubscribe(object subscriber, string message) where TSender : class 189 | { 190 | Instance.Unsubscribe(subscriber, message); 191 | } 192 | 193 | void IMessagingCenter.Unsubscribe(object subscriber, string message) 194 | { 195 | InnerUnsubscribe(message, typeof(TSender), null, subscriber); 196 | } 197 | 198 | void InnerSend(string message, Type senderType, Type argType, object sender, object args) 199 | { 200 | if (message == null) 201 | throw new ArgumentNullException(nameof(message)); 202 | var key = new Sender(message, senderType, argType); 203 | if (!_subscriptions.ContainsKey(key)) 204 | return; 205 | List subcriptions = _subscriptions[key]; 206 | if (subcriptions == null || !subcriptions.Any()) 207 | return; // should not be reachable 208 | 209 | // ok so this code looks a bit funky but here is the gist of the problem. It is possible that in the course 210 | // of executing the callbacks for this message someone will subscribe/unsubscribe from the same message in 211 | // the callback. This would invalidate the enumerator. To work around this we make a copy. However if you unsubscribe 212 | // from a message you can fairly reasonably expect that you will therefor not receive a call. To fix this we then 213 | // check that the item we are about to send the message to actually exists in the live list. 214 | List subscriptionsCopy = subcriptions.ToList(); 215 | foreach (Subscription subscription in subscriptionsCopy) 216 | { 217 | if (subscription.Subscriber.Target != null && subcriptions.Contains(subscription)) 218 | { 219 | subscription.InvokeCallback(sender, args); 220 | } 221 | } 222 | } 223 | 224 | void InnerSubscribe(object subscriber, string message, Type senderType, Type argType, object target, MethodInfo methodInfo, Filter filter) 225 | { 226 | if (message == null) 227 | throw new ArgumentNullException(nameof(message)); 228 | var key = new Sender(message, senderType, argType); 229 | var value = new Subscription(subscriber, target, methodInfo, filter); 230 | if (_subscriptions.ContainsKey(key)) 231 | { 232 | _subscriptions[key].Add(value); 233 | } 234 | else 235 | { 236 | var list = new List { value }; 237 | _subscriptions[key] = list; 238 | } 239 | } 240 | 241 | void InnerUnsubscribe(string message, Type senderType, Type argType, object subscriber) 242 | { 243 | if (subscriber == null) 244 | throw new ArgumentNullException(nameof(subscriber)); 245 | if (message == null) 246 | throw new ArgumentNullException(nameof(message)); 247 | 248 | var key = new Sender(message, senderType, argType); 249 | if (!_subscriptions.ContainsKey(key)) 250 | return; 251 | _subscriptions[key].RemoveAll(sub => sub.CanBeRemoved() || sub.Subscriber.Target == subscriber); 252 | if (!_subscriptions[key].Any()) 253 | _subscriptions.Remove(key); 254 | } 255 | 256 | // This is a bit gross; it only exists to support the unit tests in PageTests 257 | // because the implementations of ActionSheet, Alert, and IsBusy are all very 258 | // tightly coupled to the MessagingCenter singleton 259 | internal static void ClearSubscribers() 260 | { 261 | (Instance as MessagingCenter)?._subscriptions.Clear(); 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /src/AKSoftware.Blazor.Utilities/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Components.Web 2 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/BlazorUtilitiesSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @inject HttpClient Http 3 | 4 |

Weather forecast

5 | 6 |

This component demonstrates fetching data from the server.

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

Loading...

11 | } 12 | else 13 | { 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach (var forecast in forecasts) 25 | { 26 | 27 | 28 | 29 | 30 | 31 | 32 | } 33 | 34 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
35 | } 36 | 37 | @code { 38 | private WeatherForecast[] forecasts; 39 | 40 | protected override async Task OnInitializedAsync() 41 | { 42 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); 43 | } 44 | 45 | public class WeatherForecast 46 | { 47 | public DateTime Date { get; set; } 48 | 49 | public int TemperatureC { get; set; } 50 | 51 | public string Summary { get; set; } 52 | 53 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Hello, world!

4 | 5 | Welcome to your new app. 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Pages/MyAccount.razor: -------------------------------------------------------------------------------- 1 | @page "/MyAccount" 2 | 3 |

Update my Username

4 |
5 |
6 |
7 | 8 | 9 | 10 |
11 |
12 |
13 | 14 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Pages/MyAccount.razor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Components; 6 | using System.Net.Http; 7 | using System.Net.Http.Json; 8 | using Microsoft.AspNetCore.Components.Forms; 9 | using Microsoft.AspNetCore.Components.Routing; 10 | using Microsoft.AspNetCore.Components.Web; 11 | using Microsoft.AspNetCore.Components.Web.Virtualization; 12 | using Microsoft.AspNetCore.Components.WebAssembly.Http; 13 | using Microsoft.JSInterop; 14 | using BlazorUtilitiesSample; 15 | using BlazorUtilitiesSample.Shared; 16 | using AKSoftware.Blazor.Utilities; 17 | 18 | namespace BlazorUtilitiesSample.Pages 19 | { 20 | public partial class MyAccount 21 | { 22 | 23 | private string _username = UserSettings.DefaultUsername; 24 | 25 | private void OnEnterClicked(KeyboardEventArgs args) 26 | { 27 | if (args.Key == "Enter") 28 | { 29 | UpdateUsername(); 30 | } 31 | } 32 | 33 | private void UpdateUsername() 34 | { 35 | // Set the new value of the username 36 | UserSettings.DefaultUsername = _username; 37 | 38 | // Send the updated 39 | // You can use the Send function to send the sender object with the value you want to send 40 | MessagingCenter.Send(this, "username_updated", _username); 41 | } 42 | 43 | private void OnInputChange(ChangeEventArgs e) 44 | { 45 | _username = e.Value.ToString(); 46 | } 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Net.Http; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace BlazorUtilitiesSample 12 | { 13 | public class Program 14 | { 15 | public static async Task Main(string[] args) 16 | { 17 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 18 | builder.RootComponents.Add("#app"); 19 | 20 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 21 | 22 | await builder.Build().RunAsync(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:52309", 7 | "sslPort": 44378 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "BlazorUtilitiesSample": { 20 | "commandName": "Project", 21 | "dotnetRunMessages": "true", 22 | "launchBrowser": true, 23 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | @using AKSoftware.Blazor.Utilities 4 | @using BlazorUtilitiesSample.Pages 5 | 6 |
7 | 10 | 11 |
12 |
13 | Welcome @_username 14 |
15 | 16 |
17 | @Body 18 |
19 |
20 |
21 | 22 | @code 23 | { 24 | 25 | private string _username = UserSettings.DefaultUsername; 26 | 27 | protected override void OnInitialized() 28 | { 29 | string newUsername = string.Empty; 30 | 31 | // Subscribe to "username_updated" message so we can take an action whenever the username gots udpatd from the my account page 32 | MessagingCenter.Subscribe(this, "username_updated", (sender, arg) => 33 | { 34 | _username = arg; 35 | StateHasChanged(); 36 | }); 37 | base.OnInitialized(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .main > div { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | @using AKSoftware.Blazor.Utilities 2 | @using BlazorUtilitiesSample.Pages 3 | 4 | 10 | 11 |
12 | 34 |
35 | 36 | @code { 37 | private bool collapseNavMenu = true; 38 | 39 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 40 | 41 | private void ToggleNavMenu() 42 | { 43 | collapseNavMenu = !collapseNavMenu; 44 | } 45 | 46 | private string _username = UserSettings.DefaultUsername; 47 | 48 | protected override void OnInitialized() 49 | { 50 | // Subscribe to "username_updated" message so we can take an action whenever the username gots udpatd from the my account page 51 | MessagingCenter.Subscribe(this, "username_updated", (sender, arg) => 52 | { 53 | _username = arg; 54 | StateHasChanged(); 55 | }); 56 | } 57 | 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/UserSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorUtilitiesSample 2 | { 3 | public class UserSettings 4 | { 5 | public static string DefaultUsername = "Ahmad Mozaffar"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/_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 BlazorUtilitiesSample 10 | @using BlazorUtilitiesSample.Shared 11 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | .content { 18 | padding-top: 1.1rem; 19 | } 20 | 21 | .valid.modified:not([type=checkbox]) { 22 | outline: 1px solid #26b050; 23 | } 24 | 25 | .invalid { 26 | outline: 1px solid red; 27 | } 28 | 29 | .validation-message { 30 | color: red; 31 | } 32 | 33 | #blazor-error-ui { 34 | background: lightyellow; 35 | bottom: 0; 36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 37 | display: none; 38 | left: 0; 39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 40 | position: fixed; 41 | width: 100%; 42 | z-index: 1000; 43 | } 44 | 45 | #blazor-error-ui .dismiss { 46 | cursor: pointer; 47 | position: absolute; 48 | right: 0.75rem; 49 | top: 0.5rem; 50 | } 51 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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. -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/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'} -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/BlazorUtilitiesSample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/BlazorUtilitiesSample/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | BlazorUtilitiesSample 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Loading...
16 | 17 |
18 | An unhandled error has occurred. 19 | Reload 20 | 🗙 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/BlazorUtilitiesSample/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ProductsList.razor: -------------------------------------------------------------------------------- 1 |  2 |

Checkout the awesome products

3 | 4 |
5 | 6 | @foreach (var item in _items) 7 | { 8 | bool _isInStock = item.Quantity != 0; 9 |
10 |
11 | 12 | 13 |
@item.Name
14 |

$@item.Price

15 | @if (item.Quantity == 0) 16 | { 17 |

Out of stock

18 | } 19 | else 20 | { 21 |

@item.Quantity in stock

22 | } 23 | 24 | 25 |
26 |
27 | } 28 |
29 | 30 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ProductsList.razor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Components; 6 | using System.Net.Http; 7 | using System.Net.Http.Json; 8 | using Microsoft.AspNetCore.Components.Forms; 9 | using Microsoft.AspNetCore.Components.Routing; 10 | using Microsoft.AspNetCore.Components.Web; 11 | using Microsoft.AspNetCore.Components.Web.Virtualization; 12 | using Microsoft.AspNetCore.Components.WebAssembly.Http; 13 | using Microsoft.JSInterop; 14 | using ShoppingCartSample; 15 | using ShoppingCartSample.Shared; 16 | using ShoppingCartSample.Services; 17 | using ShoppingCartSample.Models; 18 | using AKSoftware.Blazor.Utilities; 19 | 20 | namespace ShoppingCartSample.Components 21 | { 22 | public partial class ProductsList 23 | { 24 | 25 | [Inject] 26 | public IItemsService ItemsService { get; set; } 27 | 28 | private IEnumerable _items => ItemsService.ListAllItems(); 29 | 30 | 31 | protected override void OnInitialized() 32 | { 33 | // Subscribe to the item_removed message and just refresh the state of the current component to recalculate the items 34 | MessagingCenter.Subscribe(this, "cartitem_removed", (sender, args) => 35 | { 36 | StateHasChanged(); 37 | }); 38 | } 39 | 40 | /// 41 | /// Add item to the cart and push a message holds the added item 42 | /// 43 | /// 44 | private void AddItemToCart(string itemId) 45 | { 46 | // Get the item from the store 47 | var item = _items.SingleOrDefault(i => i.Id == itemId); 48 | 49 | // Add the item to the cart 50 | ItemsService.AddItemToCart(itemId); 51 | 52 | // Send a message with the added item to the list holds the sender which is the current component, the kind of the message 'item_added' and the Item object as an argument 53 | MessagingCenter.Send(this, "item_added", item); 54 | } 55 | 56 | } 57 | } -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ProductsList.razor.css: -------------------------------------------------------------------------------- 1 | .item-card { 2 | margin: 2px; 3 | padding: 2px; 4 | } 5 | 6 | .item-card img { 7 | width: 100%; 8 | border-radius: 10px; 9 | margin-top: 1px; 10 | margin-bottom: 1px; 11 | } 12 | 13 | .item-card .in-stock { 14 | margin-top: 1px; 15 | margin-bottom: 1px; 16 | color: forestgreen; 17 | } 18 | 19 | .item-card .out-of-stock { 20 | margin-top: 1px; 21 | margin-bottom: 1px; 22 | color: darkred; 23 | } 24 | 25 | .item-card h6 { 26 | margin-top: 2px; 27 | } 28 | 29 | .item-card button { 30 | background-color: #0078d4; 31 | color: white; 32 | outline: none; 33 | border:none; 34 | border-radius: 20px; 35 | width: 100%; 36 | transition: 0.2s; 37 | } 38 | 39 | .item-card button:hover { 40 | background-color: #004e8c; 41 | outline: none; 42 | border: none; 43 | transform: scale(1.05); 44 | } 45 | 46 | .item-card button:active { 47 | background-color: #0078d4; 48 | outline: none; 49 | border: none; 50 | transform: scale(0.95); 51 | } 52 | 53 | .btn-disabled { 54 | opacity: 0.5; 55 | transition: 0s; 56 | cursor: not-allowed; 57 | } -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ShoppingCart.razor: -------------------------------------------------------------------------------- 1 | 

My Cart

2 | 3 |
4 | @foreach(var item in _cartItems.ToList()) 5 | { 6 |
7 | @item.Name ($@item.ItemPrice x @item.Quantity) - $@item.TotalPrice 8 | 9 | X 10 |
11 | } 12 |
13 | 14 | @code { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ShoppingCart.razor.cs: -------------------------------------------------------------------------------- 1 | using AKSoftware.Blazor.Utilities; 2 | using Microsoft.AspNetCore.Components; 3 | using ShoppingCartSample.Models; 4 | using ShoppingCartSample.Services; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | 9 | namespace ShoppingCartSample.Components 10 | { 11 | public partial class ShoppingCart 12 | { 13 | 14 | [Inject] 15 | public IItemsService ItemsService { get; set; } 16 | 17 | private List _cartItems = new(); 18 | 19 | protected override void OnInitialized() 20 | { 21 | _cartItems = GetCartListFromCart(); 22 | 23 | // Subscribe to the item_added message sent from the ProductsList and fire a callback whenever a new item added to the cart 24 | MessagingCenter.Subscribe(this, "item_added", (sender, args) => 25 | { 26 | // Recaulcate the items in the cart 27 | _cartItems = GetCartListFromCart(); 28 | 29 | // Notify the UI about the change 30 | StateHasChanged(); 31 | }); 32 | } 33 | 34 | /// 35 | /// Remove a specific Item from Cart 36 | /// 37 | /// 38 | private void RemoveItemFromCart(string itemId) 39 | { 40 | // Get the item id 41 | var item = ItemsService.ListAllItems().SingleOrDefault(i => i.Id == itemId); 42 | 43 | // Remove the item from the cart 44 | ItemsService.RemoveItemFromCart(itemId); 45 | 46 | // remove the item from the list of the UI 47 | var cartItem = _cartItems.SingleOrDefault(i => i.Id == itemId); 48 | _cartItems.Remove(cartItem); 49 | 50 | // Send a message to notify other components about the removing process and the total amount that has been removed 51 | MessagingCenter.Send(this, "cartitem_removed", cartItem); 52 | } 53 | 54 | private List GetCartListFromCart() 55 | { 56 | var allItems = ItemsService.ListAllItems(); 57 | var groupedItems = ItemsService.GetInCartItemIds().GroupBy(i => i).Select(i => new 58 | { 59 | Item = allItems.SingleOrDefault(item => item.Id == i.Key), 60 | Quantity = i.Count() 61 | }); 62 | 63 | return groupedItems.Select(i => new CartItem 64 | { 65 | Id = i.Item.Id, 66 | Quantity = i.Quantity, 67 | ItemPrice = i.Item.Price, 68 | Name = i.Item.Name, 69 | TotalPrice = i.Quantity * i.Item.Price 70 | }).ToList(); 71 | } 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Components/ShoppingCart.razor.css: -------------------------------------------------------------------------------- 1 | .cart-list { 2 | margin-top: 4px; 3 | padding: 2px 5px; 4 | font-size: 17px; 5 | border-left: 1px solid lightgray; 6 | } 7 | 8 | .cart-list .cart-item { 9 | display: flex; 10 | flex-direction: row; 11 | justify-content: space-between; 12 | align-items: center; 13 | margin-top: 6px; 14 | padding-bottom: 4px; 15 | padding-top: 4px; 16 | font-weight: 300; 17 | border-bottom: 1px solid lightgray; 18 | } 19 | 20 | .cart-item .remove-btn { 21 | color: red; 22 | cursor: pointer; 23 | font-size: 21px; 24 | font-weight: 300; 25 | transition: 0.2s; 26 | } 27 | 28 | .cart-item .remove-btn:hover { 29 | color: darkred; 30 | } 31 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Models/CartItem.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingCartSample.Models 2 | { 3 | /// 4 | /// CartItem is a class that will be used to represent each item in the shopping cart 5 | /// 6 | public class CartItem 7 | { 8 | public string Name { get; set; } 9 | 10 | public string Id { get; set; } 11 | 12 | public int Quantity { get; set; } 13 | 14 | public decimal ItemPrice { get; set; } 15 | 16 | public decimal TotalPrice { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Models/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ShoppingCartSample.Models 8 | { 9 | public class Item 10 | { 11 | public string Id { get; set; } 12 | 13 | public string Name { get; set; } 14 | 15 | public string Image { get; set; } 16 | 17 | public decimal Price { get; set; } 18 | 19 | public int Quantity { get; set; } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Models/ShoppingCartItem.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingCartSample.Models 2 | { 3 | public class ShoppingCartItem 4 | { 5 | public string ItemId { get; set; } 6 | 7 | public int Quantity { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/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 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @inject HttpClient Http 3 | 4 |

Weather forecast

5 | 6 |

This component demonstrates fetching data from the server.

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

Loading...

11 | } 12 | else 13 | { 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach (var forecast in forecasts) 25 | { 26 | 27 | 28 | 29 | 30 | 31 | 32 | } 33 | 34 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
35 | } 36 | 37 | @code { 38 | private WeatherForecast[] forecasts; 39 | 40 | protected override async Task OnInitializedAsync() 41 | { 42 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); 43 | } 44 | 45 | public class WeatherForecast 46 | { 47 | public DateTime Date { get; set; } 48 | 49 | public int TemperatureC { get; set; } 50 | 51 | public string Summary { get; set; } 52 | 53 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Welcome to Blazor Messaging Center

4 | 5 | This sample demonstrate how you can use the Pub-Sub pattern in your Blazor app to send data between the application' components efficiently by showing how the list of items components can update the 6 | cart and the badge on the top right directly without any direct relationship 7 | 8 | 9 | 10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Logging; 5 | using ShoppingCartSample.Services; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Net.Http; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace ShoppingCartSample 13 | { 14 | public class Program 15 | { 16 | public static async Task Main(string[] args) 17 | { 18 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 19 | builder.RootComponents.Add("#app"); 20 | 21 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 22 | builder.Services.AddScoped(); 23 | await builder.Build().RunAsync(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:29983", 7 | "sslPort": 44344 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "ShoppingCartSample": { 20 | "commandName": "Project", 21 | "dotnetRunMessages": "true", 22 | "launchBrowser": true, 23 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Services/IItemsService.cs: -------------------------------------------------------------------------------- 1 | using ShoppingCartSample.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace ShoppingCartSample.Services 5 | { 6 | public interface IItemsService 7 | { 8 | 9 | IEnumerable ListAllItems(); 10 | 11 | void AddItemToCart(string itemId); 12 | 13 | void RemoveItemFromCart(string itemId); 14 | 15 | IEnumerable GetInCartItemIds(); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Services/ItemsService.cs: -------------------------------------------------------------------------------- 1 | using ShoppingCartSample.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ShoppingCartSample.Services 9 | { 10 | 11 | public class ItemsService : IItemsService 12 | { 13 | 14 | #region Items store 15 | private static List _items = new() 16 | { 17 | new Item 18 | { 19 | Id = Guid.NewGuid().ToString(), 20 | Name = "Surface Laptop Studio", 21 | Price = 3250, 22 | Quantity = 10, 23 | Image = "/images/laptop-studio.webp", 24 | }, 25 | new Item 26 | { 27 | Id = Guid.NewGuid().ToString(), 28 | Name = "Surface Pro 8", 29 | Price = 1200, 30 | Quantity = 5, 31 | Image = "/images/pro-8.webp", 32 | }, 33 | new Item 34 | { 35 | Id = Guid.NewGuid().ToString(), 36 | Name = "Surface Pro X", 37 | Price = 1600, 38 | Quantity = 8, 39 | Image = "/images/pro-x.webp", 40 | }, 41 | new Item 42 | { 43 | Id = Guid.NewGuid().ToString(), 44 | Name = "Surface Laptop 4", 45 | Price = 999, 46 | Quantity = 10, 47 | Image = "/images/laptop-4.webp", 48 | }, 49 | new Item 50 | { 51 | Id = Guid.NewGuid().ToString(), 52 | Name = "Surface Duo 2", 53 | Price = 25, 54 | Quantity = 1600, 55 | Image = "/images/duo-2.webp", 56 | }, 57 | new Item 58 | { 59 | Id = Guid.NewGuid().ToString(), 60 | Name = "Surface Duo", 61 | Price = 1100, 62 | Quantity = 5, 63 | Image = "/images/duo.webp", 64 | }, 65 | new Item 66 | { 67 | Id = Guid.NewGuid().ToString(), 68 | Name = "Surface Go 3", 69 | Price = 1300, 70 | Quantity = 5, 71 | Image = "/images/go.webp", 72 | }, 73 | new Item 74 | { 75 | Id = Guid.NewGuid().ToString(), 76 | Name = "Surface Studio 2", 77 | Image = "/images/studio.webp", 78 | Price = 4500, 79 | Quantity = 2, 80 | } 81 | }; 82 | #endregion 83 | private static List _cartItems = new(); 84 | 85 | /// 86 | /// Add a specific item to cart and redeuce the quantity by 1 87 | /// 88 | /// 89 | /// 90 | /// 91 | public void AddItemToCart(string itemId) 92 | { 93 | var item = _items.SingleOrDefault(i => i.Id == itemId); 94 | if (item == null) 95 | throw new ArgumentException("Item not found"); 96 | 97 | if (item.Quantity == 0) 98 | throw new InvalidOperationException("Not available in the stock"); 99 | 100 | item.Quantity--; 101 | _cartItems.Add(itemId); 102 | 103 | } 104 | 105 | /// 106 | /// Retrieve a collection with all the items in stock 107 | /// 108 | /// 109 | public IEnumerable ListAllItems() 110 | { 111 | return _items; 112 | } 113 | 114 | /// 115 | /// Remove the item from the cart or remove range of items if it's existing mutliple times and re-add the quantity to the stock 116 | /// 117 | /// 118 | /// 119 | public void RemoveItemFromCart(string itemId) 120 | { 121 | var item = _items.SingleOrDefault(i => i.Id == itemId); 122 | if (item == null) 123 | throw new ArgumentException("Item not found"); 124 | var cartItems = _cartItems.Where(i => i == itemId).ToArray(); 125 | item.Quantity += cartItems.Count(); 126 | foreach (var cartItem in cartItems) 127 | { 128 | _cartItems.Remove(cartItem); 129 | } 130 | } 131 | 132 | /// 133 | /// Retrieve the list of the item ids existing in the cart each id represents an item and multiple values represents the quantity 134 | /// 135 | /// 136 | public IEnumerable GetInCartItemIds() 137 | { 138 | return _cartItems; 139 | } 140 | } 141 | 142 | } 143 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | @* 7 | *@ 8 |
9 |
10 | 11 | 14 | 15 |
16 | 17 |
18 | @Body 19 |
20 |
21 |
22 | 23 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Shared/MainLayout.razor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Components; 6 | using System.Net.Http; 7 | using System.Net.Http.Json; 8 | using Microsoft.AspNetCore.Components.Forms; 9 | using Microsoft.AspNetCore.Components.Routing; 10 | using Microsoft.AspNetCore.Components.Web; 11 | using Microsoft.AspNetCore.Components.Web.Virtualization; 12 | using Microsoft.AspNetCore.Components.WebAssembly.Http; 13 | using Microsoft.JSInterop; 14 | using ShoppingCartSample; 15 | using ShoppingCartSample.Shared; 16 | using AKSoftware.Blazor.Utilities; 17 | using ShoppingCartSample.Components; 18 | using ShoppingCartSample.Models; 19 | 20 | namespace ShoppingCartSample.Shared 21 | { 22 | public partial class MainLayout 23 | { 24 | 25 | private decimal _totalAmount = 0; 26 | 27 | protected override void OnInitialized() 28 | { 29 | // Subscribe to the cartitem_removed message to reduce the total amount of the cart 30 | MessagingCenter.Subscribe(this, "cartitem_removed", (sender, item) => 31 | { 32 | _totalAmount -= item.TotalPrice; 33 | StateHasChanged(); 34 | }); 35 | 36 | // Subscribe to the item_added message to increase the total amount of the cart 37 | MessagingCenter.Subscribe(this, "item_added", (sender, item) => 38 | { 39 | _totalAmount += item.Price; 40 | StateHasChanged(); 41 | }); 42 | } 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /src/ShoppingCartSample/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .main > div { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 26 |
27 | 28 | @code { 29 | private bool collapseNavMenu = true; 30 | 31 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 32 | 33 | private void ToggleNavMenu() 34 | { 35 | collapseNavMenu = !collapseNavMenu; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/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 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/ShoppingCartSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/_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 ShoppingCartSample 10 | @using ShoppingCartSample.Shared 11 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/duo-2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/duo-2.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/duo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/duo.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/go.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/go.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/laptop-4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/laptop-4.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/laptop-studio.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/laptop-studio.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/pro-8.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/pro-8.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/pro-x.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/pro-x.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/Images/studio.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/Images/studio.webp -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | .content { 18 | padding-top: 1.1rem; 19 | } 20 | 21 | .valid.modified:not([type=checkbox]) { 22 | outline: 1px solid #26b050; 23 | } 24 | 25 | .invalid { 26 | outline: 1px solid red; 27 | } 28 | 29 | .validation-message { 30 | color: red; 31 | } 32 | 33 | #blazor-error-ui { 34 | background: lightyellow; 35 | bottom: 0; 36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 37 | display: none; 38 | left: 0; 39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 40 | position: fixed; 41 | width: 100%; 42 | z-index: 1000; 43 | } 44 | 45 | #blazor-error-ui .dismiss { 46 | cursor: pointer; 47 | position: absolute; 48 | right: 0.75rem; 49 | top: 0.5rem; 50 | } 51 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/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 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/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. -------------------------------------------------------------------------------- /src/ShoppingCartSample/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 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/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'} -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 9 | By P.J. Onori 10 | Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) 11 | 12 | 13 | 14 | 27 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 71 | 74 | 76 | 79 | 81 | 84 | 86 | 88 | 91 | 93 | 95 | 98 | 100 | 102 | 104 | 106 | 109 | 112 | 115 | 117 | 121 | 123 | 125 | 127 | 130 | 132 | 134 | 136 | 138 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 155 | 157 | 159 | 162 | 165 | 167 | 169 | 172 | 174 | 177 | 179 | 181 | 183 | 185 | 189 | 191 | 194 | 196 | 198 | 200 | 202 | 205 | 207 | 209 | 211 | 213 | 215 | 218 | 220 | 222 | 224 | 226 | 228 | 230 | 232 | 234 | 236 | 238 | 241 | 243 | 245 | 247 | 249 | 251 | 253 | 256 | 259 | 261 | 263 | 265 | 267 | 269 | 272 | 274 | 276 | 280 | 282 | 285 | 287 | 289 | 292 | 295 | 298 | 300 | 302 | 304 | 306 | 309 | 312 | 314 | 316 | 318 | 320 | 322 | 324 | 326 | 330 | 334 | 338 | 340 | 343 | 345 | 347 | 349 | 351 | 353 | 355 | 358 | 360 | 363 | 365 | 367 | 369 | 371 | 373 | 375 | 377 | 379 | 381 | 383 | 386 | 388 | 390 | 392 | 394 | 396 | 399 | 401 | 404 | 406 | 408 | 410 | 412 | 414 | 416 | 419 | 421 | 423 | 425 | 428 | 431 | 435 | 438 | 440 | 442 | 444 | 446 | 448 | 451 | 453 | 455 | 457 | 460 | 462 | 464 | 466 | 468 | 471 | 473 | 477 | 479 | 481 | 483 | 486 | 488 | 490 | 492 | 494 | 496 | 499 | 501 | 504 | 506 | 509 | 512 | 515 | 517 | 520 | 522 | 524 | 526 | 529 | 532 | 534 | 536 | 539 | 542 | 543 | 544 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aksoftware98/blazor-utilities/9cd7bcf26652a66461a65b2cb81822808ac38d2c/src/ShoppingCartSample/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ShoppingCartSample 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Loading...
16 | 17 |
18 | An unhandled error has occurred. 19 | Reload 20 | 🗙 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/ShoppingCartSample/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | --------------------------------------------------------------------------------