launch screen spinning animation

This commit is contained in:
Andy Pack 2023-01-29 21:26:39 +00:00
parent aa133db10f
commit 1a4bdc067b
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
5 changed files with 99 additions and 7 deletions

View File

@ -6,7 +6,7 @@
@inject HubManager hubManager;
@inject StartPageManager startManager;
<h1>Loading...</h1>
<img class="spinning centered-spinning" src="/appicon.png" />
@code {
protected async override Task OnInitializedAsync()

View File

@ -0,0 +1,72 @@
body {
}
.centered-spinning {
position: fixed;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
}
.spinning {
width: 100px;
height: 100px;
background: #f00;
-webkit-animation-name: spin;
-webkit-animation-duration: 1000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 1000ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 1000ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
animation-name: spin;
animation-duration: 1000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@-ms-keyframes spin {
from {
-ms-transform: rotate(0deg);
}
to {
-ms-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -70,7 +70,6 @@
<MauiSplashScreen Include="Resources\Splash\splash.png" Color="#2b2b2b" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
@ -99,11 +98,13 @@
<None Remove="Microsoft.AspNetCore.Components.Forms" />
<None Remove="Radzen.Blazor" />
<None Remove="Extensions\" />
<None Remove="Resources\Images\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
<Folder Include="Models\" />
<Folder Include="Extensions\" />
<Folder Include="Resources\Images\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Selector\Selector.csproj" />
@ -111,6 +112,7 @@
</ItemGroup>
<ItemGroup>
<Content Remove="nlog.config" />
<Content Remove="wwwroot\appicon.png" />
</ItemGroup>
<ItemGroup>
<!-- <None Include="nlog.config">
@ -134,5 +136,8 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</BundleResource>
<BundleResource Include="wwwroot\appicon.png">
<Color>#2b2b2b</Color>
</BundleResource>
</ItemGroup>
</Project>

View File

@ -22,22 +22,37 @@ public class HubManager
public async Task EnsureConnected()
{
var nowTask = Task.CompletedTask;
var pastTask = Task.CompletedTask;
if (nowClient.State == HubConnectionState.Disconnected)
{
logger.LogInformation("Starting now hub connection");
await nowClient.StartAsync();
nowCache.BindClient();
await nowClient.OnConnected();
nowTask = nowClient.StartAsync().ContinueWith(async x =>
{
if (x.IsCompletedSuccessfully)
{
nowCache.BindClient();
await nowClient.OnConnected();
}
});
}
if (pastClient.State == HubConnectionState.Disconnected)
{
logger.LogInformation("Starting past hub connection");
await pastClient.StartAsync();
await pastClient.OnConnected();
pastTask = pastClient.StartAsync().ContinueWith(async x =>
{
if (x.IsCompletedSuccessfully)
{
await pastClient.OnConnected();
}
});
}
await Task.WhenAll(nowTask, pastTask);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB