Parcourir la source

removed unused picture loading code

master
Flo Smilari il y a 4 ans
Parent
révision
0bc6b9b607

+ 1
- 46
Pages/CaritasServiceFundVeloKeyDataPage.razor Voir le fichier

@@ -91,7 +91,7 @@
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address" ></MatStringField>
<MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></MatStringField>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@getPlaceLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.City"></MatStringField>
@@ -251,10 +251,6 @@
loading = true;
StateHasChanged();
try {
//string text = new(await JS.InvokeAsync<string>("LoadFile", e));
//imgUrl = text;
using (var stream = imgFile.OpenReadStream(MAX_FILE_SIZE)) {
await stream.ReadAsync(buffer);
imgUrl = $"data:{imgFile.ContentType};base64,{Convert.ToBase64String(buffer)}";
@@ -277,45 +273,4 @@
}
}
//public void Show(MatToastType type, string title, string message, string icon = "") {
// Toaster.Add(message, type, title, icon);
//}
//private async Task OnGatheringPicture(InputFileChangeEventArgs e) {
// //public async Task ReadFile() {
// //foreach (var file in await fileReaderService.CreateReference(inputTypeFileElement).EnumerateFilesAsync()) {
// //IFileInfo fileInfo = await file.ReadFileInfoAsync();
// IBrowserFile imgFile = e.File;
// //IFileInfo fileInfo = await imgFile.ReadFileInfoAsync();
// if (fileInfo.Size > MAX_FILE_SIZE) {
// Show(MatToastType.Danger, i18n.GetString("Error.PhotoOrPictureToBig.Title"), i18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024)));
// } else {
// imgUrl = string.Empty;
// loading = true;
// StateHasChanged();
// byte[] buffer = new byte[fileInfo.Size];
// await using (Stream stream = await imgFile.OpenReadAsync()) {
// buffer = new Byte[stream.Length];
// await stream.ReadAsync(buffer);
// }
// using (MemoryStream memoryStream = await imgFile.CreateMemoryStreamAsync(4096)) {
// memoryStream.Read(buffer);
// string imageType = fileInfo.Type;
// loading = false;
// imgUrl = $"data:{imageType};base64,{Convert.ToBase64String(buffer)}";
// StateHasChanged();
// }
// //}
// }
//}
}

+ 10
- 10
Pages/CaritasServiceFundVeloKeyDataPage.razor.cs Voir le fichier

@@ -1,12 +1,12 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Threading.Tasks;
using FisSst.BlazorMaps;
using BlazorGeolocation;
using Microsoft.Extensions.Localization;
using CaritasPWA.Shared.ResourceFiles;
using BlazorGeolocation;
using CaritasPWA.Shared.Models;
using CaritasPWA.Shared.ResourceFiles;
using CaritasPWA.Shared.Services;
using FisSst.BlazorMaps;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System;
using System.Threading.Tasks;
namespace CaritasPWA.Pages {
public partial class CaritasServiceFundVeloKeyDataPageBase : ComponentBase {
@@ -105,10 +105,10 @@ namespace CaritasPWA.Pages {
private async Task OnMouseMapClicked(MouseEvent mouseEvent) {
await AddBicycleMarkerOnClickPosition(mouseEvent);
this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat;
this.bicycleGeoPosition.Longitude = mouseEvent.LatLng.Lng;
NominatimReverseAddress addressDto = await nominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng);
if (addressDto != null) {
this.bicycleGeoPosition.Address = getFormattedAddressStreet(addressDto);
@@ -116,7 +116,7 @@ namespace CaritasPWA.Pages {
} else {
Show(MatBlazor.MatToastType.Warning, I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg"));
}
StateHasChanged();
}

+ 1
- 1
Program.cs Voir le fichier

@@ -1,7 +1,7 @@
using BlazorGeolocation;
using CaritasPWA.Shared;
using CaritasPWA.Shared.Services;
using FisSst.BlazorMaps.DependencyInjection;
using BlazorGeolocation;
using MatBlazor;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;

+ 1
- 1
Shared/Models/ColorItem.cs Voir le fichier

@@ -6,7 +6,7 @@
public string Name { get; set; }
public string RGB { get; set; }
public ColorItem() { }
public ColorItem() { }
public ColorItem(int index, string name, string rgb) {
Index = index;

+ 1
- 6
Shared/Models/OSM/BicycleGeoPosition.cs Voir le fichier

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CaritasPWA.Shared.Models {
namespace CaritasPWA.Shared.Models {
public class BicycleGeoPosition {
public BicycleGeoPosition() {

+ 1
- 7
Shared/Models/OSM/NominatimReverseAddress.cs Voir le fichier

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Json.Net;
namespace CaritasPWA.Shared.Models {
namespace CaritasPWA.Shared.Models {
public class NominatimReverseAddress {
public string place_id;

+ 4
- 6
Shared/Services/NominatimService.cs Voir le fichier

@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using CaritasPWA.Shared.Models;
using Json.Net;
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using CaritasPWA.Shared.Models;
using Json.Net;
namespace CaritasPWA.Shared.Services {
public class NominatimService {
@@ -19,7 +17,7 @@ namespace CaritasPWA.Shared.Services {
};
try {
HttpResponseMessage httpResult = await httpClient.GetAsync(string.Format("reverse?format=json&lat={0}&lon={1}", lat, lng));
if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) {
NominatimReverseAddress addressDto = JsonNet.Deserialize<NominatimReverseAddress>(await httpResult.Content.ReadAsStringAsync());
return addressDto;

+ 5
- 1
wwwroot/css/app.css Voir le fichier

@@ -1,4 +1,8 @@
:root {
body {
overscroll-behavior-y: contain;
}
:root {
--caritas-red: #db001b;
--caritas-red-accent: #FF4081;
--caritas-red-dark: #d0001a;

+ 0
- 14
wwwroot/image-loader.js Voir le fichier

@@ -1,14 +0,0 @@
const fileInput = document.getElementById('file-999');
fileInput.addEventListener('change', (e) => LoadFiles(e.target.files));
function LoadFiles(fileList) {
let file = null;
for (let i = 0; i < fileList.length;) {
if (fileList[i].type.match(/^image\//)) {
file = fileList[i];
break;
}
}
}

+ 2
- 32
wwwroot/index.html Voir le fichier

@@ -3,7 +3,7 @@
<head>
<title>Caritas PWA</title>
<base href="/FundveloApp/" />
<base href="/" />
<meta charset="utf-8" />
<meta name="description" content="Caritas PWA, developed by INTEGRATE AG, Switzerland">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
@@ -60,37 +60,7 @@
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin="">
</script>
<script>
window.LoadFile = (evt) => {
var tgt = evt.target || window.event.srcElement,
files = tgt.files;
let file = files[0];
file64 = URL.createObjectURL(file);
//const reader = new FileReader();
//reader.onloadend = function () {
// file64 = reader.result;
//}
//reader.addEventListener("load", function () {
// file64 = reader.result;
//}, false);
//if (file) {
// // reader.readAsDataURL(file);
// read(reader);
//}
return file64;
}
async function read(reader) {
await reader.readAsDataURL(file);
}
</script>
</body>

Chargement…
Annuler
Enregistrer