Skip to content

Commit

Permalink
added blazor test app
Browse files Browse the repository at this point in the history
added bootstrap sample
  • Loading branch information
Stavros Kasidis committed Dec 24, 2018
1 parent 2d11b87 commit 382ee54
Show file tree
Hide file tree
Showing 33 changed files with 1,262 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,6 @@ __pycache__/
*.pyc
*.min.css
*.min.js


/Artifacts/
Empty file added Artifacts/.gitkeep
Empty file.
81 changes: 81 additions & 0 deletions BlazorDialog.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorDialog", "BlazorDialog\BlazorDialog.csproj", "{D6A05A5B-2A9D-43A8-B949-272147D62E52}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4B0AEE66-03C7-46A3-AC4C-A18CCE52376C}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{DA8334A6-0B04-44CD-925C-7710EDECF4D2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestApps", "TestApps", "{99A35E68-10F9-4BDB-AB82-DEEEBAFA5581}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Blazor", "Blazor", "{7E1980A3-6F6D-4073-8AA8-88860C0F8B57}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorDialog.BlazorTestApp.Client", "TestApps\Blazor\BlazorDialog.BlazorTestApp.Client\BlazorDialog.BlazorTestApp.Client.csproj", "{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorDialog.BlazorTestApp.Server", "TestApps\Blazor\BlazorDialog.BlazorTestApp.Server\BlazorDialog.BlazorTestApp.Server.csproj", "{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|x64.ActiveCfg = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|x64.Build.0 = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|x86.ActiveCfg = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Debug|x86.Build.0 = Debug|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|Any CPU.Build.0 = Release|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|x64.ActiveCfg = Release|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|x64.Build.0 = Release|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|x86.ActiveCfg = Release|Any CPU
{D6A05A5B-2A9D-43A8-B949-272147D62E52}.Release|x86.Build.0 = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|x64.ActiveCfg = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|x64.Build.0 = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|x86.ActiveCfg = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Debug|x86.Build.0 = Debug|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|Any CPU.Build.0 = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|x64.ActiveCfg = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|x64.Build.0 = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|x86.ActiveCfg = Release|Any CPU
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721}.Release|x86.Build.0 = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|x64.ActiveCfg = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|x64.Build.0 = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Debug|x86.Build.0 = Debug|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|Any CPU.Build.0 = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|x64.ActiveCfg = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|x64.Build.0 = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|x86.ActiveCfg = Release|Any CPU
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7E1980A3-6F6D-4073-8AA8-88860C0F8B57} = {99A35E68-10F9-4BDB-AB82-DEEEBAFA5581}
{1A4C24B7-8B7D-4C3A-8D1D-71CC23669721} = {7E1980A3-6F6D-4073-8AA8-88860C0F8B57}
{D5494F0E-1D2B-4FA3-BAC4-96A2695DC8A8} = {7E1980A3-6F6D-4073-8AA8-88860C0F8B57}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6D16D50-B899-4FB4-BB9C-1ECDD5D38570}
EndGlobalSection
EndGlobal
12 changes: 1 addition & 11 deletions BlazorDialog/BlazorDialog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@

@if (Id != null && states.IsShowing.ContainsKey(Id) && states.IsShowing[Id])
{
if (!UseCustomCss)
{
<div class="whatever">
@ChildContent((ContextType)states.Inputs[Id])
</div>
}
else
{
@ChildContent((ContextType)states.Inputs[Id])
}
@ChildContent((ContextType)states.Inputs[Id])
}

@functions{
[Parameter] protected string Id { get; set; }
[Parameter] protected RenderFragment<ContextType> ChildContent { get; set; }
[Parameter] protected bool UseCustomCss { get; set; } = false;

protected override void OnInit()
{
Expand Down
16 changes: 0 additions & 16 deletions BlazorDialog/ExampleJsInterop.cs

This file was deleted.

4 changes: 2 additions & 2 deletions BlazorDialog/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public static class ServiceCollectionExtensions
{
public static IServiceCollection AddBlazorDialog(this IServiceCollection services)
{
services.AddSingleton<DialogStates>();
services.AddSingleton<BlazorDialogService>();
services.AddScoped<DialogStates>();
services.AddScoped<BlazorDialogService>();
return services;
}
}
Expand Down
Binary file removed BlazorDialog/content/background.png
Binary file not shown.
Binary file removed ReadmeResources/blazor-context-menu-demo-1.gif
Binary file not shown.
5 changes: 5 additions & 0 deletions TestApps/Blazor/BlazorDialog.BlazorTestApp.Client/App.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--
Configuring this here is temporary. Later we'll move the app config
into Program.cs, and it won't be necessary to specify AppAssembly.
-->
<Router AppAssembly=typeof(Program).Assembly />
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.7.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\BlazorDialog\BlazorDialog.csproj" />
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@page "/"
@inject BlazorDialogService dialogService
<h2>Hello, Blazor Dialog!</h2>

<p>Click the buttons to show the corresponding dialog</p>

<button onclick="@OnClick">Bootstrap Dialog</button>
@if (dialogResult != null)
{
<div>DialogResult: @dialogResult</div>
}

@functions{
string dialogResult = null;

async Task OnClick()
{
var resultTask = dialogService.ShowDialog<string>("bootstrap-dialog", "Are you sure?");
await JSRuntime.Current.InvokeAsync<object>("ShowBootstrapModal", "bootstrap-dialog"); //Trigger bootstrap's modal
dialogResult = await resultTask;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@layout MainLayout
16 changes: 16 additions & 0 deletions TestApps/Blazor/BlazorDialog.BlazorTestApp.Client/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Blazor.Hosting;

namespace BlazorDialog.BlazorTestApp.Client
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:57871/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorDialog.BlazorTestApp.Client": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:57872/"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@inherits BlazorLayoutComponent
@inject BlazorDialogService dialogService

<div class="main">
<div class="content px-4">
<BlazorDialog Id="bootstrap-dialog" ContextType="string" Context="message">
<div id="bootstrap-dialog" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<p>@message</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="@(()=> dialogService.HideDialog("bootstrap-dialog", "yes"))">Yes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="@(()=> dialogService.HideDialog("bootstrap-dialog", "no"))">No</button>
</div>
</div>
</div>
</div>
</BlazorDialog>

@Body
</div>
</div>
18 changes: 18 additions & 0 deletions TestApps/Blazor/BlazorDialog.BlazorTestApp.Client/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Blazor.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace BlazorDialog.BlazorTestApp.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddBlazorDialog();
}

public void Configure(IBlazorApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Blazor.Layouts
@using Microsoft.AspNetCore.Blazor.Routing
@using Microsoft.JSInterop
@using BlazorDialog.BlazorTestApp.Client
@using BlazorDialog.BlazorTestApp.Client.Shared


@addTagHelper *,BlazorDialog

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
SIL OPEN FONT LICENSE Version 1.1

Copyright (c) 2014 Waybury

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading

0 comments on commit 382ee54

Please sign in to comment.