Skip to content

Commit

Permalink
Merge remote-tracking branch 'MarkStega/DualModeDemo'
Browse files Browse the repository at this point in the history
  • Loading branch information
simonziegler committed Mar 27, 2020
2 parents 79092f6 + df028b0 commit 7d93eec
Show file tree
Hide file tree
Showing 53 changed files with 409 additions and 44 deletions.
68 changes: 52 additions & 16 deletions BlazorMdc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,72 @@ VisualStudioVersion = 16.0.29827.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMdc", "src\BlazorMdc\BlazorMdc.csproj", "{18F89AD9-B647-4928-9C88-6FE17D96355A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demonstration", "samples\Demonstration\Demonstration.csproj", "{E3256AE1-339B-4365-9E2C-66D71C22BDD6}"
ProjectSection(ProjectDependencies) = postProject
{18F89AD9-B647-4928-9C88-6FE17D96355A} = {18F89AD9-B647-4928-9C88-6FE17D96355A}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{510C6FFC-D13D-431C-B5B5-897B7BDA3C29}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{24CEE271-A626-4366-893B-90942D79D569}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMdc.Demo.Blazor", "samples\BlazorMdc.Demo.Blazor\BlazorMdc.Demo.Blazor.csproj", "{E6356325-F767-4C25-BDCA-005C45144C80}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMdc.Demo.CommonUI", "samples\BlazorMdc.Demo.CommonUI\BlazorMdc.Demo.CommonUI.csproj", "{E19D106A-7368-46CB-B8FB-08465F927A79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMdc.Demo.WebServer", "samples\BlazorMdc.Demo.WebServer\BlazorMdc.Demo.WebServer.csproj", "{538DF864-828F-470C-AE74-7345272F5EEF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solutionitems", "solutionitems", "{9BF202BD-226D-4058-92D9-B9D0B23F96E6}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug_CSB|Any CPU = Debug_CSB|Any CPU
Debug_SSB|Any CPU = Debug_SSB|Any CPU
Release_CSB|Any CPU = Release_CSB|Any CPU
Release_SSB|Any CPU = Release_SSB|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release|Any CPU.Build.0 = Release|Any CPU
{E3256AE1-339B-4365-9E2C-66D71C22BDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3256AE1-339B-4365-9E2C-66D71C22BDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3256AE1-339B-4365-9E2C-66D71C22BDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3256AE1-339B-4365-9E2C-66D71C22BDD6}.Release|Any CPU.Build.0 = Release|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug_CSB|Any CPU.ActiveCfg = Debug_CSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug_CSB|Any CPU.Build.0 = Debug_CSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug_SSB|Any CPU.ActiveCfg = Debug_SSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Debug_SSB|Any CPU.Build.0 = Debug_SSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release_CSB|Any CPU.ActiveCfg = Release_CSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release_CSB|Any CPU.Build.0 = Release_CSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release_SSB|Any CPU.ActiveCfg = Release_SSB|Any CPU
{18F89AD9-B647-4928-9C88-6FE17D96355A}.Release_SSB|Any CPU.Build.0 = Release_SSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Debug_CSB|Any CPU.ActiveCfg = Debug_CSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Debug_CSB|Any CPU.Build.0 = Debug_CSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Debug_SSB|Any CPU.ActiveCfg = Debug_SSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Debug_SSB|Any CPU.Build.0 = Debug_SSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Release_CSB|Any CPU.ActiveCfg = Release_CSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Release_CSB|Any CPU.Build.0 = Release_CSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Release_SSB|Any CPU.ActiveCfg = Release_SSB|Any CPU
{E6356325-F767-4C25-BDCA-005C45144C80}.Release_SSB|Any CPU.Build.0 = Release_SSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Debug_CSB|Any CPU.ActiveCfg = Debug_CSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Debug_CSB|Any CPU.Build.0 = Debug_CSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Debug_SSB|Any CPU.ActiveCfg = Debug_SSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Debug_SSB|Any CPU.Build.0 = Debug_SSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Release_CSB|Any CPU.ActiveCfg = Release_CSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Release_CSB|Any CPU.Build.0 = Release_CSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Release_SSB|Any CPU.ActiveCfg = Release_SSB|Any CPU
{E19D106A-7368-46CB-B8FB-08465F927A79}.Release_SSB|Any CPU.Build.0 = Release_SSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Debug_CSB|Any CPU.ActiveCfg = Debug_CSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Debug_CSB|Any CPU.Build.0 = Debug_CSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Debug_SSB|Any CPU.ActiveCfg = Debug_SSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Debug_SSB|Any CPU.Build.0 = Debug_SSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Release_CSB|Any CPU.ActiveCfg = Release_CSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Release_CSB|Any CPU.Build.0 = Release_CSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Release_SSB|Any CPU.ActiveCfg = Release_SSB|Any CPU
{538DF864-828F-470C-AE74-7345272F5EEF}.Release_SSB|Any CPU.Build.0 = Release_SSB|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{18F89AD9-B647-4928-9C88-6FE17D96355A} = {510C6FFC-D13D-431C-B5B5-897B7BDA3C29}
{E3256AE1-339B-4365-9E2C-66D71C22BDD6} = {24CEE271-A626-4366-893B-90942D79D569}
{E6356325-F767-4C25-BDCA-005C45144C80} = {24CEE271-A626-4366-893B-90942D79D569}
{E19D106A-7368-46CB-B8FB-08465F927A79} = {24CEE271-A626-4366-893B-90942D79D569}
{538DF864-828F-470C-AE74-7345272F5EEF} = {24CEE271-A626-4366-893B-90942D79D569}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6EFB30DD-ABFD-4A38-96E1-D309BB538E62}
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ BlazorMdc is forked from [Steve Sanderson's](https://blog.stevensanderson.com/)

_TBD_

## Demonstration from local build
If you have cloned the repository and are building from source there is a project under 'samples' that should be selected as the startup project. That project is BlazorMDC.Demo.WebServer.

There are four implemented solution configurations:

| Configuration | Notes |
| :------------ | :---- |
| `Debug_CSB` | This is a debug build. It defines two constants, DEBUG, and ClientSideBlazor. It executes using WASM. |
|`Debug_SSB`|Also a debug build, defines DEBUG abd ServerSideBlazor. It executes in the context of the web server and the the client being displayed by RPC|
|`Release_xSB`|These two (x=C or S) configurations are the same as the debug versions but are built as release and the DEBUG constant is replaced by RELEASE.|

The home page of the demonstration application shows the execution environment as well as the build mode.

## Components

The following is a list of components, but lacks documentation on how they are used. Since forking from [RazorComponents.MaterialDesign](https://github.com/SteveSandersonMS/RazorComponents.MaterialDesign), some components await review - these are highlighed.
Expand Down
39 changes: 39 additions & 0 deletions samples/BlazorMdc.Demo.Blazor/BlazorMdc.Demo.Blazor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>

<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>

<Configurations>Debug_CSB;Debug_SSB;Release_CSB;Release_SSB</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;RELEASE;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;RELEASE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview2.20160.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview2.20160.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview2.20160.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BlazorMdc.Demo.CommonUI\BlazorMdc.Demo.CommonUI.csproj" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions samples/BlazorMdc.Demo.Blazor/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using BlazorMdc.Demo.CommonUI;

using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;

using System.Threading.Tasks;

namespace BlazorMdc.Demo.Blazor
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");

builder.Services.AddBaseAddressHttpClient();

await builder.Build().RunAsync();
}
}
}
27 changes: 27 additions & 0 deletions samples/BlazorMdc.Demo.Blazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59810/",
"sslPort": 44316
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorMdc.Demo.Blazor": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
Expand Down
36 changes: 36 additions & 0 deletions samples/BlazorMdc.Demo.CommonUI/BlazorMdc.Demo.CommonUI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<IsPackable>true</IsPackable>
<LangVersion>7.3</LangVersion>
<OutputType>Library</OutputType>
<RootNamespace>BlazorMdc.Demo.CommonUI</RootNamespace>
<TargetFramework>netstandard2.1</TargetFramework>

<RazorLangVersion>3.0</RazorLangVersion>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>

<Configurations>Debug_CSB;Debug_SSB;Release_CSB;Release_SSB</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;RELEASE;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;RELEASE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\BlazorMdc\BlazorMdc.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
@page "/"
@using System.Runtime.InteropServices


<h1 class="@MdcTypography.Heading3">Hello, world!</h1>

<p>This sample demonstrates the use of RazorComponents.MaterialDesign components.</p>

<p>Currently executing on <strong>@runtime</strong>.</p>
<p>Currently executing on <strong>@runtime</strong> built in <strong>@mode</strong> mode.</p>



@for (int i = 0; i < 10; i++)
{
<p style="margin-top: 5em;">A spacing paragraph to test scrolling and the top menu's scroll behaviour.</p>
}

@code {
string runtime = RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
? "Mono WebAssembly"
: ".NET Core";
}
21 changes: 21 additions & 0 deletions samples/BlazorMdc.Demo.CommonUI/Pages/Index.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Runtime.InteropServices;

namespace BlazorMdc.Demo.CommonUI.Pages
{
public partial class Index
{
string runtime = RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
? "Mono WebAssembly"
: ".NET Core";

string mode;
public Index()
{
#if DEBUG
mode = "debug";
#else
mode = "release";
#endif
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using BlazorMdc.Components
@using Demonstration
@using Demonstration.Shared
@using BlazorMdc.Demo.CommonUI
@using BlazorMdc.Demo.CommonUI.Pages
@using BlazorMdc.Demo.CommonUI.Shared
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions samples/BlazorMdc.Demo.WebServer/BlazorMdc.Demo.WebServer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<RootNamespace>BlazorMdc.Demo.WebServer</RootNamespace>

<Configurations>Debug_CSB;Debug_SSB;Release_CSB;Release_SSB</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;DEBUG;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CSB|AnyCPU'">
<DefineConstants>ClientSideBlazor;RELEASE;</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SSB|AnyCPU'">
<DefineConstants>ServerSideBlazor;RELEASE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BlazorMdc.Demo.Blazor\BlazorMdc.Demo.Blazor.csproj" />
<ProjectReference Include="..\BlazorMdc.Demo.CommonUI\BlazorMdc.Demo.CommonUI.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.0-preview2.20160.5" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions samples/BlazorMdc.Demo.WebServer/Pages/Error.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@page "/Error"


<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
Loading

0 comments on commit 7d93eec

Please sign in to comment.