qwen edit
This commit is contained in:
@@ -19,9 +19,6 @@ public partial class BookshelfViewModel : BaseViewModel
|
||||
[ObservableProperty]
|
||||
private bool _isEmpty;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isRefreshing;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _searchText = string.Empty;
|
||||
|
||||
@@ -53,7 +50,6 @@ public partial class BookshelfViewModel : BaseViewModel
|
||||
[RelayCommand]
|
||||
public async Task LoadBooksAsync()
|
||||
{
|
||||
if (IsBusy) return;
|
||||
IsBusy = true;
|
||||
|
||||
try
|
||||
@@ -87,22 +83,6 @@ public partial class BookshelfViewModel : BaseViewModel
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task RefreshBooksAsync()
|
||||
{
|
||||
if (IsRefreshing) return;
|
||||
IsRefreshing = true;
|
||||
|
||||
try
|
||||
{
|
||||
await LoadBooksAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task SearchAsync(object? parameter)
|
||||
{
|
||||
|
||||
@@ -65,10 +65,7 @@
|
||||
HorizontalTextAlignment="Center" />
|
||||
</VerticalStackLayout>
|
||||
|
||||
<!-- Book Collection with PullToRefresh -->
|
||||
<RefreshView Command="{Binding RefreshBooksCommand}"
|
||||
IsRefreshing="{Binding IsRefreshing}"
|
||||
IsVisible="{Binding IsEmpty, Converter={StaticResource InvertedBoolConverter}}">
|
||||
<!-- Book Collection -->
|
||||
<CollectionView ItemsSource="{Binding Books}"
|
||||
SelectionMode="None"
|
||||
Margin="10">
|
||||
@@ -157,16 +154,6 @@
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</RefreshView>
|
||||
|
||||
<!-- Loading Indicator -->
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"
|
||||
IsVisible="{Binding IsBusy}"
|
||||
Color="#FF8A65"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
HeightRequest="50"
|
||||
WidthRequest="50" />
|
||||
</Grid>
|
||||
|
||||
<!-- Bottom Shelf / Action Bar -->
|
||||
|
||||
@@ -16,10 +16,14 @@ public partial class BookshelfPage : ContentPage
|
||||
BindingContext = viewModel;
|
||||
}
|
||||
|
||||
protected override async void OnAppearing()
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
await _viewModel.LoadBooksCommand.ExecuteAsync(null);
|
||||
// Загружаем книги только если коллекция пуста
|
||||
if (_viewModel.Books.Count == 0)
|
||||
{
|
||||
_ = _viewModel.LoadBooksCommand.ExecuteAsync(null);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnMenuClicked(object? sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user