INIT GITEA

This commit is contained in:
2026-09-12 18:19:29 +02:00
parent b2faeb2986
commit 02ba8d4fe5
405 changed files with 125279 additions and 125267 deletions
+41 -41
View File
@@ -1,42 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BasePage">
<!--<Shell.TitleView>
<Grid BackgroundColor="Blue" Padding="2" VerticalOptions="Center">
--><!-- Bal oldali cím --><!--
<Label Text="MK001"
TextColor="White"
FontSize="18"
VerticalOptions="Center"
HorizontalOptions="Start" />
--><!-- Jobb oldali keret --><!--
<Frame BackgroundColor="White"
CornerRadius="10"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label Text="Custom Frame" TextColor="Black"/>
</Frame>
</Grid>
</Shell.TitleView>-->
<Grid x:Name="MainGrid">
<!-- A tartalom helye -->
<ContentPresenter x:Name="MainContent"
VerticalOptions="Fill"
HorizontalOptions="Fill"/>
<!-- Jobb alsó sarokban a szöveg -->
<Label Text="Verzió 1.0.0"
TextColor="Black"
FontSize="8"
HorizontalOptions="End"
VerticalOptions="End"
Margin="5"
Opacity="0.5"
/>
</Grid>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BasePage">
<!--<Shell.TitleView>
<Grid BackgroundColor="Blue" Padding="2" VerticalOptions="Center">
--><!-- Bal oldali cím --><!--
<Label Text="MK001"
TextColor="White"
FontSize="18"
VerticalOptions="Center"
HorizontalOptions="Start" />
--><!-- Jobb oldali keret --><!--
<Frame BackgroundColor="White"
CornerRadius="10"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label Text="Custom Frame" TextColor="Black"/>
</Frame>
</Grid>
</Shell.TitleView>-->
<Grid x:Name="MainGrid">
<!-- A tartalom helye -->
<ContentPresenter x:Name="MainContent"
VerticalOptions="Fill"
HorizontalOptions="Fill"/>
<!-- Jobb alsó sarokban a szöveg -->
<Label Text="Verzió 1.0.0"
TextColor="Black"
FontSize="8"
HorizontalOptions="End"
VerticalOptions="End"
Margin="5"
Opacity="0.5"
/>
</Grid>
</ContentPage>
+13 -13
View File
@@ -1,14 +1,14 @@
namespace WorkFlowCheck.MAUI.Pages;
public partial class BasePage : ContentPage
{
public BasePage()
{
InitializeComponent();
}
protected void SetContent(View content)
{
MainGrid.Children.Add(content);
}
namespace WorkFlowCheck.MAUI.Pages;
public partial class BasePage : ContentPage
{
public BasePage()
{
InitializeComponent();
}
protected void SetContent(View content)
{
MainGrid.Children.Add(content);
}
}
@@ -1,74 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.BaseStockPage"
BackgroundColor="#f0f0f0"
Title="Törzs adatok">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Törzs adatok"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<VerticalStackLayout Margin="50,50,50,10">
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True" CornerRadius="10">
<VerticalStackLayout Margin="10,10,10,0">
<Button
x:Name="ButtonGetCheckPoints"
Margin="0,0,0,10"
Text="Ellenőrzési pontok"
SemanticProperties.Hint="Ellenőrzési pontok"
Clicked="OnButtonGetCheckPoints"
HorizontalOptions="Fill" />
<!--<Button
x:Name="ButtonGetEquipments"
Margin="0,0,0,10"
Text="Berendezések"
SemanticProperties.Hint="Berendezések"
Clicked="OnButtonGetEquipments"
HorizontalOptions="Fill" />-->
<!--<Button
x:Name="ButtonGetLocations"
Margin="0,0,0,10"
Text="Lokációk"
SemanticProperties.Hint="Lokációk"
Clicked="OnButtonGetLocations"
HorizontalOptions="Fill" />-->
<Button
x:Name="ButtonGetUsers"
Margin="0,0,0,10"
Text="Felhasználók"
SemanticProperties.Hint="Felhasználók"
Clicked="OnButtonGetUsers"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</Frame>
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.BaseStockPage"
BackgroundColor="#f0f0f0"
Title="Törzs adatok">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Törzs adatok"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<VerticalStackLayout Margin="50,50,50,10">
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True" CornerRadius="10">
<VerticalStackLayout Margin="10,10,10,0">
<Button
x:Name="ButtonGetCheckPoints"
Margin="0,0,0,10"
Text="Ellenőrzési pontok"
SemanticProperties.Hint="Ellenőrzési pontok"
Clicked="OnButtonGetCheckPoints"
HorizontalOptions="Fill" />
<!--<Button
x:Name="ButtonGetEquipments"
Margin="0,0,0,10"
Text="Berendezések"
SemanticProperties.Hint="Berendezések"
Clicked="OnButtonGetEquipments"
HorizontalOptions="Fill" />-->
<!--<Button
x:Name="ButtonGetLocations"
Margin="0,0,0,10"
Text="Lokációk"
SemanticProperties.Hint="Lokációk"
Clicked="OnButtonGetLocations"
HorizontalOptions="Fill" />-->
<Button
x:Name="ButtonGetUsers"
Margin="0,0,0,10"
Text="Felhasználók"
SemanticProperties.Hint="Felhasználók"
Clicked="OnButtonGetUsers"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</Frame>
</VerticalStackLayout>
</ContentPage>
@@ -1,56 +1,56 @@
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.Security;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class BaseStockPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public BaseStockPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//CheckPointsPage");
await Navigation.PushAsync(new CheckPointsPage());
}
private async void OnButtonGetEquipments(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//EquipmentsPage");
await Navigation.PushAsync(new EquipmentsPage());
}
private async void OnButtonGetLocations(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//LocationsPage");
await Navigation.PushAsync(new LocationsPage());
}
private async void OnButtonGetUsers(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//LocationsPage");
await Navigation.PushAsync(new UsersPage());
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.Security;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class BaseStockPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public BaseStockPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//CheckPointsPage");
await Navigation.PushAsync(new CheckPointsPage());
}
private async void OnButtonGetEquipments(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//EquipmentsPage");
await Navigation.PushAsync(new EquipmentsPage());
}
private async void OnButtonGetLocations(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//LocationsPage");
await Navigation.PushAsync(new LocationsPage());
}
private async void OnButtonGetUsers(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//LocationsPage");
await Navigation.PushAsync(new UsersPage());
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
}
@@ -1,157 +1,157 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints"
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
BackgroundColor="#f0f0f0"
Title="{Binding CheckPointDTO.ShortName}">
<StackLayout Padding="20">
<!-- Cím: Edit Item -->
<Label Text="Ellenőrzési pont adatai" FontSize="24" HorizontalOptions="Center" />
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
<VerticalStackLayout>
<!-- Editálható név mező -->
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
<Entry Text="{Binding CheckPointDTO.Code}" Placeholder="Edit item name" />
</VerticalStackLayout>
</Frame>
<Grid ColumnSpacing="46" Margin="0,10,0,10">
<!-- 10 pixel térköz az oszlopok között -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="Auto" />
<!-- Üres tér a két gomb között -->
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<!--<Button Text="Save" Command="{Binding SaveCommand}" Grid.Column="0"/>
<Button Text="Cancel" Command="{Binding CancelCommand}" Grid.Column="2"/>-->
</Grid>
<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="490"
ItemTemplate="{StaticResource AnswerTemplateSelector}">
<CollectionView.EmptyView>
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
</CollectionView.EmptyView>
</CollectionView>
</Frame>
</StackLayout>
<ContentPage.Resources>
<DataTemplate x:Key="I_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="P_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*">
<Label Text="Fénykép készítése szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="V_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*">
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="SI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_SN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="PI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_PN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
I_N_Template="{StaticResource I_N_Template}"
P_Template="{StaticResource P_Template}"
SI_N_Template="{StaticResource SI_N_Template}"
I_SN_Template="{StaticResource I_SN_Template}"
PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/>
</ContentPage.Resources>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints"
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
BackgroundColor="#f0f0f0"
Title="{Binding CheckPointDTO.ShortName}">
<StackLayout Padding="20">
<!-- Cím: Edit Item -->
<Label Text="Ellenőrzési pont adatai" FontSize="24" HorizontalOptions="Center" />
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
<VerticalStackLayout>
<!-- Editálható név mező -->
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
<Entry Text="{Binding CheckPointDTO.Code}" Placeholder="Edit item name" />
</VerticalStackLayout>
</Frame>
<Grid ColumnSpacing="46" Margin="0,10,0,10">
<!-- 10 pixel térköz az oszlopok között -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="Auto" />
<!-- Üres tér a két gomb között -->
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<!--<Button Text="Save" Command="{Binding SaveCommand}" Grid.Column="0"/>
<Button Text="Cancel" Command="{Binding CancelCommand}" Grid.Column="2"/>-->
</Grid>
<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="490"
ItemTemplate="{StaticResource AnswerTemplateSelector}">
<CollectionView.EmptyView>
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
</CollectionView.EmptyView>
</CollectionView>
</Frame>
</StackLayout>
<ContentPage.Resources>
<DataTemplate x:Key="I_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="P_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*">
<Label Text="Fénykép készítése szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="V_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*">
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="SI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_SN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="PI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_PN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Grid Grid.Column="1" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
I_N_Template="{StaticResource I_N_Template}"
P_Template="{StaticResource P_Template}"
SI_N_Template="{StaticResource SI_N_Template}"
I_SN_Template="{StaticResource I_SN_Template}"
PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/>
</ContentPage.Resources>
</ContentPage>
@@ -1,46 +1,46 @@
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints;
public partial class CheckPointEditPage : ContentPage
{
public CheckPointDTO CheckPointDTO { get; set; }
public ICommand SaveCommand { get; }
public ICommand CancelCommand { get; }
public CheckPointEditPage(CheckPointDTO checkPointDTO)
{
InitializeComponent();
CheckPointDTO = checkPointDTO;
BindingContext = this;
SaveCommand = new Command(OnSave);
CancelCommand = new Command(OnCancel);
LoadCheckPointCheckListRows();
}
private void LoadCheckPointCheckListRows()
{
//IsRefreshing = true;
//await _syncService.SyncDatas();
CheckPointCheckListRows.ItemsSource = CheckPointDTO.CheckListTemplateRowDTO;
//IsRefreshing = false;
//OnPropertyChanged(nameof(IsRefreshing));
}
private async void OnSave()
{
// Adatok mentése és visszairányítás az elõzõ oldalra
// Például adatbázisba mentés elõtt itt végrehajthatsz további mûveleteket
await Navigation.PopAsync();
}
// A törlési (Cancel) logika
private async void OnCancel()
{
// Visszatérés az elõzõ oldalra anélkül, hogy mentenénk bármit
//await Navigation.PopAsync();
await Shell.Current.GoToAsync("//CheckPointsPage");
}
}
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints;
public partial class CheckPointEditPage : ContentPage
{
public CheckPointDTO CheckPointDTO { get; set; }
public ICommand SaveCommand { get; }
public ICommand CancelCommand { get; }
public CheckPointEditPage(CheckPointDTO checkPointDTO)
{
InitializeComponent();
CheckPointDTO = checkPointDTO;
BindingContext = this;
SaveCommand = new Command(OnSave);
CancelCommand = new Command(OnCancel);
LoadCheckPointCheckListRows();
}
private void LoadCheckPointCheckListRows()
{
//IsRefreshing = true;
//await _syncService.SyncDatas();
CheckPointCheckListRows.ItemsSource = CheckPointDTO.CheckListTemplateRowDTO;
//IsRefreshing = false;
//OnPropertyChanged(nameof(IsRefreshing));
}
private async void OnSave()
{
// Adatok mentése és visszairányítás az elõzõ oldalra
// Például adatbázisba mentés elõtt itt végrehajthatsz további mûveleteket
await Navigation.PopAsync();
}
// A törlési (Cancel) logika
private async void OnCancel()
{
// Visszatérés az elõzõ oldalra anélkül, hogy mentenénk bármit
//await Navigation.PopAsync();
await Shell.Current.GoToAsync("//CheckPointsPage");
}
}
@@ -1,51 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPointsPage"
BackgroundColor="#f0f0f0"
Title="Ellenőrzési pontok">
<Grid>
<!-- Fő tartalom -->
<StackLayout>
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button
x:Name="ButtonSync" Margin="5"
Text="Adatok szinkronizálása"
SemanticProperties.Hint="Adatok szinkronizálása"
Clicked="OnButtonSync"
HorizontalOptions="Fill" />
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="CheckPointsList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Code}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Betekintés" Margin="5,0,0,0"
Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" />
<Button Text="Párosítás" Margin="5,0,0,0"
Command="{Binding BindingContext.PairCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</StackLayout>
<!-- Betöltés közbeni ActivityIndicator -->
<Grid x:Name="loadingOverlay" BackgroundColor="#80000000" IsVisible="{Binding IsLoading}" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
<ActivityIndicator IsRunning="{Binding IsLoading}" Color="White"
VerticalOptions="Center" HorizontalOptions="Center"
WidthRequest="50" HeightRequest="50"/>
</Grid>
</Grid>
</ContentPage>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPointsPage"
BackgroundColor="#f0f0f0"
Title="Ellenőrzési pontok">
<Grid>
<!-- Fő tartalom -->
<StackLayout>
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button
x:Name="ButtonSync" Margin="5"
Text="Adatok szinkronizálása"
SemanticProperties.Hint="Adatok szinkronizálása"
Clicked="OnButtonSync"
HorizontalOptions="Fill" />
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="CheckPointsList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Code}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Betekintés" Margin="5,0,0,0"
Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" />
<Button Text="Párosítás" Margin="5,0,0,0"
Command="{Binding BindingContext.PairCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</StackLayout>
<!-- Betöltés közbeni ActivityIndicator -->
<Grid x:Name="loadingOverlay" BackgroundColor="#80000000" IsVisible="{Binding IsLoading}" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
<ActivityIndicator IsRunning="{Binding IsLoading}" Color="White"
VerticalOptions="Center" HorizontalOptions="Center"
WidthRequest="50" HeightRequest="50"/>
</Grid>
</Grid>
</ContentPage>
@@ -1,116 +1,116 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints;
using WorkFlowCheck.MAUI.Services.Interfaces;
using Plugin.NFC;
using WorkFlowCheck.MAUI.Pages.NFC;
using AndroidX.Camera.Core.Impl;
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class CheckPointsPage : ContentPage
{
private readonly IBaseStockService _baseStockService;
private readonly ISyncService _syncService;
public CheckPointsPage()
{
InitializeComponent();
_baseStockService = MauiProgram.ServiceProvider.GetRequiredService<IBaseStockService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;
OnPropertyChanged();
}
}
public ICommand RefreshCommand { get; set; }
public ICommand EditCommand { get; set; }
public ICommand PairCommand { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
RefreshCommand = new Command(async () => await LoadCheckPoints());
EditCommand = new Command<CheckPointDTO>(OnEditItem);
PairCommand = new Command<CheckPointDTO>(OnPairItem);
BindingContext = this;
await LoadCheckPoints();
}
private async Task LoadCheckPoints()
{
IsLoading = true;
CheckPointsList.ItemsSource = await _baseStockService.GetAllCheckPoints();
IsLoading = false;
}
private async void OnEditItem(CheckPointDTO checkPointDTO)
{
await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
}
private async void OnPairItem(CheckPointDTO checkPointDTO)
{
var checkPointCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(checkPointCode))
{
if (Navigation.ModalStack.Count > 0)
{
await Navigation.PopModalAsync();
}
if (checkPointDTO != null)
{
checkPointDTO.Code = checkPointCode;
await _baseStockService.UpdateCheckPoint(checkPointDTO);
await LoadCheckPoints();
}
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
private async void OnButtonSync(object sender, EventArgs e)
{
IsLoading = true;
ButtonSync.IsEnabled = false;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncCheckPoints_Up((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
ButtonSync.IsEnabled = true;
IsLoading = false;
}
}
using System.Collections.ObjectModel;
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints;
using WorkFlowCheck.MAUI.Services.Interfaces;
using Plugin.NFC;
using WorkFlowCheck.MAUI.Pages.NFC;
using AndroidX.Camera.Core.Impl;
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class CheckPointsPage : ContentPage
{
private readonly IBaseStockService _baseStockService;
private readonly ISyncService _syncService;
public CheckPointsPage()
{
InitializeComponent();
_baseStockService = MauiProgram.ServiceProvider.GetRequiredService<IBaseStockService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;
OnPropertyChanged();
}
}
public ICommand RefreshCommand { get; set; }
public ICommand EditCommand { get; set; }
public ICommand PairCommand { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
RefreshCommand = new Command(async () => await LoadCheckPoints());
EditCommand = new Command<CheckPointDTO>(OnEditItem);
PairCommand = new Command<CheckPointDTO>(OnPairItem);
BindingContext = this;
await LoadCheckPoints();
}
private async Task LoadCheckPoints()
{
IsLoading = true;
CheckPointsList.ItemsSource = await _baseStockService.GetAllCheckPoints();
IsLoading = false;
}
private async void OnEditItem(CheckPointDTO checkPointDTO)
{
await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
}
private async void OnPairItem(CheckPointDTO checkPointDTO)
{
var checkPointCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(checkPointCode))
{
if (Navigation.ModalStack.Count > 0)
{
await Navigation.PopModalAsync();
}
if (checkPointDTO != null)
{
checkPointDTO.Code = checkPointCode;
await _baseStockService.UpdateCheckPoint(checkPointDTO);
await LoadCheckPoints();
}
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
private async void OnButtonSync(object sender, EventArgs e)
{
IsLoading = true;
ButtonSync.IsEnabled = false;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncCheckPoints_Up((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
ButtonSync.IsEnabled = true;
IsLoading = false;
}
}
}
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.EquipmentsPage"
Title="EquipmentsPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.EquipmentsPage"
Title="EquipmentsPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>
@@ -1,14 +1,14 @@
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class EquipmentsPage : ContentPage
{
public EquipmentsPage()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class EquipmentsPage : ContentPage
{
public EquipmentsPage()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
}
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.LocationsPage"
Title="LocationsPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.LocationsPage"
Title="LocationsPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>
@@ -1,14 +1,14 @@
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class LocationsPage : ContentPage
{
public LocationsPage()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class LocationsPage : ContentPage
{
public LocationsPage()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
}
@@ -1,55 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListInfoPage"
Title="CheckListInfoPage">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label x:Name="HeaderLabel" Text=""
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*" Padding="30,30">
<Frame Grid.Row="0"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<StackLayout Grid.Column="1" Spacing="2">
<Label x:Name="row1" FontSize="20" FontAttributes="Bold" />
<Label x:Name="row2" Text="B" FontSize="20" />
<Label x:Name="row3" Text="C" FontSize="20" />
<Label x:Name="row4" Text="D" FontSize="20" />
<Label x:Name="row5" Text="D" FontSize="25" FontAttributes="Bold"/>
</StackLayout>
</Frame>
</Grid>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListInfoPage"
Title="CheckListInfoPage">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label x:Name="HeaderLabel" Text=""
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*" Padding="30,30">
<Frame Grid.Row="0"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<StackLayout Grid.Column="1" Spacing="2">
<Label x:Name="row1" FontSize="20" FontAttributes="Bold" />
<Label x:Name="row2" Text="B" FontSize="20" />
<Label x:Name="row3" Text="C" FontSize="20" />
<Label x:Name="row4" Text="D" FontSize="20" />
<Label x:Name="row5" Text="D" FontSize="25" FontAttributes="Bold"/>
</StackLayout>
</Frame>
</Grid>
</ContentPage>
@@ -1,71 +1,71 @@
using Android.DeviceLock;
using Firebase.Auth;
using System.Globalization;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.CheckList;
public partial class CheckListInfoPage : ContentPage
{
private readonly ICheckListService _checkListService;
private readonly IUserService _userService;
private UserDTO _currentUser;
private CheckListHeaderDTO _checkListHeaderDTO;
private CheckListHeaderInfoDTO _checkListHeaderInfoDTO;
public CheckListInfoPage(CheckListHeaderDTO checkListHeaderDTO)
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
_checkListHeaderDTO = checkListHeaderDTO;
}
private async Task SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
HeaderLabel.Text = _checkListHeaderDTO.DocumentNumber;
}
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await SetInfo();
BuildCheckListHeaderInfo();
}
private async Task BuildCheckListHeaderInfo()
{
_checkListHeaderInfoDTO = new CheckListHeaderInfoDTO();
var result = _checkListHeaderDTO.CheckListRowDTO
.GroupBy(r => 1)
.Select(g => new
{
TotalRowCount = g.Count(),
EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)),
CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count()
})
.FirstOrDefault();
if (result != null)
{
_checkListHeaderInfoDTO.TotalRowCount = result.TotalRowCount;
_checkListHeaderInfoDTO.CheckPointCount = result.CheckPointCount;
_checkListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount;
if (_checkListHeaderInfoDTO.TotalRowCount > 0)
{
_checkListHeaderInfoDTO.ReadyPercent = ((double)(_checkListHeaderInfoDTO.TotalRowCount - _checkListHeaderInfoDTO.EmptyAnswerCount) / _checkListHeaderInfoDTO.TotalRowCount * 100)
.ToString("0.00", new CultureInfo("hu-HU")) + " %";
}
}
var checkPointDTO = await _checkListService.GetNextCheckpointNotSend(_checkListHeaderDTO);
row1.Text = $"Összes ellenõrizendõ lépés: {_checkListHeaderInfoDTO.TotalRowCount} db";
row2.Text = $"Összes még nem ellenõrzött lépés: {_checkListHeaderInfoDTO.EmptyAnswerCount} db";
row3.Text = $"Ellenõrzési pontok száma: {_checkListHeaderInfoDTO.CheckPointCount} db";
row4.Text = $"Készültség: {_checkListHeaderInfoDTO.ReadyPercent}";
row5.Text = $"Következõ ellenõrzési pont : {checkPointDTO.ShortName}";
}
using Android.DeviceLock;
using Firebase.Auth;
using System.Globalization;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.CheckList;
public partial class CheckListInfoPage : ContentPage
{
private readonly ICheckListService _checkListService;
private readonly IUserService _userService;
private UserDTO _currentUser;
private CheckListHeaderDTO _checkListHeaderDTO;
private CheckListHeaderInfoDTO _checkListHeaderInfoDTO;
public CheckListInfoPage(CheckListHeaderDTO checkListHeaderDTO)
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
_checkListHeaderDTO = checkListHeaderDTO;
}
private async Task SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
HeaderLabel.Text = _checkListHeaderDTO.DocumentNumber;
}
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await SetInfo();
BuildCheckListHeaderInfo();
}
private async Task BuildCheckListHeaderInfo()
{
_checkListHeaderInfoDTO = new CheckListHeaderInfoDTO();
var result = _checkListHeaderDTO.CheckListRowDTO
.GroupBy(r => 1)
.Select(g => new
{
TotalRowCount = g.Count(),
EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)),
CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count()
})
.FirstOrDefault();
if (result != null)
{
_checkListHeaderInfoDTO.TotalRowCount = result.TotalRowCount;
_checkListHeaderInfoDTO.CheckPointCount = result.CheckPointCount;
_checkListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount;
if (_checkListHeaderInfoDTO.TotalRowCount > 0)
{
_checkListHeaderInfoDTO.ReadyPercent = ((double)(_checkListHeaderInfoDTO.TotalRowCount - _checkListHeaderInfoDTO.EmptyAnswerCount) / _checkListHeaderInfoDTO.TotalRowCount * 100)
.ToString("0.00", new CultureInfo("hu-HU")) + " %";
}
}
var checkPointDTO = await _checkListService.GetNextCheckpointNotSend(_checkListHeaderDTO);
row1.Text = $"Összes ellenõrizendõ lépés: {_checkListHeaderInfoDTO.TotalRowCount} db";
row2.Text = $"Összes még nem ellenõrzött lépés: {_checkListHeaderInfoDTO.EmptyAnswerCount} db";
row3.Text = $"Ellenõrzési pontok száma: {_checkListHeaderInfoDTO.CheckPointCount} db";
row4.Text = $"Készültség: {_checkListHeaderInfoDTO.ReadyPercent}";
row5.Text = $"Következõ ellenõrzési pont : {checkPointDTO.ShortName}";
}
}
@@ -1,260 +1,260 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
Title="Ellenőrzések"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Ellenőrzések"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*,4*,2*" Padding="30,30">
<VerticalStackLayout Grid.Row="0" Margin="0,0,0,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<HorizontalStackLayout HorizontalOptions="Center" Spacing="10">
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar"
WidthRequest="310"
HeightRequest="30"
VerticalOptions="Center" />
<Button x:Name="SyncBtn"
ImageSource="cloud_download"
Text=""
Clicked="OnSyncClicked"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<Frame Grid.Row="1"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<RefreshView x:Name="CheckListRefreshView"
IsRefreshing="{Binding IsRefreshing}"
Command="{Binding RefreshCommand}">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Bal oldali gomb -->
<Button Grid.Column="0"
VerticalOptions="Center"
Text="i"
FontSize="17"
FontAttributes="Bold"
BackgroundColor="Purple"
HeightRequest="40"
WidthRequest="40"
CornerRadius="20"
BorderColor="Gray"
BorderWidth="1"
Command="{Binding BindingContext.InfoCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}" />
<!-- Jobb oldali szövegek -->
<StackLayout Grid.Column="1" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="12" />
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
<Label Text="{Binding StatusName}" FontSize="10" />
</StackLayout>
</Grid>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text="L"
Margin="0,0,0,0"
BackgroundColor="DarkOrange"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource CloseConverter}}"
Command="{Binding BindingContext.CloseCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
Margin="0,0,0,0"
ImageSource="arrow_down.svg"
BackgroundColor="Red"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="arrow_up.svg"
Margin="0,0,0,0"
BackgroundColor="Green"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="check_circle.svg"
Margin="0,0,0,0"
BackgroundColor="DarkGreen"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="arrow_right.svg"
Margin="0,0,0,0"
BackgroundColor="Blue"
CornerRadius="25"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Frame Grid.Row="2"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<RefreshView x:Name="CheckListTemplateRefreshView"
IsRefreshing="{Binding IsRefreshingT}"
Command="{Binding RefreshCommandT}">
<ScrollView>
<VerticalStackLayout>
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckListTemplate">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés"
BackgroundColor="Green"
Margin="5,0,0,0"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="Fill"
HorizontalOptions="Fill"
ZIndex="1000">
<ActivityIndicator IsRunning="{Binding IsLoading}"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="White"
WidthRequest="50"
HeightRequest="50"/>
</Grid>
</Grid>
<ContentPage.Resources>
<ResourceDictionary>
<local:BlockedConverter x:Key="BlockedConverter" />
<local:UnBlockedConverter x:Key="UnBlockedConverter" />
<local:ContinueConverter x:Key="ContinueConverter" />
<local:AcceptConverter x:Key="AcceptConverter" />
<local:CloseConverter x:Key="CloseConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
Title="Ellenőrzések"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Ellenőrzések"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*,4*,2*" Padding="30,30">
<VerticalStackLayout Grid.Row="0" Margin="0,0,0,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<HorizontalStackLayout HorizontalOptions="Center" Spacing="10">
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar"
WidthRequest="310"
HeightRequest="30"
VerticalOptions="Center" />
<Button x:Name="SyncBtn"
ImageSource="cloud_download"
Text=""
Clicked="OnSyncClicked"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<Frame Grid.Row="1"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<RefreshView x:Name="CheckListRefreshView"
IsRefreshing="{Binding IsRefreshing}"
Command="{Binding RefreshCommand}">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Bal oldali gomb -->
<Button Grid.Column="0"
VerticalOptions="Center"
Text="i"
FontSize="17"
FontAttributes="Bold"
BackgroundColor="Purple"
HeightRequest="40"
WidthRequest="40"
CornerRadius="20"
BorderColor="Gray"
BorderWidth="1"
Command="{Binding BindingContext.InfoCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}" />
<!-- Jobb oldali szövegek -->
<StackLayout Grid.Column="1" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="12" />
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
<Label Text="{Binding StatusName}" FontSize="10" />
</StackLayout>
</Grid>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text="L"
Margin="0,0,0,0"
BackgroundColor="DarkOrange"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource CloseConverter}}"
Command="{Binding BindingContext.CloseCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
Margin="0,0,0,0"
ImageSource="arrow_down.svg"
BackgroundColor="Red"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="arrow_up.svg"
Margin="0,0,0,0"
BackgroundColor="Green"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="check_circle.svg"
Margin="0,0,0,0"
BackgroundColor="DarkGreen"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
ImageSource="arrow_right.svg"
Margin="0,0,0,0"
BackgroundColor="Blue"
CornerRadius="25"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Frame Grid.Row="2"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<RefreshView x:Name="CheckListTemplateRefreshView"
IsRefreshing="{Binding IsRefreshingT}"
Command="{Binding RefreshCommandT}">
<ScrollView>
<VerticalStackLayout>
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckListTemplate">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés"
BackgroundColor="Green"
Margin="5,0,0,0"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="Fill"
HorizontalOptions="Fill"
ZIndex="1000">
<ActivityIndicator IsRunning="{Binding IsLoading}"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="White"
WidthRequest="50"
HeightRequest="50"/>
</Grid>
</Grid>
<ContentPage.Resources>
<ResourceDictionary>
<local:BlockedConverter x:Key="BlockedConverter" />
<local:UnBlockedConverter x:Key="UnBlockedConverter" />
<local:ContinueConverter x:Key="ContinueConverter" />
<local:AcceptConverter x:Key="AcceptConverter" />
<local:CloseConverter x:Key="CloseConverter" />
</ResourceDictionary>
</ContentPage.Resources>
</ContentPage>
File diff suppressed because it is too large Load Diff
@@ -1,91 +1,91 @@
using SkiaSharp;
using System.ComponentModel;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper;
namespace WorkFlowCheck.MAUI.Pages.CheckList
{
public class CheckListRowCS : INotifyPropertyChanged
{
private byte[] _photoBytes;
//private ImageSource? _photo;
private string? _photoPath;
public event PropertyChangedEventHandler PropertyChanged;
public int Id { get; set; }
public string AnswerType { get; set; } = null!;
public int RowIndex { get; set; }
public string OperationDescription { get; set; } = null!;
public string GroupName { get; set; } = null!;
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
public byte[] PhotoBytes
{
get => _photoBytes;
set
{
if (_photoBytes != value)
{
_photoBytes = value;
//_photo = null;
_photoPath = null;
//OnPropertyChanged(nameof(PhotoBytes));
//OnPropertyChanged(nameof(Photo));
OnPropertyChanged(nameof(PhotoPath));
}
}
}
//public ImageSource Photo
//{
// get
// {
// if (_photo == null)
// {
// if (PhotoBytes != null && PhotoBytes.Length > 0)
// {
// try
// {
// var bytesCopy = PhotoBytes.ToArray();
// _photo = ImageSource.FromStream(() => new MemoryStream(bytesCopy));
// }
// catch
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// else
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// return _photo;
// }
//}
public string PhotoPath
{
get
{
if (_photoPath == null)
{
if (PhotoBytes != null && PhotoBytes.Length > 0)
{
_photoPath = ImageHelper.ResizeAndSaveImage(PhotoBytes, Id, 100);
}
else
{
_photoPath = "noimage.png";
}
}
return _photoPath;
}
}
protected void OnPropertyChanged(string name) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
using SkiaSharp;
using System.ComponentModel;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper;
namespace WorkFlowCheck.MAUI.Pages.CheckList
{
public class CheckListRowCS : INotifyPropertyChanged
{
private byte[] _photoBytes;
//private ImageSource? _photo;
private string? _photoPath;
public event PropertyChangedEventHandler PropertyChanged;
public int Id { get; set; }
public string AnswerType { get; set; } = null!;
public int RowIndex { get; set; }
public string OperationDescription { get; set; } = null!;
public string GroupName { get; set; } = null!;
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
public byte[] PhotoBytes
{
get => _photoBytes;
set
{
if (_photoBytes != value)
{
_photoBytes = value;
//_photo = null;
_photoPath = null;
//OnPropertyChanged(nameof(PhotoBytes));
//OnPropertyChanged(nameof(Photo));
OnPropertyChanged(nameof(PhotoPath));
}
}
}
//public ImageSource Photo
//{
// get
// {
// if (_photo == null)
// {
// if (PhotoBytes != null && PhotoBytes.Length > 0)
// {
// try
// {
// var bytesCopy = PhotoBytes.ToArray();
// _photo = ImageSource.FromStream(() => new MemoryStream(bytesCopy));
// }
// catch
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// else
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// return _photo;
// }
//}
public string PhotoPath
{
get
{
if (_photoPath == null)
{
if (PhotoBytes != null && PhotoBytes.Length > 0)
{
_photoPath = ImageHelper.ResizeAndSaveImage(PhotoBytes, Id, 100);
}
else
{
_photoPath = "noimage.png";
}
}
return _photoPath;
}
}
protected void OnPropertyChanged(string name) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
@@ -1,315 +1,315 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage"
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
BackgroundColor="#f0f0f0"
Title="">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label x:Name="HeaderLabel" Text=""
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<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="555"
ItemsSource="{Binding CheckListRowCSs}"
ItemTemplate="{StaticResource AnswerTemplateSelector}">
<CollectionView.EmptyView>
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
</CollectionView.EmptyView>
</CollectionView>
</Frame>
<Grid ColumnSpacing="46" Margin="0,10,0,10">
<!-- 10 pixel térköz az oszlopok között -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="Auto" />
<!-- Üres tér a két gomb között -->
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<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"
IsVisible="{Binding IsLoading}"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="Fill"
HorizontalOptions="Fill"
ZIndex="1000">
<ActivityIndicator IsRunning="{Binding IsLoading}"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="White"
WidthRequest="50"
HeightRequest="50"/>
</Grid>
</Grid>
<ContentPage.Resources>
<DataTemplate x:Key="I_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="P_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="Auto,Auto" VerticalOptions="Center">
<Image Grid.Column="0"
WidthRequest="65"
HeightRequest="90"
Aspect="AspectFill"
Margin="0,0,10,0"
VerticalOptions="Center"
Source="{Binding PhotoPath}" >
</Image>
<Button Text="📷" Grid.Column="1"
VerticalOptions="Center"
Command="{Binding BindingContext.TakePhoto, Source={x:Reference CheckPointCheckListRows}}"
CommandParameter="{Binding .}" />
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="V_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*">
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
<Entry Grid.Column="3"
Text="{Binding Answer}"
HorizontalTextAlignment="Center"
TextChanged="V_Entry_Text_Changed"
VerticalOptions="Center" />
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="SI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_SN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="PI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_PN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
I_N_Template="{StaticResource I_N_Template}"
P_Template="{StaticResource P_Template}"
SI_N_Template="{StaticResource SI_N_Template}"
I_SN_Template="{StaticResource I_SN_Template}"
PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/>
</ContentPage.Resources>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage"
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
BackgroundColor="#f0f0f0"
Title="">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label x:Name="HeaderLabel" Text=""
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<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="555"
ItemsSource="{Binding CheckListRowCSs}"
ItemTemplate="{StaticResource AnswerTemplateSelector}">
<CollectionView.EmptyView>
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
</CollectionView.EmptyView>
</CollectionView>
</Frame>
<Grid ColumnSpacing="46" Margin="0,10,0,10">
<!-- 10 pixel térköz az oszlopok között -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="Auto" />
<!-- Üres tér a két gomb között -->
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<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"
IsVisible="{Binding IsLoading}"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="Fill"
HorizontalOptions="Fill"
ZIndex="1000">
<ActivityIndicator IsRunning="{Binding IsLoading}"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="White"
WidthRequest="50"
HeightRequest="50"/>
</Grid>
</Grid>
<ContentPage.Resources>
<DataTemplate x:Key="I_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="P_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="Auto,Auto" VerticalOptions="Center">
<Image Grid.Column="0"
WidthRequest="65"
HeightRequest="90"
Aspect="AspectFill"
Margin="0,0,10,0"
VerticalOptions="Center"
Source="{Binding PhotoPath}" >
</Image>
<Button Text="📷" Grid.Column="1"
VerticalOptions="Center"
Command="{Binding BindingContext.TakePhoto, Source={x:Reference CheckPointCheckListRows}}"
CommandParameter="{Binding .}" />
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="V_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*">
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid>
<Entry Grid.Column="3"
Text="{Binding Answer}"
HorizontalTextAlignment="Center"
TextChanged="V_Entry_Text_Changed"
VerticalOptions="Center" />
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="SI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_SN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="PI_N_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<DataTemplate x:Key="I_PN_Template">
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Grid>
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
<local:BindableRadioButton
Grid.Row="0"
Content="Igen"
Value="Igen"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton
Grid.Row="1"
Content="Nem"
Value="Nem"
BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
</Grid>
</Frame>
</DataTemplate>
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
I_N_Template="{StaticResource I_N_Template}"
P_Template="{StaticResource P_Template}"
SI_N_Template="{StaticResource SI_N_Template}"
I_SN_Template="{StaticResource I_SN_Template}"
PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/>
</ContentPage.Resources>
</ContentPage>
@@ -1,313 +1,313 @@
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using System.Windows.Input;
using System.Globalization;
using System.Collections.ObjectModel;
using SkiaSharp;
namespace WorkFlowCheck.MAUI.Pages.CheckList;
public partial class CheckListWorkPage : ContentPage
{
private readonly ICheckListService _checkListService;
private readonly ISyncService _syncService;
private readonly IUserService _userService;
private string _checkPointCode;
private int _checkListHeaderId;
private UserDTO _currentUser;
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;
OnPropertyChanged(nameof(IsLoading));
}
}
public ObservableCollection<CheckListRowCS> CheckListRowCSs { get; set; } = new ObservableCollection<CheckListRowCS>();
public List<CheckListRowDTO> CheckListRowDTOs { get; set; }
public ICommand TakePhoto { get; set; }
public ICommand SendCommand { get; set; }
public ICommand SaveCommand { get; set; }
public CheckListWorkPage(int checkListHeaderId, string checkPointCode)
{
InitializeComponent();
_checkPointCode = checkPointCode;
_checkListHeaderId = checkListHeaderId;
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
SaveCommand = new Command(async () => await OnSave());
SendCommand = new Command(async () => await OnSend());
}
private async Task SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
var checkPoint = await _checkListService.GetCheckPoint(_checkPointCode);
if (checkPoint != null && checkPoint.IsSuccess)
{
HeaderLabel.Text = checkPoint.Data.ShortName;
}
}
private async Task OnSend()
{
IsLoading = true;
sendButton.IsEnabled = false;
saveButton.IsEnabled = false;
try
{
await OnSave();
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 Navigation.PopModalAsync();
}
}
else
{
await Application.Current.MainPage.DisplayAlert("Hiba", result.Error, "OK");
}
});
progressLabel.Text = "Szinkronizálás befejezve!";
await Shell.Current.GoToAsync("//CheckListPage");
}
catch (Exception ex)
{
await Application.Current.MainPage.DisplayAlert("Hiba", ex.Message, "OK");
sendButton.IsEnabled = true;
saveButton.IsEnabled = true;
}
finally
{
IsLoading = false;
}
}
private async Task OnSave(bool withReload = true)
{
IsLoading = true;
try
{
await Task.Run(async () =>
{
foreach (var checkListRowCS in CheckListRowCSs)
{
var checkListRowDTO = CheckListRowDTOs.Where(w => w.Id == checkListRowCS.Id).FirstOrDefault();
if (checkListRowDTO != null)
{
checkListRowDTO.Answer = checkListRowCS.Answer;
if (checkListRowCS.AnswerYes == true)
{
checkListRowDTO.Answer = "Igen";
}
else if (checkListRowCS.AnswerNo == true)
{
checkListRowDTO.Answer = "Nem";
}
else
{
checkListRowDTO.Answer = checkListRowCS.Answer;
}
await _checkListService.UpdateCheckListRow(checkListRowDTO, withReload);
}
}
if (withReload) await LoadCheckPointCheckListRows();
});
}
catch (Exception)
{
}
finally
{
IsLoading = false;
}
}
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await SetInfo();
TakePhoto = new Command<CheckListRowCS>(OnTakePhoto);
await LoadCheckPointCheckListRows();
}
private async Task<byte[]> ResizePicture(FileResult? photo, int newWidth)
{
using var stream = await photo.OpenReadAsync();
using var originalBitmap = SKBitmap.Decode(stream);
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);
return data.ToArray();
}
private async void OnTakePhoto(CheckListRowCS checkListRowCS)
{
try
{
if (MediaPicker.IsCaptureSupported)
{
//await OnSave(false);
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
checkListRowCS.PhotoBytes = await ResizePicture(photo, 500);
checkListRowCS.Answer = "Igen";
var checkListRowDTO = CheckListRowDTOs.FirstOrDefault(w => w.Id == checkListRowCS.Id);
if (checkListRowDTO != null)
{
checkListRowDTO.Photo = checkListRowCS.PhotoBytes;
checkListRowDTO.Answer = "Igen";
await _checkListService.UpdateCheckListRow(checkListRowDTO, true);
//await LoadCheckPointCheckListRows();
}
}
}
else
{
Console.WriteLine("A fényképezés nem támogatott ezen az eszközön.");
}
}
catch (Exception ex)
{
Console.WriteLine($"Hiba történt a fényképezés közben: {ex.Message}");
}
}
private async Task LoadCheckPointCheckListRows()
{
IsLoading = true;
CheckListRowCSs.Clear();
CheckListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
foreach (var item in CheckListRowDTOs)
{
if (item.Answer == "Igen")
{
item.AnswerYes = true;
item.AnswerNo = false;
}
else if (item.Answer == "Nem")
{
item.AnswerYes = false;
item.AnswerNo = true;
}
var checkListRowCS = new CheckListRowCS()
{
Answer = item.Answer,
AnswerNo = item.AnswerNo,
AnswerYes = item.AnswerYes,
GroupName = $"AnswerGroup_{item.CheckListTemplateRowDTO?.Id ?? 0}",
Id = item.Id,
RowIndex = item.CheckListTemplateRowDTO?.RowIndex ?? 0,
OperationDescription = item.CheckListTemplateRowDTO?.OperationDescription ?? "N/A",
AnswerType = item.CheckListTemplateRowDTO?.AnswerType ?? "I-N",
PhotoBytes = item.Photo ?? Array.Empty<byte>(),
};
CheckListRowCSs.Add(checkListRowCS);
}
IsLoading = false;
}
private void V_Entry_Text_Changed(object sender, TextChangedEventArgs e)
{
var entry = sender as Entry;
var model = entry?.BindingContext as CheckListRowCS;
if (model != null)
{
model.Answer = e.NewTextValue;
}
}
}
public class BindableRadioButton : RadioButton
{
public static readonly BindableProperty BindableGroupNameProperty =
BindableProperty.Create(nameof(BindableGroupName), typeof(string), typeof(BindableRadioButton), default(string), propertyChanged: OnGroupNameChanged);
public string BindableGroupName
{
get => (string)GetValue(BindableGroupNameProperty);
set => SetValue(BindableGroupNameProperty, value);
}
private static void OnGroupNameChanged(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is BindableRadioButton radioButton && newValue is string newGroupName)
{
radioButton.GroupName = newGroupName;
}
}
public BindableRadioButton()
{
CheckedChanged += OnCheckedChangedInternal;
}
private void OnCheckedChangedInternal(object sender, CheckedChangedEventArgs e)
{
if (e.Value && BindingContext is CheckListRowCS checkListRowCS)
{
if (Value?.ToString() == "Igen")
checkListRowCS.Answer = "Igen";
else if (Value?.ToString() == "Nem")
checkListRowCS.Answer = "Nem";
}
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
if (BindingContext is CheckListRowCS checkListRowCS)
{
if (Value?.ToString() == "Igen")
IsChecked = checkListRowCS.Answer == "Igen";
else if (Value?.ToString() == "Nem")
IsChecked = checkListRowCS.Answer == "Nem";
}
}
}
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using System.Windows.Input;
using System.Globalization;
using System.Collections.ObjectModel;
using SkiaSharp;
namespace WorkFlowCheck.MAUI.Pages.CheckList;
public partial class CheckListWorkPage : ContentPage
{
private readonly ICheckListService _checkListService;
private readonly ISyncService _syncService;
private readonly IUserService _userService;
private string _checkPointCode;
private int _checkListHeaderId;
private UserDTO _currentUser;
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;
OnPropertyChanged(nameof(IsLoading));
}
}
public ObservableCollection<CheckListRowCS> CheckListRowCSs { get; set; } = new ObservableCollection<CheckListRowCS>();
public List<CheckListRowDTO> CheckListRowDTOs { get; set; }
public ICommand TakePhoto { get; set; }
public ICommand SendCommand { get; set; }
public ICommand SaveCommand { get; set; }
public CheckListWorkPage(int checkListHeaderId, string checkPointCode)
{
InitializeComponent();
_checkPointCode = checkPointCode;
_checkListHeaderId = checkListHeaderId;
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
SaveCommand = new Command(async () => await OnSave());
SendCommand = new Command(async () => await OnSend());
}
private async Task SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
var checkPoint = await _checkListService.GetCheckPoint(_checkPointCode);
if (checkPoint != null && checkPoint.IsSuccess)
{
HeaderLabel.Text = checkPoint.Data.ShortName;
}
}
private async Task OnSend()
{
IsLoading = true;
sendButton.IsEnabled = false;
saveButton.IsEnabled = false;
try
{
await OnSave();
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 Navigation.PopModalAsync();
}
}
else
{
await Application.Current.MainPage.DisplayAlert("Hiba", result.Error, "OK");
}
});
progressLabel.Text = "Szinkronizálás befejezve!";
await Shell.Current.GoToAsync("//CheckListPage");
}
catch (Exception ex)
{
await Application.Current.MainPage.DisplayAlert("Hiba", ex.Message, "OK");
sendButton.IsEnabled = true;
saveButton.IsEnabled = true;
}
finally
{
IsLoading = false;
}
}
private async Task OnSave(bool withReload = true)
{
IsLoading = true;
try
{
await Task.Run(async () =>
{
foreach (var checkListRowCS in CheckListRowCSs)
{
var checkListRowDTO = CheckListRowDTOs.Where(w => w.Id == checkListRowCS.Id).FirstOrDefault();
if (checkListRowDTO != null)
{
checkListRowDTO.Answer = checkListRowCS.Answer;
if (checkListRowCS.AnswerYes == true)
{
checkListRowDTO.Answer = "Igen";
}
else if (checkListRowCS.AnswerNo == true)
{
checkListRowDTO.Answer = "Nem";
}
else
{
checkListRowDTO.Answer = checkListRowCS.Answer;
}
await _checkListService.UpdateCheckListRow(checkListRowDTO, withReload);
}
}
if (withReload) await LoadCheckPointCheckListRows();
});
}
catch (Exception)
{
}
finally
{
IsLoading = false;
}
}
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await SetInfo();
TakePhoto = new Command<CheckListRowCS>(OnTakePhoto);
await LoadCheckPointCheckListRows();
}
private async Task<byte[]> ResizePicture(FileResult? photo, int newWidth)
{
using var stream = await photo.OpenReadAsync();
using var originalBitmap = SKBitmap.Decode(stream);
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);
return data.ToArray();
}
private async void OnTakePhoto(CheckListRowCS checkListRowCS)
{
try
{
if (MediaPicker.IsCaptureSupported)
{
//await OnSave(false);
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
checkListRowCS.PhotoBytes = await ResizePicture(photo, 500);
checkListRowCS.Answer = "Igen";
var checkListRowDTO = CheckListRowDTOs.FirstOrDefault(w => w.Id == checkListRowCS.Id);
if (checkListRowDTO != null)
{
checkListRowDTO.Photo = checkListRowCS.PhotoBytes;
checkListRowDTO.Answer = "Igen";
await _checkListService.UpdateCheckListRow(checkListRowDTO, true);
//await LoadCheckPointCheckListRows();
}
}
}
else
{
Console.WriteLine("A fényképezés nem támogatott ezen az eszközön.");
}
}
catch (Exception ex)
{
Console.WriteLine($"Hiba történt a fényképezés közben: {ex.Message}");
}
}
private async Task LoadCheckPointCheckListRows()
{
IsLoading = true;
CheckListRowCSs.Clear();
CheckListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
foreach (var item in CheckListRowDTOs)
{
if (item.Answer == "Igen")
{
item.AnswerYes = true;
item.AnswerNo = false;
}
else if (item.Answer == "Nem")
{
item.AnswerYes = false;
item.AnswerNo = true;
}
var checkListRowCS = new CheckListRowCS()
{
Answer = item.Answer,
AnswerNo = item.AnswerNo,
AnswerYes = item.AnswerYes,
GroupName = $"AnswerGroup_{item.CheckListTemplateRowDTO?.Id ?? 0}",
Id = item.Id,
RowIndex = item.CheckListTemplateRowDTO?.RowIndex ?? 0,
OperationDescription = item.CheckListTemplateRowDTO?.OperationDescription ?? "N/A",
AnswerType = item.CheckListTemplateRowDTO?.AnswerType ?? "I-N",
PhotoBytes = item.Photo ?? Array.Empty<byte>(),
};
CheckListRowCSs.Add(checkListRowCS);
}
IsLoading = false;
}
private void V_Entry_Text_Changed(object sender, TextChangedEventArgs e)
{
var entry = sender as Entry;
var model = entry?.BindingContext as CheckListRowCS;
if (model != null)
{
model.Answer = e.NewTextValue;
}
}
}
public class BindableRadioButton : RadioButton
{
public static readonly BindableProperty BindableGroupNameProperty =
BindableProperty.Create(nameof(BindableGroupName), typeof(string), typeof(BindableRadioButton), default(string), propertyChanged: OnGroupNameChanged);
public string BindableGroupName
{
get => (string)GetValue(BindableGroupNameProperty);
set => SetValue(BindableGroupNameProperty, value);
}
private static void OnGroupNameChanged(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is BindableRadioButton radioButton && newValue is string newGroupName)
{
radioButton.GroupName = newGroupName;
}
}
public BindableRadioButton()
{
CheckedChanged += OnCheckedChangedInternal;
}
private void OnCheckedChangedInternal(object sender, CheckedChangedEventArgs e)
{
if (e.Value && BindingContext is CheckListRowCS checkListRowCS)
{
if (Value?.ToString() == "Igen")
checkListRowCS.Answer = "Igen";
else if (Value?.ToString() == "Nem")
checkListRowCS.Answer = "Nem";
}
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
if (BindingContext is CheckListRowCS checkListRowCS)
{
if (Value?.ToString() == "Igen")
IsChecked = checkListRowCS.Answer == "Igen";
else if (Value?.ToString() == "Nem")
IsChecked = checkListRowCS.Answer == "Nem";
}
}
}
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="WorkFlowCheck.MAUI.Pages.Media.CaptureImagePage"
Title="CaptureImagePage">
<VerticalStackLayout>
<!-- Gomb a kép készítéséhez -->
<Button Text="Kép készítése"
Clicked="OnCaptureClicked" />
<!-- Kép megjelenítése -->
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True">
<Image x:Name="CapturedImage"
HeightRequest="200"
Aspect="AspectFit" />
</Frame>
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="WorkFlowCheck.MAUI.Pages.Media.CaptureImagePage"
Title="CaptureImagePage">
<VerticalStackLayout>
<!-- Gomb a kép készítéséhez -->
<Button Text="Kép készítése"
Clicked="OnCaptureClicked" />
<!-- Kép megjelenítése -->
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True">
<Image x:Name="CapturedImage"
HeightRequest="200"
Aspect="AspectFit" />
</Frame>
</VerticalStackLayout>
</ContentPage>
@@ -1,55 +1,55 @@
using CommunityToolkit.Maui.Views;
using Microsoft.Maui.Controls;
using System;
using Microsoft.Maui.Storage;
namespace WorkFlowCheck.MAUI.Pages.Media;
public partial class CaptureImagePage : ContentPage
{
public CaptureImagePage()
{
InitializeComponent();
}
private async void OnCaptureClicked(object sender, EventArgs e)
{
try
{
// Ellenőrizzük, hogy a MediaPicker elérhető-e az eszközön
if (MediaPicker.IsCaptureSupported)
{
// Kép készítése
var photo = await MediaPicker.CapturePhotoAsync();
// A kép mentése a fájlrendszerbe
var filePath = Path.Combine(FileSystem.CacheDirectory, "captured_photo.jpg");
// A kép átmásolása a kívánt helyre
using (var stream = await photo.OpenReadAsync())
using (var fileStream = File.OpenWrite(filePath))
{
await stream.CopyToAsync(fileStream);
}
// A kép megjelenítése
CapturedImage.Source = ImageSource.FromFile(filePath);
}
else
{
// Ha a MediaPicker nem elérhető, hibaüzenet
Console.WriteLine("A fényképezés nem támogatott ezen az eszközön.");
}
}
catch (Exception ex)
{
// Hiba kezelése
Console.WriteLine($"Hiba történt a fényképezés közben: {ex.Message}");
}
}
using CommunityToolkit.Maui.Views;
using Microsoft.Maui.Controls;
using System;
using Microsoft.Maui.Storage;
namespace WorkFlowCheck.MAUI.Pages.Media;
public partial class CaptureImagePage : ContentPage
{
public CaptureImagePage()
{
InitializeComponent();
}
private async void OnCaptureClicked(object sender, EventArgs e)
{
try
{
// Ellenőrizzük, hogy a MediaPicker elérhető-e az eszközön
if (MediaPicker.IsCaptureSupported)
{
// Kép készítése
var photo = await MediaPicker.CapturePhotoAsync();
// A kép mentése a fájlrendszerbe
var filePath = Path.Combine(FileSystem.CacheDirectory, "captured_photo.jpg");
// A kép átmásolása a kívánt helyre
using (var stream = await photo.OpenReadAsync())
using (var fileStream = File.OpenWrite(filePath))
{
await stream.CopyToAsync(fileStream);
}
// A kép megjelenítése
CapturedImage.Source = ImageSource.FromFile(filePath);
}
else
{
// Ha a MediaPicker nem elérhető, hibaüzenet
Console.WriteLine("A fényképezés nem támogatott ezen az eszközön.");
}
}
catch (Exception ex)
{
// Hiba kezelése
Console.WriteLine($"Hiba történt a fényképezés közben: {ex.Message}");
}
}
}
+17 -17
View File
@@ -1,17 +1,17 @@
using Plugin.NFC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Pages.NFC
{
public class NFCData
{
public string DateReceived { get; set; }
public string SerialNumber { get; set; } = null!;
}
}
using Plugin.NFC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Pages.NFC
{
public class NFCData
{
public string DateReceived { get; set; }
public string SerialNumber { get; set; } = null!;
}
}
@@ -1,54 +1,54 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCTestPage"
BackgroundColor="#f0f0f0"
Title="NFC teszt ">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="NFC olvasási teszt"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="NFCDataListCollection" ItemsSource="{Binding NFCDataList}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True">
<StackLayout>
<Label Text="{Binding SerialNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateReceived}" FontSize="14" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCTestPage"
BackgroundColor="#f0f0f0"
Title="NFC teszt ">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="NFC olvasási teszt"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="NFCDataListCollection" ItemsSource="{Binding NFCDataList}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True">
<StackLayout>
<Label Text="{Binding SerialNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateReceived}" FontSize="14" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</ContentPage>
@@ -1,196 +1,196 @@
using Plugin.NFC;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using System.Linq;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using Android.DeviceLock;
namespace WorkFlowCheck.MAUI.Pages.NFC;
public partial class NFCTestPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public NFCTestPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
public ObservableCollection<NFCData> NFCDataList { get; set; }
public ICommand RefreshCommand { get; set; }
public const string ALERT_TITLE = "NFC";
bool _eventsAlreadySubscribed = false;
public bool IsRefreshing { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
SetInfo();
CrossNFC.Legacy = false;
if (CrossNFC.IsSupported)
{
if (!CrossNFC.Current.IsAvailable)
await ShowAlert("NFC is not available");
if (!CrossNFC.Current.IsEnabled)
await ShowAlert("NFC is disabled");
await AutoStartAsync().ConfigureAwait(false);
}
else
{
await ShowAlert("NFC is not available");
}
RefreshCommand = new Command(async () => await LoadNFCDataList());
BindingContext = this;
}
Task ShowAlert(string message, string title = null) => DisplayAlert(string.IsNullOrWhiteSpace(title) ? ALERT_TITLE : title, message, "OK");
async Task AutoStartAsync()
{
// Some delay to prevent Java.Lang.IllegalStateException "Foreground dispatch can only be enabled when your activity is resumed" on Android
await Task.Delay(500);
await StartListeningIfNotiOS();
}
async Task StartListeningIfNotiOS()
{
await BeginListening();
}
async Task BeginListening()
{
try
{
MainThread.BeginInvokeOnMainThread(() =>
{
SubscribeEvents();
CrossNFC.Current.StartListening();
});
}
catch (Exception ex)
{
await ShowAlert(ex.Message);
}
}
void SubscribeEvents()
{
if (_eventsAlreadySubscribed)
UnsubscribeEvents();
_eventsAlreadySubscribed = true;
CrossNFC.Current.OnMessageReceived += Current_OnMessageReceived_NFCData;
//CrossNFC.Current.OnMessagePublished += Current_OnMessagePublished;
//CrossNFC.Current.OnTagDiscovered += Current_OnTagDiscovered;
//CrossNFC.Current.OnNfcStatusChanged += Current_OnNfcStatusChanged;
//CrossNFC.Current.OnTagListeningStatusChanged += Current_OnTagListeningStatusChanged;
}
void UnsubscribeEvents()
{
CrossNFC.Current.OnMessageReceived -= Current_OnMessageReceived_NFCData;
//CrossNFC.Current.OnMessagePublished -= Current_OnMessagePublished;
//CrossNFC.Current.OnTagDiscovered -= Current_OnTagDiscovered;
//CrossNFC.Current.OnNfcStatusChanged -= Current_OnNfcStatusChanged;
//CrossNFC.Current.OnTagListeningStatusChanged -= Current_OnTagListeningStatusChanged;
_eventsAlreadySubscribed = false;
}
async void Current_OnMessageReceived(ITagInfo tagInfo)
{
if (tagInfo == null)
{
await ShowAlert("No tag found");
return;
}
// Customized serial number
var identifier = tagInfo.Identifier;
var serialNumber = NFCUtils.ByteArrayToHexString(identifier, ":");
var title = !string.IsNullOrWhiteSpace(serialNumber) ? $"Tag [{serialNumber}]" : "Tag Info";
if (!tagInfo.IsSupported)
{
await ShowAlert("Unsupported tag (app)", title);
}
else if (tagInfo.IsEmpty)
{
await ShowAlert("Empty tag", title);
}
else
{
var first = tagInfo.Records[0];
await ShowAlert(GetMessage(first), title);
}
}
async void Current_OnMessageReceived_NFCData(ITagInfo tagInfo)
{
if (tagInfo == null)
{
await ShowAlert("No tag found");
return;
}
// Customized serial number
var identifier = tagInfo.Identifier;
var serialNumber = NFCUtils.ByteArrayToHexString(identifier, "");
if (NFCDataList == null)
{
NFCDataList = new ObservableCollection<NFCData>();
}
NFCDataList.Add(new NFCData()
{
SerialNumber = serialNumber,
DateReceived = $"{DateTime.Now.Date.ToShortDateString()} {DateTime.Now.ToLongTimeString()}"
});
NFCDataListCollection.ItemsSource = NFCDataList.OrderByDescending(o => o.DateReceived);
await LoadNFCDataList();
}
private async Task LoadNFCDataList()
{
IsRefreshing = true;
IsRefreshing = false;
OnPropertyChanged(nameof(IsRefreshing));
OnPropertyChanged(nameof(NFCDataList));
}
string GetMessage(NFCNdefRecord record)
{
var message = $"Message: {record.Message}";
message += Environment.NewLine;
message += $"RawMessage: {Encoding.UTF8.GetString(record.Payload)}";
message += Environment.NewLine;
message += $"Type: {record.TypeFormat}";
if (!string.IsNullOrWhiteSpace(record.MimeType))
{
message += Environment.NewLine;
message += $"MimeType: {record.MimeType}";
}
return message;
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
using Plugin.NFC;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using System.Linq;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using Android.DeviceLock;
namespace WorkFlowCheck.MAUI.Pages.NFC;
public partial class NFCTestPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public NFCTestPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
public ObservableCollection<NFCData> NFCDataList { get; set; }
public ICommand RefreshCommand { get; set; }
public const string ALERT_TITLE = "NFC";
bool _eventsAlreadySubscribed = false;
public bool IsRefreshing { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
SetInfo();
CrossNFC.Legacy = false;
if (CrossNFC.IsSupported)
{
if (!CrossNFC.Current.IsAvailable)
await ShowAlert("NFC is not available");
if (!CrossNFC.Current.IsEnabled)
await ShowAlert("NFC is disabled");
await AutoStartAsync().ConfigureAwait(false);
}
else
{
await ShowAlert("NFC is not available");
}
RefreshCommand = new Command(async () => await LoadNFCDataList());
BindingContext = this;
}
Task ShowAlert(string message, string title = null) => DisplayAlert(string.IsNullOrWhiteSpace(title) ? ALERT_TITLE : title, message, "OK");
async Task AutoStartAsync()
{
// Some delay to prevent Java.Lang.IllegalStateException "Foreground dispatch can only be enabled when your activity is resumed" on Android
await Task.Delay(500);
await StartListeningIfNotiOS();
}
async Task StartListeningIfNotiOS()
{
await BeginListening();
}
async Task BeginListening()
{
try
{
MainThread.BeginInvokeOnMainThread(() =>
{
SubscribeEvents();
CrossNFC.Current.StartListening();
});
}
catch (Exception ex)
{
await ShowAlert(ex.Message);
}
}
void SubscribeEvents()
{
if (_eventsAlreadySubscribed)
UnsubscribeEvents();
_eventsAlreadySubscribed = true;
CrossNFC.Current.OnMessageReceived += Current_OnMessageReceived_NFCData;
//CrossNFC.Current.OnMessagePublished += Current_OnMessagePublished;
//CrossNFC.Current.OnTagDiscovered += Current_OnTagDiscovered;
//CrossNFC.Current.OnNfcStatusChanged += Current_OnNfcStatusChanged;
//CrossNFC.Current.OnTagListeningStatusChanged += Current_OnTagListeningStatusChanged;
}
void UnsubscribeEvents()
{
CrossNFC.Current.OnMessageReceived -= Current_OnMessageReceived_NFCData;
//CrossNFC.Current.OnMessagePublished -= Current_OnMessagePublished;
//CrossNFC.Current.OnTagDiscovered -= Current_OnTagDiscovered;
//CrossNFC.Current.OnNfcStatusChanged -= Current_OnNfcStatusChanged;
//CrossNFC.Current.OnTagListeningStatusChanged -= Current_OnTagListeningStatusChanged;
_eventsAlreadySubscribed = false;
}
async void Current_OnMessageReceived(ITagInfo tagInfo)
{
if (tagInfo == null)
{
await ShowAlert("No tag found");
return;
}
// Customized serial number
var identifier = tagInfo.Identifier;
var serialNumber = NFCUtils.ByteArrayToHexString(identifier, ":");
var title = !string.IsNullOrWhiteSpace(serialNumber) ? $"Tag [{serialNumber}]" : "Tag Info";
if (!tagInfo.IsSupported)
{
await ShowAlert("Unsupported tag (app)", title);
}
else if (tagInfo.IsEmpty)
{
await ShowAlert("Empty tag", title);
}
else
{
var first = tagInfo.Records[0];
await ShowAlert(GetMessage(first), title);
}
}
async void Current_OnMessageReceived_NFCData(ITagInfo tagInfo)
{
if (tagInfo == null)
{
await ShowAlert("No tag found");
return;
}
// Customized serial number
var identifier = tagInfo.Identifier;
var serialNumber = NFCUtils.ByteArrayToHexString(identifier, "");
if (NFCDataList == null)
{
NFCDataList = new ObservableCollection<NFCData>();
}
NFCDataList.Add(new NFCData()
{
SerialNumber = serialNumber,
DateReceived = $"{DateTime.Now.Date.ToShortDateString()} {DateTime.Now.ToLongTimeString()}"
});
NFCDataListCollection.ItemsSource = NFCDataList.OrderByDescending(o => o.DateReceived);
await LoadNFCDataList();
}
private async Task LoadNFCDataList()
{
IsRefreshing = true;
IsRefreshing = false;
OnPropertyChanged(nameof(IsRefreshing));
OnPropertyChanged(nameof(NFCDataList));
}
string GetMessage(NFCNdefRecord record)
{
var message = $"Message: {record.Message}";
message += Environment.NewLine;
message += $"RawMessage: {Encoding.UTF8.GetString(record.Payload)}";
message += Environment.NewLine;
message += $"Type: {record.TypeFormat}";
if (!string.IsNullOrWhiteSpace(record.MimeType))
{
message += Environment.NewLine;
message += $"MimeType: {record.MimeType}";
}
return message;
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
}
+30 -30
View File
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCWaiter"
Title="Várakozás NFC olvasásra"
BackgroundColor="#f0f0f0">
<Frame BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
Padding="30"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=450, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20" Padding="20" HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="Tartsa a készülékhez az NFC tag-et..."
TextColor="Black"
FontSize="20"
HorizontalOptions="Center" />
<ActivityIndicator IsRunning="True" />
<Button x:Name="CancelButton"
Text="Mégse"
FontSize="18"
TextColor="White"
HorizontalOptions="Fill"
Clicked="OnCancelButtonClicked" />
</VerticalStackLayout>
</Frame>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCWaiter"
Title="Várakozás NFC olvasásra"
BackgroundColor="#f0f0f0">
<Frame BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
Padding="30"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=450, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20" Padding="20" HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="Tartsa a készülékhez az NFC tag-et..."
TextColor="Black"
FontSize="20"
HorizontalOptions="Center" />
<ActivityIndicator IsRunning="True" />
<Button x:Name="CancelButton"
Text="Mégse"
FontSize="18"
TextColor="White"
HorizontalOptions="Fill"
Clicked="OnCancelButtonClicked" />
</VerticalStackLayout>
</Frame>
</ContentPage>
@@ -1,92 +1,92 @@
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Pages.NFC;
public partial class NFCWaiter : ContentPage
{
private bool _nfcIsActive = false;
private TaskCompletionSource<string> _taskCompletionSource = new();
public static async Task<string> ShowModalAsync()
{
var page = new NFCWaiter();
await Shell.Current.Navigation.PushModalAsync(page);
return await page._taskCompletionSource.Task;
}
public NFCWaiter()
{
InitializeComponent();
}
protected override async void OnAppearing()
{
base.OnAppearing();
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
mainActivity.StartNfc(OnTagRead);
_nfcIsActive = true;
}
#endif
await MainThread.InvokeOnMainThreadAsync(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(30));
Finish(null);
});
}
protected override void OnDisappearing()
{
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
mainActivity.StopNfc();
}
#endif
base.OnDisappearing();
}
private void OnTagRead(string tagId)
{
Finish(tagId);
}
private async Task Finish(string tagId)
{
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
if (_nfcIsActive)
{
mainActivity.StopNfc();
_nfcIsActive = false;
}
}
#endif
if (!_taskCompletionSource.Task.IsCompleted)
_taskCompletionSource.SetResult(tagId);
if (Navigation.ModalStack.Count > 0)
{
await Shell.Current.Navigation.PopModalAsync();
}
}
private async void OnCancelButtonClicked(object sender, EventArgs e)
{
await Finish("");
}
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Pages.NFC;
public partial class NFCWaiter : ContentPage
{
private bool _nfcIsActive = false;
private TaskCompletionSource<string> _taskCompletionSource = new();
public static async Task<string> ShowModalAsync()
{
var page = new NFCWaiter();
await Shell.Current.Navigation.PushModalAsync(page);
return await page._taskCompletionSource.Task;
}
public NFCWaiter()
{
InitializeComponent();
}
protected override async void OnAppearing()
{
base.OnAppearing();
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
mainActivity.StartNfc(OnTagRead);
_nfcIsActive = true;
}
#endif
await MainThread.InvokeOnMainThreadAsync(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(30));
Finish(null);
});
}
protected override void OnDisappearing()
{
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
mainActivity.StopNfc();
}
#endif
base.OnDisappearing();
}
private void OnTagRead(string tagId)
{
Finish(tagId);
}
private async Task Finish(string tagId)
{
#if ANDROID
if (Platform.CurrentActivity is Android.App.Activity activity && activity is MainActivity mainActivity)
{
if (_nfcIsActive)
{
mainActivity.StopNfc();
_nfcIsActive = false;
}
}
#endif
if (!_taskCompletionSource.Task.IsCompleted)
_taskCompletionSource.SetResult(tagId);
if (Navigation.ModalStack.Count > 0)
{
await Shell.Current.Navigation.PopModalAsync();
}
}
private async void OnCancelButtonClicked(object sender, EventArgs e)
{
await Finish("");
}
}
@@ -1,85 +1,85 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages"
Title=""
BackgroundColor="#f0f0f0">
<ContentView x:Name="LoginContent">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
<Frame Grid.Row="1"
BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
Padding="30"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20">
<Label Text="Bejelentkezés"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center"
TextColor="#333" />
<Entry x:Name="UsernameEntry"
Placeholder="Felhasználói név"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<Entry x:Name="PasswordEntry"
Placeholder="PIN kód"
IsPassword="True"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
</HorizontalStackLayout>
<Button x:Name="LoginBtn"
Text="Bejelentkezés"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
TextColor="White"
ImageSource="check_circle.svg"
Clicked="OnLoginClicked" />
<Button x:Name="LoginNFCBtn"
Text="NFC azonosítás"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
TextColor="White"
Clicked="OnLoginNFCClicked" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentView>
</local:BasePage>
<?xml version="1.0" encoding="utf-8" ?>
<local:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages"
Title=""
BackgroundColor="#f0f0f0">
<ContentView x:Name="LoginContent">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
<Frame Grid.Row="1"
BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
Padding="30"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20">
<Label Text="Bejelentkezés"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center"
TextColor="#333" />
<Entry x:Name="UsernameEntry"
Placeholder="Felhasználói név"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<Entry x:Name="PasswordEntry"
Placeholder="PIN kód"
IsPassword="True"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
</HorizontalStackLayout>
<Button x:Name="LoginBtn"
Text="Bejelentkezés"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
TextColor="White"
ImageSource="check_circle.svg"
Clicked="OnLoginClicked" />
<Button x:Name="LoginNFCBtn"
Text="NFC azonosítás"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
TextColor="White"
Clicked="OnLoginNFCClicked" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentView>
</local:BasePage>
@@ -1,202 +1,202 @@
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using Plugin.Firebase.CloudMessaging;
using System.Drawing;
using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class LoginPage : BasePage
{
private IUserService _userService;
private ISyncService _syncService;
public LoginPage()
{
InitializeComponent();
SetContent(LoginContent);
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
Title = $"Workflow Check Application ({SystemHelper.ProgramVersion})";
}
private async void OnLoginClicked(object sender, EventArgs e)
{
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
LoginBtn.IsEnabled = false;
UsernameEntry.IsEnabled = false;
PasswordEntry.IsEnabled = false;
try
{
var response = await _userService.Authenticate(UsernameEntry.Text.ToString(), PasswordEntry.Text.ToString());
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data;
var needFCM = false;
foreach (var role in response.Data.RoleDTO)
{
if (role.CanEnableBlocked)
{
needFCM = true;
break;
}
}
if (needFCM)
{
await InitFirebase();
}
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
await SecureStorage.Default.SetAsync("AuthToken", response.Data.JwtToken);
await Shell.Current.GoToAsync("//SyncPage");
}
else
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
}
catch (Exception ex)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
finally
{
LoginBtn.IsEnabled = true;
LoadingIndicator.IsRunning = false;
LoadingIndicator.IsVisible = false;
UsernameEntry.IsEnabled = true;
PasswordEntry.IsEnabled = true;
}
}
private async void OnLoginNFCClicked(object sender, EventArgs e)
{
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
LoginBtn.IsEnabled = false;
LoginNFCBtn.IsEnabled = false;
UsernameEntry.IsEnabled = false;
PasswordEntry.IsEnabled = false;
try
{
var nFCCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(nFCCode))
{
var response = await _userService.AuthenticateNFC(nFCCode);
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data;
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
await SecureStorage.Default.SetAsync("AuthToken", response.Data.JwtToken);
await Shell.Current.GoToAsync("//SyncPage");
}
else
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
}
}
catch (Exception)
{
throw;
}
finally
{
LoginBtn.IsEnabled = true;
LoginNFCBtn.IsEnabled = true;
LoadingIndicator.IsRunning = false;
LoadingIndicator.IsVisible = false;
UsernameEntry.IsEnabled = true;
PasswordEntry.IsEnabled = true;
LoginNFCBtn.IsEnabled = true;
}
}
private async Task InitFirebase()
{
try
{
await CrossFirebaseCloudMessaging.Current.CheckIfValidAsync();
var token = await CrossFirebaseCloudMessaging.Current.GetTokenAsync();
await _syncService.UploadFCMToken(token);
}
catch (Exception ex)
{
await SystemHelper.ShowSnackBar("FCM üzenetküldõ inicializálása SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using Plugin.Firebase.CloudMessaging;
using System.Drawing;
using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class LoginPage : BasePage
{
private IUserService _userService;
private ISyncService _syncService;
public LoginPage()
{
InitializeComponent();
SetContent(LoginContent);
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
Title = $"Workflow Check Application ({SystemHelper.ProgramVersion})";
}
private async void OnLoginClicked(object sender, EventArgs e)
{
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
LoginBtn.IsEnabled = false;
UsernameEntry.IsEnabled = false;
PasswordEntry.IsEnabled = false;
try
{
var response = await _userService.Authenticate(UsernameEntry.Text.ToString(), PasswordEntry.Text.ToString());
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data;
var needFCM = false;
foreach (var role in response.Data.RoleDTO)
{
if (role.CanEnableBlocked)
{
needFCM = true;
break;
}
}
if (needFCM)
{
await InitFirebase();
}
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
await SecureStorage.Default.SetAsync("AuthToken", response.Data.JwtToken);
await Shell.Current.GoToAsync("//SyncPage");
}
else
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
}
catch (Exception ex)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
finally
{
LoginBtn.IsEnabled = true;
LoadingIndicator.IsRunning = false;
LoadingIndicator.IsVisible = false;
UsernameEntry.IsEnabled = true;
PasswordEntry.IsEnabled = true;
}
}
private async void OnLoginNFCClicked(object sender, EventArgs e)
{
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
LoginBtn.IsEnabled = false;
LoginNFCBtn.IsEnabled = false;
UsernameEntry.IsEnabled = false;
PasswordEntry.IsEnabled = false;
try
{
var nFCCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(nFCCode))
{
var response = await _userService.AuthenticateNFC(nFCCode);
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data;
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
await SecureStorage.Default.SetAsync("AuthToken", response.Data.JwtToken);
await Shell.Current.GoToAsync("//SyncPage");
}
else
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
}
}
}
catch (Exception)
{
throw;
}
finally
{
LoginBtn.IsEnabled = true;
LoginNFCBtn.IsEnabled = true;
LoadingIndicator.IsRunning = false;
LoadingIndicator.IsVisible = false;
UsernameEntry.IsEnabled = true;
PasswordEntry.IsEnabled = true;
LoginNFCBtn.IsEnabled = true;
}
}
private async Task InitFirebase()
{
try
{
await CrossFirebaseCloudMessaging.Current.CheckIfValidAsync();
var token = await CrossFirebaseCloudMessaging.Current.GetTokenAsync();
await _syncService.UploadFCMToken(token);
}
catch (Exception ex)
{
await SystemHelper.ShowSnackBar("FCM üzenetküldõ inicializálása SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
@@ -1,41 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.UsersPage"
Title="Felhasználók">
<StackLayout>
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button
x:Name="ButtonSync" Margin="5"
Text="Adatok szinkronizálása"
SemanticProperties.Hint="Adatok szinkronizálása"
Clicked="OnButtonSync"
HorizontalOptions="Fill" />
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="UsersList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding FullName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding NFCCode}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5">
<Button Text="Párosítás" Margin="5,0,0,0"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
Command="{Binding BindingContext.PairCommand, Source={x:Reference UsersList}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</StackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.UsersPage"
Title="Felhasználók">
<StackLayout>
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button
x:Name="ButtonSync" Margin="5"
Text="Adatok szinkronizálása"
SemanticProperties.Hint="Adatok szinkronizálása"
Clicked="OnButtonSync"
HorizontalOptions="Fill" />
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="UsersList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding FullName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding NFCCode}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5">
<Button Text="Párosítás" Margin="5,0,0,0"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
Command="{Binding BindingContext.PairCommand, Source={x:Reference UsersList}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</StackLayout>
</ContentPage>
@@ -1,101 +1,101 @@
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using WorkFlowCheck.MAUI.Pages.NFC;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class UsersPage : ContentPage
{
private readonly IUserService _userService;
private readonly ISyncService _syncService;
public UsersPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}
public ICommand RefreshCommand { get; set; }
public ICommand PairCommand { get; set; }
public bool IsRefreshing { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
RefreshCommand = new Command(async () => await LoadUsers());
PairCommand = new Command<MobileUserDTO>(OnPairItem);
BindingContext = this;
await LoadUsers();
}
private async Task LoadUsers()
{
IsRefreshing = true;
//await _syncService.SyncDatas();
UsersList.ItemsSource = await _userService.GetAllMobileUserAsync();
IsRefreshing = false;
OnPropertyChanged(nameof(IsRefreshing));
}
private async void OnPairItem(MobileUserDTO mobileUserDTO)
{
var UserCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(UserCode))
{
if (Navigation.ModalStack.Count > 0)
{
await Navigation.PopModalAsync();
}
if (mobileUserDTO != null)
{
mobileUserDTO.NFCCode = UserCode;
await _userService.UpdateCheckPoint(mobileUserDTO);
await LoadUsers();
}
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
private async void OnButtonSync(object sender, EventArgs e)
{
IsRefreshing = true;
ButtonSync.IsEnabled = false;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncUsers_Up((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
ButtonSync.IsEnabled = true;
IsRefreshing = false;
}
}
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using WorkFlowCheck.MAUI.Pages.NFC;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class UsersPage : ContentPage
{
private readonly IUserService _userService;
private readonly ISyncService _syncService;
public UsersPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}
public ICommand RefreshCommand { get; set; }
public ICommand PairCommand { get; set; }
public bool IsRefreshing { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
RefreshCommand = new Command(async () => await LoadUsers());
PairCommand = new Command<MobileUserDTO>(OnPairItem);
BindingContext = this;
await LoadUsers();
}
private async Task LoadUsers()
{
IsRefreshing = true;
//await _syncService.SyncDatas();
UsersList.ItemsSource = await _userService.GetAllMobileUserAsync();
IsRefreshing = false;
OnPropertyChanged(nameof(IsRefreshing));
}
private async void OnPairItem(MobileUserDTO mobileUserDTO)
{
var UserCode = await NFCWaiter.ShowModalAsync();
if (!string.IsNullOrEmpty(UserCode))
{
if (Navigation.ModalStack.Count > 0)
{
await Navigation.PopModalAsync();
}
if (mobileUserDTO != null)
{
mobileUserDTO.NFCCode = UserCode;
await _userService.UpdateCheckPoint(mobileUserDTO);
await LoadUsers();
}
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
private async void OnButtonSync(object sender, EventArgs e)
{
IsRefreshing = true;
ButtonSync.IsEnabled = false;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncUsers_Up((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
ButtonSync.IsEnabled = true;
IsRefreshing = false;
}
}
}
@@ -1,71 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.System.DownloadAPKPage"
BackgroundColor="#f0f0f0"
Title="Program letöltés">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Program letöltés"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Frame
Grid.Row="1"
BorderColor="Gray"
CornerRadius="20"
Padding="30"
Margin="1"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Margin="10,10,10,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button x:Name="SyncBtn" Text="Program letöltés" Clicked="OnSyncClicked" Margin="10,10,10,10" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.System.DownloadAPKPage"
BackgroundColor="#f0f0f0"
Title="Program letöltés">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Program letöltés"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Frame
Grid.Row="1"
BorderColor="Gray"
CornerRadius="20"
Padding="30"
Margin="1"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Margin="10,10,10,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button x:Name="SyncBtn" Text="Program letöltés" Clicked="OnSyncClicked" Margin="10,10,10,10" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentPage>
@@ -1,70 +1,70 @@
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class DownloadAPKPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public DownloadAPKPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Letöltés indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.DownloadAPK((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Letöltés kész!";
await Shell.Current.GoToAsync("//MainPage");
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class DownloadAPKPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public DownloadAPKPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Letöltés indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.DownloadAPK((percentage, infostring) =>
{
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
progressLabel.Text = "Letöltés kész!";
await Shell.Current.GoToAsync("//MainPage");
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
}
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:popups="clr-namespace:WorkFlowCheck.MAUI.Pages.System"
x:Class="WorkFlowCheck.MAUI.Pages.System.InputPopup">
<toolkit:Popup.Resources>
<Style TargetType="{x:Type popups:InputPopup}">
<Setter Property="Size" Value="400,150" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
</Style>
</toolkit:Popup.Resources>
<VerticalStackLayout Padding="20" Spacing="10">
<Label x:Name="UserConfirmationLabel" />
<Entry x:Name="UserInputEntry" />
<HorizontalStackLayout HorizontalOptions="End" Spacing="10">
<Button Text="Mégsem" Clicked="OnCancelClicked" />
<Button Text="Megerősít" Clicked="OnOkClicked" />
</HorizontalStackLayout>
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:popups="clr-namespace:WorkFlowCheck.MAUI.Pages.System"
x:Class="WorkFlowCheck.MAUI.Pages.System.InputPopup">
<toolkit:Popup.Resources>
<Style TargetType="{x:Type popups:InputPopup}">
<Setter Property="Size" Value="400,150" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
</Style>
</toolkit:Popup.Resources>
<VerticalStackLayout Padding="20" Spacing="10">
<Label x:Name="UserConfirmationLabel" />
<Entry x:Name="UserInputEntry" />
<HorizontalStackLayout HorizontalOptions="End" Spacing="10">
<Button Text="Mégsem" Clicked="OnCancelClicked" />
<Button Text="Megerősít" Clicked="OnOkClicked" />
</HorizontalStackLayout>
</VerticalStackLayout>
</toolkit:Popup>
@@ -1,42 +1,42 @@
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Views;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class InputPopup : Popup
{
private TaskCompletionSource<(bool IsConfirmed, string Result)> _taskCompletionSource;
public InputPopup(string userConfirmationLabel)
{
InitializeComponent();
_taskCompletionSource = new();
UserConfirmationLabel.Text = userConfirmationLabel;
this.Closed += OnPopupClosed;
}
public Task<(bool IsConfirmed, string Result)> ShowAsync()
{
Application.Current.MainPage.ShowPopup(this);
return _taskCompletionSource.Task;
}
private void OnOkClicked(object sender, EventArgs e)
{
Close((true, UserInputEntry.Text));
}
private void OnCancelClicked(object sender, EventArgs e)
{
Close((false, ""));
}
private void OnPopupClosed(object sender, PopupClosedEventArgs e)
{
if (e?.Result is ValueTuple<bool, string> value)
{
_taskCompletionSource.TrySetResult(value);
}
else
{
_taskCompletionSource.TrySetResult((false, null));
}
}
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Views;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class InputPopup : Popup
{
private TaskCompletionSource<(bool IsConfirmed, string Result)> _taskCompletionSource;
public InputPopup(string userConfirmationLabel)
{
InitializeComponent();
_taskCompletionSource = new();
UserConfirmationLabel.Text = userConfirmationLabel;
this.Closed += OnPopupClosed;
}
public Task<(bool IsConfirmed, string Result)> ShowAsync()
{
Application.Current.MainPage.ShowPopup(this);
return _taskCompletionSource.Task;
}
private void OnOkClicked(object sender, EventArgs e)
{
Close((true, UserInputEntry.Text));
}
private void OnCancelClicked(object sender, EventArgs e)
{
Close((false, ""));
}
private void OnPopupClosed(object sender, PopupClosedEventArgs e)
{
if (e?.Result is ValueTuple<bool, string> value)
{
_taskCompletionSource.TrySetResult(value);
}
else
{
_taskCompletionSource.TrySetResult((false, null));
}
}
}
@@ -1,71 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.System.SyncPage"
Title="Adatok szinkronizálása"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Adatok szinkronizálása"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Frame
Grid.Row="1"
BorderColor="Gray"
CornerRadius="20"
Padding="30"
Margin="1"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Margin="10,10,10,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button x:Name="SyncBtn" Text="Adat szinkronizálás" Clicked="OnSyncClicked" Margin="10,10,10,10" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.System.SyncPage"
Title="Adatok szinkronizálása"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Adatok szinkronizálása"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Frame
Grid.Row="1"
BorderColor="Gray"
CornerRadius="20"
Padding="30"
Margin="1"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Margin="10,10,10,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
<Button x:Name="SyncBtn" Text="Adat szinkronizálás" Clicked="OnSyncClicked" Margin="10,10,10,10" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentPage>
@@ -1,85 +1,85 @@
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class SyncPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public SyncPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncDatas((percentage, infostring) =>
{
// Direkt UI frissítés
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
SystemHelper.Syncronised = true;
progressLabel.Text = "Szinkronizálás befejezve!";
await Shell.Current.GoToAsync("//MainPage");
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
private async Task SimulateLongRunningTask(IProgress<double> progress)
{
int totalSteps = 50;
for (int i = 1; i <= totalSteps; i++)
{
await Task.Delay(100); // Szimulált hosszú mûvelet
double percentage = (double)i / totalSteps * 100;
progress.Report(percentage);
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class SyncPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public SyncPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncDatas((percentage, infostring) =>
{
// Direkt UI frissítés
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
SystemHelper.Syncronised = true;
progressLabel.Text = "Szinkronizálás befejezve!";
await Shell.Current.GoToAsync("//MainPage");
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
private async Task SimulateLongRunningTask(IProgress<double> progress)
{
int totalSteps = 50;
for (int i = 1; i <= totalSteps; i++)
{
await Task.Delay(100); // Szimulált hosszú mûvelet
double percentage = (double)i / totalSteps * 100;
progress.Report(percentage);
}
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
}