Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
p6laris committed Nov 18, 2023
1 parent 08d6ef1 commit d96bbd3
Show file tree
Hide file tree
Showing 36 changed files with 2,840 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SiriLazor.WASM/Components/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
3 changes: 3 additions & 0 deletions SiriLazor.WASM/Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@inherits LayoutComponentBase

@Body
104 changes: 104 additions & 0 deletions SiriLazor.WASM/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@page "/"
@using SiriLazor.UI;

<PageTitle>SiriLazorDemo</PageTitle>

<div class="flex flex-col m-10">
<h1 class="text-white text-center font-black text-5xl">SiriLazor</h1>
<p class="text-white text-center mb-10">
The Apple® Siri wave-form.
</p>
<div class="grid grid-cols-2 gap-10 divide-x divide-solid ">
<div class="flex flex-col items-center">
<h1 class="font-inter text-white font-black text-center">Classic Wave</h1>
<ClassicWave SetDefaultOptions @ref="classicWave"></ClassicWave>
<div>
<button @onclick="async () => await StopClassic()" class="text-black bg-white px-3 py-1 rounded">Stop</button>
<button @onclick="async () => await StartClassic()" class="text-black bg-white px-3 py-1 rounded">Start</button>

</div>
<div class="w-1/2 mx-auto mt-8 text-black bg-white p-2 flex rounded">
<label for="ios9SSpeedlider">Speed:</label>
<input type="range" min="0" max="3" step="0.1" value="@sliderClassicSpeedValue" @oninput="async (e) => await UpdateSpeedValueClassic(e)">
<p class="mt-4"><span>@sliderClassicSpeedValue</span></p>
</div>
<div class="w-1/2 mx-auto mt-8 text-black bg-white p-2 flex rounded">
<label for="ios9SSpeedlider">Amplitude:</label>
<input type="range" min="0" max="3" step="0.1" value="@sliderClassicAmpValue" @oninput="async (e) => await UpdateAmpValueClassic(e)">
<p class="mt-4"><span>@sliderClassicAmpValue</span></p>
</div>
</div>
<div class="flex flex-col items-center">
<h1 class="font-inter text-center font-black bg-gradient-to-r from-rose-400 to-sky-400 bg-clip-text text-transparent">IOS9 Wave</h1>
<IOS9Wave SetDefaultOptions @ref="ios9Wave"></IOS9Wave>
<div>
<button @onclick="async() => await StopIOS9()" class="text-black bg-white px-3 py-1 rounded">Stop</button>
<button @onclick="async () => await StartIOS9()" class="text-black bg-white px-3 py-1 rounded">Start</button>


</div>
<div class="w-1/2 mx-auto mt-8 text-black bg-white p-2 flex rounded">
<label for="ios9SSpeedlider">Speed:</label>
<input type="range" min="0" max="3" step="0.1" value="@sliderIos9SpeedValue" @oninput="async (e) => await UpdateSpeedValueIOS9(e)">
<p class="mt-4"><span>@sliderIos9SpeedValue</span></p>
</div>
<div class="w-1/2 mx-auto mt-8 text-black bg-white p-2 flex rounded">
<label for="ios9SSpeedlider">Amplitude:</label>
<input type="range" min="0" max="3" step="0.1" value="@sliderIos9AmpValue" @oninput="async (e) => await UpdateAmpValueIOS9(e)">
<p class="mt-4"><span>@sliderIos9AmpValue</span></p>
</div>
</div>
</div>


</div>


@code{
IOS9Wave ios9Wave;
ClassicWave classicWave;

double sliderIos9SpeedValue = 0.2;
double sliderIos9AmpValue = 1;

double sliderClassicSpeedValue = 0.2;
double sliderClassicAmpValue = 1;

async ValueTask StopClassic()
{
await classicWave.Stop();
}
async ValueTask StopIOS9()
{
await ios9Wave.Stop();
}

async ValueTask StartIOS9()
{
await ios9Wave.Start();
}
async ValueTask StartClassic()
{
await classicWave.Start();
}
private async ValueTask UpdateSpeedValueIOS9(ChangeEventArgs e)
{
sliderIos9SpeedValue = Convert.ToDouble(e.Value);
await ios9Wave.SetSpeed(sliderIos9SpeedValue);
}
private async ValueTask UpdateAmpValueIOS9(ChangeEventArgs e)
{
sliderIos9AmpValue = Convert.ToDouble(e.Value);
await ios9Wave.SetAmplitude(sliderIos9AmpValue);
}
private async ValueTask UpdateSpeedValueClassic(ChangeEventArgs e)
{
sliderClassicSpeedValue = Convert.ToDouble(e.Value);
await classicWave.SetSpeed(sliderClassicSpeedValue);
}
private async ValueTask UpdateAmpValueClassic(ChangeEventArgs e)
{
sliderClassicAmpValue = Convert.ToDouble(e.Value);
await classicWave.SetAmplitude(sliderClassicAmpValue);
}
}
11 changes: 11 additions & 0 deletions SiriLazor.WASM/Components/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using SiriLazor.WASM
@using SiriLazor.WASM.Components
@using SiriLazor.WASM.Components.Layout
13 changes: 13 additions & 0 deletions SiriLazor.WASM/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using SiriLazor.WASM.Components;
using SiriLazor.Component.Extentions;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");


builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSiriLazor();
await builder.Build().RunAsync();
41 changes: 41 additions & 0 deletions SiriLazor.WASM/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:12657",
"sslPort": 44345
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5159",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7235;http://localhost:5159",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
17 changes: 17 additions & 0 deletions SiriLazor.WASM/SiriLazor.WASM.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SiriLazor\SiriLazor.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\css\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions SiriLazor.WASM/Style/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;500;600;700;800;900&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
Loading

0 comments on commit d96bbd3

Please sign in to comment.