Alap funkció működés CheckPoints

This commit is contained in:
2025-02-12 20:00:49 +01:00
parent ac80a8a9bb
commit f57fef804d
23 changed files with 266 additions and 8 deletions
+7
View File
@@ -7,6 +7,7 @@
xmlns:security="clr-namespace:WorkFlowCheck.MAUI.Pages.Security" xmlns:security="clr-namespace:WorkFlowCheck.MAUI.Pages.Security"
xmlns:nfc="clr-namespace:WorkFlowCheck.MAUI.Pages.NFC" xmlns:nfc="clr-namespace:WorkFlowCheck.MAUI.Pages.NFC"
xmlns:system="clr-namespace:WorkFlowCheck.MAUI.Pages.System" xmlns:system="clr-namespace:WorkFlowCheck.MAUI.Pages.System"
xmlns:base="clr-namespace:WorkFlowCheck.MAUI.Pages.BaseStock"
Shell.FlyoutBehavior="Disabled" Shell.FlyoutBehavior="Disabled"
Title="WorkFlowCheck.MAUI"> Title="WorkFlowCheck.MAUI">
@@ -15,4 +16,10 @@
<ShellContent Title="NFC Test" ContentTemplate="{DataTemplate nfc:NFCTestPage}" Route="NFCTestPage" /> <ShellContent Title="NFC Test" ContentTemplate="{DataTemplate nfc:NFCTestPage}" Route="NFCTestPage" />
<ShellContent Title="Sync data" ContentTemplate="{DataTemplate system:SyncPage}" Route="SyncPage" /> <ShellContent Title="Sync data" ContentTemplate="{DataTemplate system:SyncPage}" Route="SyncPage" />
<ShellContent Title="Base" ContentTemplate="{DataTemplate base:BaseStockPage}" Route="BaseStockPage" />
<ShellContent Title="Checkpoints" ContentTemplate="{DataTemplate base:CheckPointsPage}" Route="CheckPointsPage" />
<ShellContent Title="Equipments" ContentTemplate="{DataTemplate base:EquipmentsPage}" Route="EquipmentsPage" />
<ShellContent Title="Locations" ContentTemplate="{DataTemplate base:LocationsPage}" Route="LocationsPage" />
</Shell> </Shell>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.ContentViews.HeaderView">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,9 @@
namespace WorkFlowCheck.MAUI.ContentViews;
public partial class HeaderView : ContentView
{
public HeaderView()
{
InitializeComponent();
}
}
+7 -1
View File
@@ -36,7 +36,13 @@
Text="Sync data" Text="Sync data"
SemanticProperties.Hint="Sync data" SemanticProperties.Hint="Sync data"
Clicked="OnButtonSync" Clicked="OnButtonSync"
HorizontalOptions="Fill" /> HorizontalOptions="Fill" />
<Button
x:Name="ButtonBase"
Text="Base"
SemanticProperties.Hint="Base"
Clicked="OnButtonBaseStock"
HorizontalOptions="Fill" />
<Button <Button
x:Name="CounterBtn" x:Name="CounterBtn"
Text="Hahó II." Text="Hahó II."
+5 -1
View File
@@ -1,5 +1,5 @@
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services; using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
@@ -48,6 +48,10 @@ namespace WorkFlowCheck.MAUI
{ {
await Shell.Current.GoToAsync("//NFCTestPage"); await Shell.Current.GoToAsync("//NFCTestPage");
} }
private async void OnButtonBaseStock(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//BaseStockPage");
}
private void OnButtonLogout(object sender, EventArgs e) private void OnButtonLogout(object sender, EventArgs e)
{ {
SecureStorage.Default.Remove("WFCUser"); SecureStorage.Default.Remove("WFCUser");
+3 -1
View File
@@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
using CommunityToolkit.Maui; using CommunityToolkit.Maui;
using WorkFlowCheck.MAUI.DataLayer; using WorkFlowCheck.MAUI.DataLayer;
using WorkFlowCheck.MAUI.Mapper; using WorkFlowCheck.MAUI.Mapper;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
@@ -38,7 +39,8 @@ namespace WorkFlowCheck.MAUI
builder.Services.AddSingleton<IConfiguration>(configuration); builder.Services.AddSingleton<IConfiguration>(configuration);
builder.Services.AddSingleton<IUserService, UserService>(); builder.Services.AddSingleton<IUserService, UserService>();
builder.Services.AddSingleton<ISyncService, SyncService>(); builder.Services.AddSingleton<ISyncService, SyncService>();
builder.Services.AddSingleton<IBaseStockService, BaseStockService>();
builder.Services.AddTransient<MainPage>(); builder.Services.AddTransient<MainPage>();
builder.UseMauiApp<App>().ConfigureFonts(fonts => builder.UseMauiApp<App>().ConfigureFonts(fonts =>
@@ -0,0 +1,18 @@
<?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"
Title="BaseStockPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Button
x:Name="ButtonGetCheckPoints"
Text="Ellenőrzési pontok"
SemanticProperties.Hint="Ellenőrzési pontok"
Clicked="OnButtonGetCheckPoints"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,28 @@
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class BaseStockPage : ContentPage
{
public BaseStockPage()
{
InitializeComponent();
}
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//CheckPointsPage");
}
private async void OnButtonGetEquipments(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//EquipmentsPage");
}
private async void OnButtonGetLocations(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//LocationsPage");
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
return true;
}
}
@@ -0,0 +1,18 @@
<?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"
Title="Ellenőrzési pontok">
<CollectionView x:Name="CheckPointsList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Code}" FontSize="14" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>
@@ -0,0 +1,36 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
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>();
}
protected override async void OnAppearing()
{
base.OnAppearing();
await LoadCheckPoints();
}
private async Task LoadCheckPoints()
{
await _syncService.SyncDatas();
CheckPointsList.ItemsSource = await _baseStockService.GetAllCheckPoints();
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//BaseStockPage");
return true;
}
}
@@ -0,0 +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>
</ContentPage>
@@ -0,0 +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;
}
}
@@ -0,0 +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>
</ContentPage>
@@ -0,0 +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;
}
}
@@ -1,5 +1,4 @@
using WorkFlowCheck.MAUI.Services.Interfaces;
using WorkFlowCheck.MAUI.Services;
namespace WorkFlowCheck.MAUI.Pages.Security; namespace WorkFlowCheck.MAUI.Pages.Security;
@@ -1,4 +1,4 @@
using WorkFlowCheck.MAUI.Services; using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System; namespace WorkFlowCheck.MAUI.Pages.System;
@@ -0,0 +1,33 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.DataLayer;
using WorkFlowCheck.MAUI.DataLayer.Entities;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Services
{
public class BaseStockService : BaseService, IBaseStockService
{
public BaseStockService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper) : base(httpClient, configuration, dbContext, mapper)
{
}
public async Task<List<CheckPointDTO>> GetAllCheckPoints()
{
return _mapper.Map<List<CheckPointDTO>>(await _dbContext.CheckPoints.ToListAsync());
}
public async Task<CheckPointDTO> GetCheckPoint(int id)
{
return _mapper.Map<CheckPointDTO>(await _dbContext.CheckPoints.Where(w => w.Id == id).FirstOrDefaultAsync());
}
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Services.Interfaces
{
public interface IBaseStockService
{
Task<List<CheckPointDTO>> GetAllCheckPoints();
Task<CheckPointDTO> GetCheckPoint(int id);
}
}
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Services namespace WorkFlowCheck.MAUI.Services.Interfaces
{ {
public interface ISyncService public interface ISyncService
{ {
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Services namespace WorkFlowCheck.MAUI.Services.Interfaces
{ {
public interface IUserService public interface IUserService
{ {
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.DataLayer; using WorkFlowCheck.MAUI.DataLayer;
using WorkFlowCheck.MAUI.DataLayer.Entities; using WorkFlowCheck.MAUI.DataLayer.Entities;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Services namespace WorkFlowCheck.MAUI.Services
{ {
@@ -12,6 +12,7 @@ using System.Text.Json.Serialization;
using Newtonsoft.Json; using Newtonsoft.Json;
using WorkFlowCheck.MAUI.DataLayer; using WorkFlowCheck.MAUI.DataLayer;
using AutoMapper; using AutoMapper;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Services namespace WorkFlowCheck.MAUI.Services
{ {
@@ -81,6 +81,21 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="ContentViews\HeaderView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\BaseStock\BaseStockPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\BaseStock\CheckPoints\CheckPointsPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\BaseStock\Equipments\EquipmentsPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\BaseStock\LocationsPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\NFC\NFCTestPage.xaml"> <MauiXaml Update="Pages\NFC\NFCTestPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>