Ezt még ki kell reszelni rendesen
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.DataLayer;
|
using WorkFlowCheck.MAUI.DataLayer;
|
||||||
using WorkFlowCheck.MAUI.Services;
|
using WorkFlowCheck.MAUI.Services;
|
||||||
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.MAUI
|
namespace WorkFlowCheck.MAUI
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,7 @@ namespace WorkFlowCheck.MAUI
|
|||||||
|
|
||||||
|
|
||||||
MainPage = new AppShell();
|
MainPage = new AppShell();
|
||||||
|
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
|
||||||
|
|
||||||
}
|
}
|
||||||
protected async override void OnResume()
|
protected async override void OnResume()
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
|
||||||
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
|
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
|
||||||
|
|
||||||
public partial class BaseStockPage : ContentPage
|
public partial class BaseStockPage : ContentPage
|
||||||
@@ -9,7 +11,8 @@ public partial class BaseStockPage : ContentPage
|
|||||||
|
|
||||||
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
|
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await Shell.Current.GoToAsync("//CheckPointsPage");
|
//await Shell.Current.GoToAsync("//CheckPointsPage");
|
||||||
|
await Navigation.PushAsync(new CheckPointsPage());
|
||||||
}
|
}
|
||||||
private async void OnButtonGetEquipments(object sender, EventArgs e)
|
private async void OnButtonGetEquipments(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?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"
|
||||||
|
Title="CheckPointEditPage">
|
||||||
|
<StackLayout Padding="20">
|
||||||
|
<!-- Cím: Edit Item -->
|
||||||
|
<Label Text="Edit Item" FontSize="24" HorizontalOptions="Center" />
|
||||||
|
|
||||||
|
<!-- Editálható név mező -->
|
||||||
|
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
|
||||||
|
|
||||||
|
<Grid ColumnSpacing="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>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPointsPage"
|
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPointsPage"
|
||||||
Title="Ellenőrzési pontok">
|
Title="Ellenőrzési pontok">
|
||||||
|
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
|
||||||
<CollectionView x:Name="CheckPointsList">
|
<CollectionView x:Name="CheckPointsList">
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -10,9 +11,15 @@
|
|||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
|
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
|
||||||
<Label Text="{Binding Code}" FontSize="14" />
|
<Label Text="{Binding Code}" FontSize="14" />
|
||||||
|
<Button Text="Edit"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</Frame>
|
</Frame>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</CollectionView.ItemTemplate>
|
</CollectionView.ItemTemplate>
|
||||||
</CollectionView>
|
</CollectionView>
|
||||||
|
</RefreshView>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
using WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
|
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
|
||||||
@@ -17,15 +18,33 @@ public partial class CheckPointsPage : ContentPage
|
|||||||
_baseStockService = MauiProgram.ServiceProvider.GetRequiredService<IBaseStockService>();
|
_baseStockService = MauiProgram.ServiceProvider.GetRequiredService<IBaseStockService>();
|
||||||
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand RefreshCommand { get; set; }
|
||||||
|
public ICommand EditCommand { get; set; }
|
||||||
|
public bool IsRefreshing { get; set; }
|
||||||
|
|
||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
|
RefreshCommand = new Command(async () => await LoadCheckPoints());
|
||||||
|
EditCommand = new Command<CheckPointDTO>(OnEditItem);
|
||||||
|
|
||||||
|
BindingContext = this;
|
||||||
await LoadCheckPoints();
|
await LoadCheckPoints();
|
||||||
}
|
}
|
||||||
private async Task LoadCheckPoints()
|
private async Task LoadCheckPoints()
|
||||||
{
|
{
|
||||||
|
IsRefreshing = true;
|
||||||
await _syncService.SyncDatas();
|
await _syncService.SyncDatas();
|
||||||
CheckPointsList.ItemsSource = await _baseStockService.GetAllCheckPoints();
|
CheckPointsList.ItemsSource = await _baseStockService.GetAllCheckPoints();
|
||||||
|
IsRefreshing = false;
|
||||||
|
OnPropertyChanged(nameof(IsRefreshing));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnEditItem(CheckPointDTO checkPointDTO)
|
||||||
|
{
|
||||||
|
// Navigálás a CheckPointEdit.xaml-ra, és átadjuk az editálni kívánt elemet
|
||||||
|
await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnBackButtonPressed()
|
protected override bool OnBackButtonPressed()
|
||||||
|
|||||||
@@ -87,6 +87,9 @@
|
|||||||
<MauiXaml Update="Pages\BaseStock\BaseStockPage.xaml">
|
<MauiXaml Update="Pages\BaseStock\BaseStockPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="Pages\BaseStock\CheckPoints\CheckPointEditPage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</MauiXaml>
|
||||||
<MauiXaml Update="Pages\BaseStock\CheckPoints\CheckPointsPage.xaml">
|
<MauiXaml Update="Pages\BaseStock\CheckPoints\CheckPointsPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
|||||||
Reference in New Issue
Block a user