Blokkolás és frissítés is

This commit is contained in:
Iván Szabó
2025-06-05 08:47:17 +02:00
parent 75d8119880
commit 4c7d71a404
2 changed files with 54 additions and 25 deletions
@@ -198,20 +198,23 @@
Margin="1" Margin="1"
CornerRadius="10" CornerRadius="10"
HasShadow="True"> HasShadow="True">
<ScrollView> <RefreshView x:Name="CheckListTemplateRefreshView"
<VerticalStackLayout> IsRefreshing="{Binding IsRefreshingT}"
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" /> Command="{Binding RefreshCommandT}">
<CollectionView x:Name="CheckListTemplate"> <ScrollView>
<CollectionView.ItemTemplate> <VerticalStackLayout>
<DataTemplate> <Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <CollectionView x:Name="CheckListTemplate">
<Grid ColumnDefinitions="*,Auto"> <CollectionView.ItemTemplate>
<StackLayout> <DataTemplate>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" /> <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Label Text="{Binding Description}" FontSize="14" /> <Grid ColumnDefinitions="*,Auto">
</StackLayout> <StackLayout>
<HorizontalStackLayout HorizontalOptions="End"> <Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Button Text="Új ellenőrzés" <Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés"
BackgroundColor="Green" BackgroundColor="Green"
Margin="5,0,0,0" Margin="5,0,0,0"
HeightRequest="50" HeightRequest="50"
@@ -220,14 +223,15 @@
MaximumWidthRequest="120" MaximumWidthRequest="120"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}" Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</HorizontalStackLayout> </HorizontalStackLayout>
</Grid> </Grid>
</Frame> </Frame>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
</RefreshView>
</Frame> </Frame>
<Grid BackgroundColor="#80000000" <Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}" IsVisible="{Binding IsLoading}"
@@ -31,6 +31,7 @@ public partial class CheckListPage : ContentPage
public ICommand InfoCommand { get; set; } public ICommand InfoCommand { get; set; }
public ICommand CloseCommand { get; set; } public ICommand CloseCommand { get; set; }
public ICommand RefreshCommand { get; } public ICommand RefreshCommand { get; }
public ICommand RefreshCommandT { get; }
public bool IsLoading public bool IsLoading
{ {
@@ -52,6 +53,7 @@ public partial class CheckListPage : ContentPage
} }
private bool _isRefreshing; private bool _isRefreshing;
private bool _isRefreshingT;
public bool IsRefreshing public bool IsRefreshing
{ {
get => _isRefreshing; get => _isRefreshing;
@@ -64,6 +66,18 @@ public partial class CheckListPage : ContentPage
} }
} }
} }
public bool IsRefreshingT
{
get => _isRefreshingT;
set
{
if (_isRefreshingT != value)
{
_isRefreshingT = value;
OnPropertyChanged(nameof(IsRefreshingT));
}
}
}
public CheckListPage() public CheckListPage()
{ {
@@ -79,6 +93,7 @@ public partial class CheckListPage : ContentPage
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem); InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem); CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem);
RefreshCommand = new Command(async () => await OnRefresh()); RefreshCommand = new Command(async () => await OnRefresh());
RefreshCommandT = new Command(async () => await OnRefreshT());
} }
private async void OnSyncClicked(object sender, EventArgs e) private async void OnSyncClicked(object sender, EventArgs e)
@@ -128,6 +143,16 @@ public partial class CheckListPage : ContentPage
IsRefreshing = false; IsRefreshing = false;
} }
private async Task OnRefreshT()
{
IsRefreshingT = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckListTemplate();
IsRefreshingT = false;
}
private void SetInfo() private void SetInfo()
{ {
_currentUser = _userService.GetCurrentUser(); _currentUser = _userService.GetCurrentUser();
@@ -384,7 +409,7 @@ public partial class CheckListPage : ContentPage
if (!isAdmin) if (!isAdmin)
{ {
var result = checkListHeaderDTOs var result = checkListHeaderDTOs
.Where(w => w.UserId == userDTO.Id && w.CheckStatus != CheckStatus.Blocked).ToList(); .Where(w => w.UserId == userDTO.Id).ToList();
CheckList.ItemsSource = result; CheckList.ItemsSource = result;
} }