Skip to content

Commit eae4271

Browse files
authored
Merge pull request #243 from FiendsOfTheElements/dev
Merge dev to master (2.5)
2 parents e06b0a8 + dc9b58c commit eae4271

File tree

123 files changed

+11311
-1931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+11311
-1931
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
*.userosscache
88
*.sln.docstates
99

10+
# The Usual Suspects
11+
*.swp
12+
.DS_Store
13+
Thumbs.db
14+
1015
# User-specific files (MonoDevelop/Xamarin Studio)
1116
*.userprefs
1217

FF1Blazorizer/App.cshtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--
2+
Configuring this here is temporary. Later we'll move the app config
3+
into Program.cs, and it won't be necessary to specify AppAssembly.
4+
-->
5+
<Router AppAssembly=typeof(Program).Assembly />

FF1Blazorizer/EnumDescription.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace FF1Blazorizer
7+
{
8+
using System;
9+
using System.ComponentModel;
10+
11+
public static class EnumDescription
12+
{
13+
14+
// This extension method is broken out so you can use a similar pattern with
15+
// other MetaData elements in the future. This is your base method for each.
16+
public static T GetAttribute<T>(this Enum value) where T : Attribute
17+
{
18+
var type = value.GetType();
19+
var memberInfo = type.GetMember(value.ToString());
20+
var attributes = memberInfo[0].GetCustomAttributes(typeof(T), false);
21+
return attributes.Length > 0
22+
? (T)attributes[0]
23+
: null;
24+
}
25+
26+
// This method creates a specific call to the above method, requesting the
27+
// Description MetaData attribute.
28+
public static string ToName(this Enum value)
29+
{
30+
var attribute = value.GetAttribute<DescriptionAttribute>();
31+
return attribute == null ? value.ToString() : attribute.Description;
32+
}
33+
34+
}
35+
}

FF1Blazorizer/FF1Blazorizer.csproj

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RunCommand>dotnet</RunCommand>
6+
<RunArguments>blazor serve</RunArguments>
7+
<LangVersion>7.3</LangVersion>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="BlazorStrap" Version="0.6.1" />
12+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.7.0" />
13+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.7.0" PrivateAssets="all" />
14+
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.7.0" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\FF1Lib\FF1Lib.csproj" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<Content Update="wwwroot\presets\beginner.json">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
</Content>
25+
<Content Update="wwwroot\presets\debug.json">
26+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
27+
</Content>
28+
<Content Update="wwwroot\presets\default.json">
29+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
30+
</Content>
31+
<Content Update="wwwroot\presets\full-npc.json">
32+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
33+
</Content>
34+
<Content Update="wwwroot\presets\improved-vanilla.json">
35+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
36+
</Content>
37+
</ItemGroup>
38+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
39+
<Copy SourceFiles="$(OutDir)version.txt" DestinationFolder="$(OutDir)dist" />
40+
</Target>
41+
42+
</Project>

FF1Blazorizer/Pages/Index.cshtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@page "/"
2+
3+
<h1>Hello, world!</h1>
4+
5+
Welcome to your new app.
6+
7+
<SurveyPrompt Title="How is Blazor working for you?" />

FF1Blazorizer/Pages/Randomize.cshtml

Lines changed: 335 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@layout MainLayout

FF1Blazorizer/Program.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Blazor.Hosting;
2+
3+
namespace FF1Blazorizer
4+
{
5+
public class Program
6+
{
7+
public static void Main(string[] args)
8+
{
9+
CreateHostBuilder(args).Build().Run();
10+
}
11+
12+
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13+
BlazorWebAssemblyHost.CreateDefaultBuilder()
14+
.UseBlazorStartup<Startup>();
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"profiles": {
3+
"FF1Blazorizer": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"environmentVariables": {
7+
"ASPNETCORE_ENVIRONMENT": "Development"
8+
},
9+
"applicationUrl": "http://localhost:62670/"
10+
}
11+
}
12+
}

FF1Blazorizer/Shared/CheckBox.cshtml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<div class="checkbox-cell">
2+
@if (Indent)
3+
{
4+
<span class="indent"></span>
5+
}
6+
<input type="checkbox" id="@Id" checked="@Value" onchange="@onchange" disabled="@(!IsEnabled)"/> <label for="@Id" class="@DisabledClass">@ChildContent</label>
7+
</div>
8+
9+
@functions
10+
{
11+
[Parameter]
12+
private bool Value { get; set; }
13+
[Parameter]
14+
private Action<bool> ValueChanged { get; set; }
15+
void onchange(UIChangeEventArgs e)
16+
{
17+
Value = (bool)e.Value;
18+
ValueChanged(Value);
19+
}
20+
21+
[Parameter]
22+
private bool Indent { get; set; }
23+
24+
[Parameter]
25+
private bool IsEnabled { get; set; } = true;
26+
private string DisabledClass => IsEnabled ? "" : "disabled";
27+
28+
[Parameter]
29+
private string Id { get; set; }
30+
31+
[Parameter]
32+
private RenderFragment ChildContent { get; set; }
33+
34+
}

0 commit comments

Comments
 (0)