瀏覽代碼

File loader and layout improvements

master
Flo Smilari 4 年之前
父節點
當前提交
4569f02caa

二進制
.vs/CaritasPWA/DesignTimeBuild/.dtbcache.v2 查看文件


+ 0
- 997
.vs/CaritasPWA/config/applicationhost.config
文件差異過大導致無法顯示
查看文件


二進制
.vs/CaritasPWA/v16/.suo 查看文件


+ 69
- 69
CaritasPWA.csproj 查看文件

<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>true</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>true</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\css\united\_bootswatch.css" />
</ItemGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\css\united\_bootswatch.css" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BlazorAnimate" Version="3.0.0" />
<PackageReference Include="BlazorColorPicker" Version="1.2.0" />
<PackageReference Include="BuildWebCompiler" Version="1.12.405" />
<PackageReference Include="MatBlazor" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.7" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
<PackageReference Include="Tewr.Blazor.FileReader.Wasm" Version="0.11.19128" />
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BlazorAnimate" Version="3.0.0" />
<PackageReference Include="BlazorColorPicker" Version="1.2.0" />
<PackageReference Include="BuildWebCompiler" Version="1.12.405" />
<PackageReference Include="MatBlazor" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.7" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
<PackageReference Include="Tewr.Blazor.FileReader" Version="3.1.0.21158" />
<PackageReference Include="Tewr.Blazor.FileReader.Wasm" Version="0.11.19128" />
</ItemGroup>
<ItemGroup>
<Compile Update="Shared\ResourceFiles\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.de.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.fr.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.it.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Shared\ResourceFiles\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.de.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.fr.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.it.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Shared\ResourceFiles\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

+ 59
- 22
Pages/CaritasServiceFundVeloKeyDataPage.razor 查看文件

@page "/fundvelo/keydata/{FromRoute}" @page "/fundvelo/keydata/{FromRoute}"
@using CaritasPWA.Shared.Models; @using CaritasPWA.Shared.Models;
@using CaritasPWA.Shared.Services; @using CaritasPWA.Shared.Services;
@using System.Globalization; @using System.Globalization;
@inject IStringLocalizer<Resources> i18n @inject IStringLocalizer<Resources> i18n
@inject PageHistoryManager PageHistoryManager @inject PageHistoryManager PageHistoryManager
@inject MasterDataService MasterDataService @inject MasterDataService MasterDataService
@inject IMatToaster Toaster
<div class="row px-3 h-100"> <div class="row px-3 h-100">
<div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em">
@if ("Found".Equals(FromRoute)) {
<h1>@i18n["FoundBike"]</h1>
} else {
<h1>@i18n["MissingBike"]</h1>
}
@if ("Found".Equals(FromRoute))
{
<h1>@i18n["FoundBike"]</h1>
}
else
{
<h1>@i18n["MissingBike"]</h1>
}
</div> </div>
<div class="row no-gutters align-items-center justify-content-center w-100"> <div class="row no-gutters align-items-center justify-content-center w-100">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-1 justify-content-center" style="text-align: center"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-1 justify-content-center" style="text-align: center">
<MatIconButton Class="mat-icon-large" Icon="photo_camera" /> <MatIconButton Class="mat-icon-large" Icon="photo_camera" />
<div style="margin-top:1rem"> <div style="margin-top:1rem">
<input id="file" type="file" name="file" accept="image/x-png,image/jpeg,image/gif" class="inputFile" />
<label for="file">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 21 21">
<path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z" />
</svg>
</label>
<InputFile id="file" type="file" name="file" accept="image/x-png,image/jpeg,image/gif" class="inputFile" OnChange="@OnFileSelection" />
<MatRipple class="inputfile-mat-ripple" Color="@MatRippleColor.Default">
<label for="file">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 21 21">
<path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z" />
</svg>
</label>
</MatRipple>
</div> </div>
</div> </div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-3"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-3">
<div> <div>
<MatCard Class="demo-mat-card"> <MatCard Class="demo-mat-card">
<MatCardContent> <MatCardContent>
<MatCardMedia Square="true" Class="" />
<MatCardMedia Square="true" Class="" ImageUrl="@imgUrl" />
</MatCardContent> </MatCardContent>
</MatCard> </MatCard>
</div> </div>
[Parameter(CaptureUnmatchedValues = true)] [Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string, object> Attributes { get; set; } public IDictionary<string, object> Attributes { get; set; }
private static long MAX_FILE_SIZE = 4000000;
private ColorItem selectedColor; private ColorItem selectedColor;
private BicycleType selectedBcType; private BicycleType selectedBcType;
private string imgUrl = string.Empty; private string imgUrl = string.Empty;
base.OnInitialized(); base.OnInitialized();
} }
private async Task GetColors() {
await InvokeAsync(async () => {
private async Task GetColors()
{
await InvokeAsync(async () =>
{
await MasterDataService.GetColors(); await MasterDataService.GetColors();
StateHasChanged(); StateHasChanged();
}); });
} }
private async Task GetBicycleTypes() {
await InvokeAsync(async () => {
private async Task GetBicycleTypes()
{
await InvokeAsync(async () =>
{
await MasterDataService.GetBicycleTypes(); await MasterDataService.GetBicycleTypes();
StateHasChanged(); StateHasChanged();
}); });
} }
private ColorItem[] Colors {
private ColorItem[] Colors
{
get => MasterDataService.Colors; get => MasterDataService.Colors;
} }
private BicycleType[] BicycleTypes {
private BicycleType[] BicycleTypes
{
get => MasterDataService.BicycleTypes; get => MasterDataService.BicycleTypes;
} }
private void Next() {
private void Next()
{
NavigationManager.NavigateTo("fundvelo/account/" + @FromRoute); NavigationManager.NavigateTo("fundvelo/account/" + @FromRoute);
} }
private void Cancel() {
private void Cancel()
{
NavigationManager.NavigateTo("caritas_services"); NavigationManager.NavigateTo("caritas_services");
} }
private string getAddressLbl() {
private string getAddressLbl()
{
return i18n.GetString("Address") + " (" + getPlaceLbl() + ")"; return i18n.GetString("Address") + " (" + getPlaceLbl() + ")";
} }
private string getPlaceLbl() {
private string getPlaceLbl()
{
return @FromRoute == "Found" ? i18n.GetString("PlaceOfDiscovery") : i18n.GetString("PlaceOfLoss"); return @FromRoute == "Found" ? i18n.GetString("PlaceOfDiscovery") : i18n.GetString("PlaceOfLoss");
} }
private async Task OnFileSelection(InputFileChangeEventArgs e) {
IBrowserFile imgFile = e.File;
var buffers = new byte[imgFile.Size];
try {
await imgFile.OpenReadStream(MAX_FILE_SIZE).ReadAsync(buffers);
string imageType = imgFile.ContentType;
imgUrl = $"data:{imageType};base64,{Convert.ToBase64String(buffers)}";
} catch (Exception ex) {
Show(MatToastType.Danger, i18n.GetString("Error.PhotoOrPictureToBig.Title"), i18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE/1000));
}
}
public void Show(MatToastType type, string title, string message, string icon = "") {
Toaster.Add(message, type, title, icon);
}
} }

+ 17
- 1
Program.cs 查看文件

using MatBlazor; using MatBlazor;
using CaritasPWA.Shared; using CaritasPWA.Shared;
using CaritasPWA.Shared.Services; using CaritasPWA.Shared.Services;
using Tewr.Blazor.FileReader;
using MatBlazor;
namespace CaritasPWA { namespace CaritasPWA {
builder.RootComponents.Add<App>("app"); builder.RootComponents.Add<App>("app");
builder.Services.AddMatBlazor(); builder.Services.AddMatBlazor();
// builder.Services.AddFileReaderService(options => options.UseWasmSharedBuffer = true);
builder.Services.AddFileReaderService(options => options.UseWasmSharedBuffer = true);
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSingleton<ILFBicycleRest, LFBicycleRest>(); builder.Services.AddSingleton<ILFBicycleRest, LFBicycleRest>();
builder.Services.AddSingleton<AppState>(); builder.Services.AddSingleton<AppState>();
builder.Services.AddScoped<MasterDataService>(); builder.Services.AddScoped<MasterDataService>();
builder.Services.AddLocalization(); builder.Services.AddLocalization();
builder.Services.AddMatToaster(config => {
config.Position = MatToastPosition.BottomCenter;
config.PreventDuplicates = true;
config.NewestOnTop = true;
config.MaxDisplayedToasts = 5;
config.ShowCloseButton = true;
config.ShowProgressBar = true;
config.MaximumOpacity = 100;
config.VisibleStateDuration = 5000;
config.ShowTransitionDuration = 300;
config.HideTransitionDuration = 150;
});
await builder.Build().RunAsync(); await builder.Build().RunAsync();
} }
} }

+ 2
- 0
Properties/launchSettings.json 查看文件

"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"nativeDebugging": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "https://localhost:5001;http://localhost:5000",
"jsWebView2Debugging": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
} }
} }

+ 5
- 3
Shared/MainLayout.razor 查看文件

<NavMenu /> <NavMenu />
<div class="main" style="height:90vh"> <div class="main" style="height:90vh">
<div class="content px-4 h-100">
@Body
</div>
<div class="content px-4 h-100">
@Body
</div>
</div> </div>
<MatToastContainer />

+ 18
- 0
Shared/ResourceFiles/Resources.Designer.cs 查看文件

} }
} }
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die The size of the selected picture or taken photo exceeds the max. allowed size of {0:d} KB. ähnelt.
/// </summary>
public static string Error_PhotoOrPictureToBig_Msg {
get {
return ResourceManager.GetString("Error.PhotoOrPictureToBig.Msg", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Size of picture to big! ähnelt.
/// </summary>
public static string Error_PhotoOrPictureToBig_Title {
get {
return ResourceManager.GetString("Error.PhotoOrPictureToBig.Title", resourceCulture);
}
}
/// <summary> /// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Finished ähnelt. /// Sucht eine lokalisierte Zeichenfolge, die Finished ähnelt.
/// </summary> /// </summary>

+ 6
- 0
Shared/ResourceFiles/Resources.de.resx 查看文件

<data name="DevelopedBy" xml:space="preserve"> <data name="DevelopedBy" xml:space="preserve">
<value>Entwickelt durch</value> <value>Entwickelt durch</value>
</data> </data>
<data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve">
<value>Die Grösse des gewählten Bildes oder Fotos darf {0:d} KB nicht überschreiten!</value>
</data>
<data name="Error.PhotoOrPictureToBig.Title" xml:space="preserve">
<value>Bilddatei zu gross!</value>
</data>
<data name="Finished" xml:space="preserve"> <data name="Finished" xml:space="preserve">
<value>Fertig</value> <value>Fertig</value>
</data> </data>

+ 6
- 0
Shared/ResourceFiles/Resources.fr.resx 查看文件

<data name="DevelopedBy" xml:space="preserve"> <data name="DevelopedBy" xml:space="preserve">
<value>Développé par</value> <value>Développé par</value>
</data> </data>
<data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve">
<value>The size of the selected picture or taken photo exceeds the max. allowed size of {0:d} KB.</value>
</data>
<data name="Error.PhotoOrPictureToBig.Title" xml:space="preserve">
<value>Size of picture to big!</value>
</data>
<data name="Finished" xml:space="preserve"> <data name="Finished" xml:space="preserve">
<value>Terminé</value> <value>Terminé</value>
</data> </data>

+ 6
- 0
Shared/ResourceFiles/Resources.it.resx 查看文件

<data name="DevelopedBy" xml:space="preserve"> <data name="DevelopedBy" xml:space="preserve">
<value>Sviluppata da</value> <value>Sviluppata da</value>
</data> </data>
<data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve">
<value>The size of the selected picture or taken photo exceeds the max. allowed size of {0:d} KB.</value>
</data>
<data name="Error.PhotoOrPictureToBig.Title" xml:space="preserve">
<value>Size of picture to big!</value>
</data>
<data name="Finished" xml:space="preserve"> <data name="Finished" xml:space="preserve">
<value>Termina</value> <value>Termina</value>
</data> </data>

+ 6
- 0
Shared/ResourceFiles/Resources.resx 查看文件

<data name="DevelopedBy" xml:space="preserve"> <data name="DevelopedBy" xml:space="preserve">
<value>Developed by</value> <value>Developed by</value>
</data> </data>
<data name="Error.PhotoOrPictureToBig.Msg" xml:space="preserve">
<value>The size of the selected picture or taken photo exceeds the max. allowed size of {0:d} KB.</value>
</data>
<data name="Error.PhotoOrPictureToBig.Title" xml:space="preserve">
<value>Size of picture to big!</value>
</data>
<data name="Finished" xml:space="preserve"> <data name="Finished" xml:space="preserve">
<value>Finished</value> <value>Finished</value>
</data> </data>

+ 2
- 1
_Imports.razor 查看文件

@using CaritasPWA.Shared.ResourceFiles @using CaritasPWA.Shared.ResourceFiles
@using MatBlazor @using MatBlazor
@using BlazorAnimate @using BlazorAnimate
@using BlazorColorPicker
@using BlazorColorPicker
@using Tewr.Blazor.FileReader

+ 12
- 13
wwwroot/css/app.css 查看文件

cursor: pointer; cursor: pointer;
width: 100%; width: 100%;
text-align: center; text-align: center;
/*padding: 1rem 0;*/
}
.inputFile:focus + label,
.inputFile + label:hover {
/*background-color: red;*/
width: 44px;
height: 44px;
background: rgba(0, 0, 0, 0.2);
-moz-border-radius: 22px;
-webkit-border-radius: 22px;
border-radius: 22px;
}
}
.inputfile-mat-ripple {
width: 48px;
height: 48px;
-moz-border-radius: 24px;
-webkit-border-radius: 24px;
border-radius: 24px;
align-items: center;
justify-content: center;
display: inline-flex;
}
.btn-primary { .btn-primary {
color: #fff; color: #fff;

+ 1
- 1
wwwroot/service-worker.js 查看文件

'_content/BlazorAnimate/aos.css', '_content/BlazorAnimate/aos.css',
'_framework/blazor.webassembly.js', '_framework/blazor.webassembly.js',
'_framework/blazor.boot.json', '_framework/blazor.boot.json',
'_framework/wasm/dotnet.3.2.0.js',
'_framework/wasm/dotnet.5.0.7.js',
'https://fonts.googleapis.com/css?family=Roboto:300,400,500', 'https://fonts.googleapis.com/css?family=Roboto:300,400,500',
'https://fonts.googleapis.com/icon?family=Material+Icons', 'https://fonts.googleapis.com/icon?family=Material+Icons',
'https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;700&display=swap', 'https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;700&display=swap',

Loading…
取消
儲存