MOBILE BugFix
This commit is contained in:
@@ -29,14 +29,14 @@ namespace WorkFlowCheck.MAUI
|
|||||||
_dbContext.Database.EnsureDeleted(); // Adatbázis törlése
|
_dbContext.Database.EnsureDeleted(); // Adatbázis törlése
|
||||||
_dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása
|
_dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása
|
||||||
|
|
||||||
StartBackgroundTask();
|
//StartBackgroundTask();
|
||||||
MainPage = new AppShell();
|
MainPage = new AppShell();
|
||||||
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
|
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
|
||||||
|
|
||||||
}
|
}
|
||||||
protected async override void OnResume()
|
protected async override void OnResume()
|
||||||
{
|
{
|
||||||
StartBackgroundTask();
|
//StartBackgroundTask();
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
||||||
if (isLogged == null)
|
if (isLogged == null)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace WorkFlowCheck.MAUI.Helper
|
|||||||
public static string ProgramVersion = "v1.1.030";
|
public static string ProgramVersion = "v1.1.030";
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static string ApiBaseUrl = $"http://10.0.2.2:59027/";
|
//public static string ApiBaseUrl = $"http://10.0.2.2:59027/";
|
||||||
//public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
||||||
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
Source="{Binding Photo, Converter={StaticResource ByteArrayToImageSourceConverter}}" />
|
Source="{Binding Photo, Converter={StaticResource ByteArrayToImageSourceConverter}}" />
|
||||||
<Button Text="📷" Grid.Column="1"
|
<Button Text="📷" Grid.Column="1"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
Command="{Binding BindingContext.CreatePhoto, Source={x:Reference CheckPointCheckListRows}}"
|
Command="{Binding BindingContext.TakePhoto, Source={x:Reference CheckPointCheckListRows}}"
|
||||||
CommandParameter="{Binding .}" />
|
CommandParameter="{Binding .}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ObservableCollection<CheckListRowDTO> CheckListRows { get; set; } = new ObservableCollection<CheckListRowDTO>();
|
public ObservableCollection<CheckListRowDTO> CheckListRows { get; set; } = new ObservableCollection<CheckListRowDTO>();
|
||||||
public ICommand CreatePhoto { get; set; }
|
public ICommand TakePhoto { get; set; }
|
||||||
public ICommand SendCommand { get; set; }
|
public ICommand SendCommand { get; set; }
|
||||||
public ICommand SaveCommand { get; set; }
|
public ICommand SaveCommand { get; set; }
|
||||||
|
|
||||||
@@ -146,29 +146,15 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
BindingContext = this;
|
BindingContext = this;
|
||||||
await SetInfo();
|
await SetInfo();
|
||||||
CreatePhoto = new Command<CheckListRowDTO>(OnTakePhoto);
|
TakePhoto = new Command<CheckListRowDTO>(OnTakePhoto);
|
||||||
await LoadCheckPointCheckListRows();
|
await LoadCheckPointCheckListRows();
|
||||||
|
|
||||||
}
|
}
|
||||||
private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
|
private async Task<byte[]> ResizePicture(FileResult? photo, int newWidth)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
if (MediaPicker.IsCaptureSupported)
|
|
||||||
{
|
|
||||||
await OnSave();
|
|
||||||
var photo = await MediaPicker.CapturePhotoAsync();
|
|
||||||
if (photo != null)
|
|
||||||
{
|
|
||||||
//using var stream = await photo.OpenReadAsync();
|
|
||||||
//using var ms = new MemoryStream();
|
|
||||||
//await stream.CopyToAsync(ms);
|
|
||||||
//byte[] photoBytes = ms.ToArray();
|
|
||||||
|
|
||||||
using var stream = await photo.OpenReadAsync();
|
using var stream = await photo.OpenReadAsync();
|
||||||
using var originalBitmap = SKBitmap.Decode(stream);
|
using var originalBitmap = SKBitmap.Decode(stream);
|
||||||
|
|
||||||
int newWidth = 500;
|
|
||||||
int newHeight = (int)(originalBitmap.Height * ((double)newWidth / originalBitmap.Width));
|
int newHeight = (int)(originalBitmap.Height * ((double)newWidth / originalBitmap.Width));
|
||||||
|
|
||||||
using var surface = SKSurface.Create(new SKImageInfo(newWidth, newHeight));
|
using var surface = SKSurface.Create(new SKImageInfo(newWidth, newHeight));
|
||||||
@@ -181,7 +167,19 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
using var resizedImage = surface.Snapshot();
|
using var resizedImage = surface.Snapshot();
|
||||||
using var data = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 100);
|
using var data = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 100);
|
||||||
|
|
||||||
checkListRowDTO.Photo = data.ToArray();
|
return data.ToArray();
|
||||||
|
}
|
||||||
|
private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (MediaPicker.IsCaptureSupported)
|
||||||
|
{
|
||||||
|
//await OnSave();
|
||||||
|
var photo = await MediaPicker.CapturePhotoAsync();
|
||||||
|
if (photo != null)
|
||||||
|
{
|
||||||
|
checkListRowDTO.Photo = await ResizePicture(photo, 500);
|
||||||
checkListRowDTO.Answer = "Igen";
|
checkListRowDTO.Answer = "Igen";
|
||||||
|
|
||||||
await _checkListService.UpdateCheckListRow(checkListRowDTO);
|
await _checkListService.UpdateCheckListRow(checkListRowDTO);
|
||||||
|
|||||||
Reference in New Issue
Block a user