UI javítás + beküldés, képméretezés
This commit is contained in:
@@ -2,11 +2,16 @@
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
|
||||
Title="Ellenőrzések">
|
||||
<Grid RowDefinitions="*,*" Padding="30,0">
|
||||
|
||||
<ScrollView Grid.Row="0">
|
||||
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
|
||||
Title="Ellenőrzések"
|
||||
BackgroundColor="#f0f0f0">
|
||||
<Grid RowDefinitions="*,*" Padding="30,30">
|
||||
<Frame Grid.Row="0"
|
||||
BorderColor="Gray"
|
||||
Padding="5"
|
||||
Margin="1"
|
||||
CornerRadius="10"
|
||||
HasShadow="True">
|
||||
<ScrollView >
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
<CollectionView x:Name="CheckList">
|
||||
@@ -29,10 +34,16 @@
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
</ScrollView>
|
||||
<ScrollView Grid.Row="1">
|
||||
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
|
||||
</ScrollView>
|
||||
</Frame>
|
||||
|
||||
<Frame Grid.Row="1"
|
||||
BorderColor="Gray"
|
||||
Padding="5"
|
||||
Margin="1"
|
||||
CornerRadius="10"
|
||||
HasShadow="True">
|
||||
<ScrollView>
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
<CollectionView x:Name="CheckListTemplate">
|
||||
@@ -55,8 +66,8 @@
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
</Frame>
|
||||
<Grid BackgroundColor="#80000000"
|
||||
IsVisible="{Binding IsLoading}"
|
||||
Grid.Row="0"
|
||||
|
||||
@@ -3,14 +3,17 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage"
|
||||
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
|
||||
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
|
||||
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
|
||||
BackgroundColor="#f0f0f0"
|
||||
Title="">
|
||||
<Grid>
|
||||
<StackLayout Padding="20">
|
||||
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Default" HorizontalOptions="Center" />
|
||||
<ProgressBar x:Name="progressBar" WidthRequest="450" HeightRequest="30" />
|
||||
<Label Text="Ellenőrzési feladatok" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||
<CollectionView x:Name="CheckPointCheckListRows"
|
||||
HeightRequest="615"
|
||||
HeightRequest="555"
|
||||
ItemsSource="{Binding CheckListRows}"
|
||||
ItemTemplate="{StaticResource AnswerTemplateSelector}">
|
||||
<CollectionView.EmptyView>
|
||||
@@ -27,8 +30,8 @@
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Text="Mentés" Command="{Binding SaveCommand}" Grid.Column="0"/>
|
||||
<Button Text="Beküldés" Command="{Binding SendCommand}" Grid.Column="2" Background="DarkRed" TextColor="Yellow"/>
|
||||
<Button x:Name="saveButton" Text="Mentés" Command="{Binding SaveCommand}" Grid.Column="0"/>
|
||||
<Button x:Name="sendButton" Text="Beküldés" Command="{Binding SendCommand}" Grid.Column="2" Background="DarkRed" TextColor="Yellow"/>
|
||||
</Grid>
|
||||
</StackLayout>
|
||||
<Grid BackgroundColor="#80000000"
|
||||
|
||||
@@ -3,7 +3,7 @@ using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||
using System.Windows.Input;
|
||||
using System.Globalization;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Pages.CheckList;
|
||||
@@ -18,7 +18,7 @@ public partial class CheckListWorkPage : ContentPage
|
||||
private UserDTO _userDTO;
|
||||
private bool _isLoading;
|
||||
|
||||
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => _isLoading;
|
||||
@@ -49,16 +49,52 @@ public partial class CheckListWorkPage : ContentPage
|
||||
private async void OnSend()
|
||||
{
|
||||
IsLoading = true;
|
||||
sendButton.IsEnabled = false;
|
||||
saveButton.IsEnabled = false;
|
||||
try
|
||||
{
|
||||
OnSave();
|
||||
await _syncService.SyncCheckListHeaderUp(_checkListHeaderId);
|
||||
|
||||
|
||||
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var result = await _syncService.SyncCheckListHeader_Up(_checkListHeaderId, (percentage, infostring) =>
|
||||
{
|
||||
// Direkt UI frissítés
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
progressBar.Progress = percentage / 100;
|
||||
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
|
||||
});
|
||||
});
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
if (Navigation.ModalStack.Count > 0)
|
||||
{
|
||||
await Shell.Current.Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await Application.Current.MainPage.DisplayAlert("Hiba", result.Error, "OK");
|
||||
}
|
||||
});
|
||||
|
||||
progressLabel.Text = "Szinkronizálás befejezve!";
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Application.Current.MainPage.DisplayAlert("Hiba", ex.Message, "OK");
|
||||
sendButton.IsEnabled = true;
|
||||
saveButton.IsEnabled = true;
|
||||
}
|
||||
IsLoading = false;
|
||||
finally
|
||||
{
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
}
|
||||
private async void OnSave()
|
||||
{
|
||||
@@ -77,7 +113,7 @@ public partial class CheckListWorkPage : ContentPage
|
||||
}
|
||||
await _checkListService.UpdateCheckListRow(checkListRow);
|
||||
}
|
||||
await LoadCheckPointCheckListRows();
|
||||
await LoadCheckPointCheckListRows();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -88,7 +124,7 @@ public partial class CheckListWorkPage : ContentPage
|
||||
IsLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
@@ -105,11 +141,28 @@ public partial class CheckListWorkPage : ContentPage
|
||||
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 ms = new MemoryStream();
|
||||
await stream.CopyToAsync(ms);
|
||||
byte[] photoBytes = ms.ToArray();
|
||||
checkListRowDTO.Photo = photoBytes;
|
||||
using var originalBitmap = SKBitmap.Decode(stream);
|
||||
|
||||
int newWidth = 500;
|
||||
int newHeight = (int)(originalBitmap.Height * ((double)newWidth / originalBitmap.Width));
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(newWidth, newHeight));
|
||||
using var canvas = surface.Canvas;
|
||||
|
||||
var sourceRect = new SKRect(0, 0, originalBitmap.Width, originalBitmap.Height);
|
||||
var destRect = new SKRect(0, 0, newWidth, newHeight);
|
||||
canvas.DrawBitmap(originalBitmap, sourceRect, destRect);
|
||||
|
||||
using var resizedImage = surface.Snapshot();
|
||||
using var data = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 100);
|
||||
|
||||
checkListRowDTO.Photo = data.ToArray();
|
||||
|
||||
await _checkListService.UpdateCheckListRow(checkListRowDTO);
|
||||
await LoadCheckPointCheckListRows();
|
||||
@@ -148,6 +201,7 @@ public partial class CheckListWorkPage : ContentPage
|
||||
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
}
|
||||
public class BindableRadioButton : RadioButton
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user