-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web API functional Blazor web app mostly functional
- Loading branch information
1 parent
b9697ea
commit c5f29f5
Showing
72 changed files
with
2,711 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.3" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" /> | ||
<ProjectReference Include="..\MPRSGxZ\MPRSGxZ.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MPRSGxZ\MPRSGxZ.csproj" /> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="Pages\Index.razor" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using AmpAPI.Settings; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace AmpAPI.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class ConnectionController : ControllerBase | ||
{ | ||
private AmplifierStackSettings Settings; | ||
|
||
public ConnectionController(IOptionsMonitor<AmplifierStackSettings> Settings) | ||
{ | ||
this.Settings = Settings.CurrentValue; | ||
} | ||
|
||
[HttpGet] | ||
public ConnectionSettings Get() | ||
{ | ||
return Settings.Connection; | ||
} | ||
|
||
[NonAction] | ||
[HttpPost] | ||
public void Post([FromBody] AmplifierStackSettings value) | ||
{ | ||
} | ||
|
||
[HttpPut] | ||
public void Put([FromBody] AmplifierStackSettings value) | ||
{ | ||
} | ||
|
||
[HttpDelete] | ||
public void Delete() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@page "/" | ||
@namespace AmpAPI.Pages | ||
@using Microsoft.AspNetCore.SignalR.Client | ||
@using AmpAPI.Models | ||
@inject NavigationManager NavigationManager | ||
@implements IAsyncDisposable | ||
|
||
<ul> | ||
<li>Amp ID - @CurrentZone.AmpID</li> | ||
<li>Zone ID - @CurrentZone.ZoneID</li> | ||
<li>Source - @CurrentZone.Source</li> | ||
<li>Volume - @CurrentZone.Volume</li> | ||
</ul> | ||
|
||
@code { | ||
private HubConnection? hubConnection; | ||
private ZoneModel CurrentZone; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
hubConnection = new HubConnectionBuilder() | ||
.WithUrl(NavigationManager.ToAbsoluteUri("/amphub")) | ||
.Build(); | ||
|
||
hubConnection.On<ZoneModel>("ReceiveZoneUpdate", (Zone) => | ||
{ | ||
CurrentZone = Zone; | ||
StateHasChanged(); | ||
}); | ||
|
||
await hubConnection.StartAsync(); | ||
} | ||
|
||
private async Task Send() | ||
{ | ||
if (hubConnection is not null) | ||
{ | ||
await hubConnection.SendAsync("SendZoneChange", CurrentZone); | ||
} | ||
} | ||
|
||
public bool IsConnected => hubConnection?.State == HubConnectionState.Connected; | ||
|
||
public async ValueTask DisposeAsync() | ||
{ | ||
if (hubConnection is not null) | ||
{ | ||
await hubConnection.DisposeAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.