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
@@ -38,7 +38,7 @@
</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" />
@@ -63,7 +63,7 @@
CornerRadius="25"
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<Frame Grid.Row="1"
BorderColor="Gray"
@@ -198,20 +198,23 @@
Margin="1"
CornerRadius="10"
HasShadow="True">
<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"
<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"
@@ -220,14 +223,15 @@
MaximumWidthRequest="120"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}"
@@ -31,6 +31,7 @@ public partial class CheckListPage : ContentPage
public ICommand InfoCommand { get; set; }
public ICommand CloseCommand { get; set; }
public ICommand RefreshCommand { get; }
public ICommand RefreshCommandT { get; }
public bool IsLoading
{
@@ -52,6 +53,7 @@ public partial class CheckListPage : ContentPage
}
private bool _isRefreshing;
private bool _isRefreshingT;
public bool 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()
{
@@ -79,6 +93,7 @@ public partial class CheckListPage : ContentPage
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem);
RefreshCommand = new Command(async () => await OnRefresh());
RefreshCommandT = new Command(async () => await OnRefreshT());
}
private async void OnSyncClicked(object sender, EventArgs e)
@@ -128,6 +143,16 @@ public partial class CheckListPage : ContentPage
IsRefreshing = false;
}
private async Task OnRefreshT()
{
IsRefreshingT = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckListTemplate();
IsRefreshingT = false;
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
@@ -384,7 +409,7 @@ public partial class CheckListPage : ContentPage
if (!isAdmin)
{
var result = checkListHeaderDTOs
.Where(w => w.UserId == userDTO.Id && w.CheckStatus != CheckStatus.Blocked).ToList();
.Where(w => w.UserId == userDTO.Id).ToList();
CheckList.ItemsSource = result;
}