Version 3.0.357

This commit is contained in:
Anja 2023-01-18 14:22:51 +01:00
parent 5980410182
commit 5c0b2e70c9
84 changed files with 1012 additions and 449 deletions

View file

@ -23,6 +23,7 @@ using TINK.Settings;
using TINK.View;
using TINK.ViewModel.Bikes;
using Xamarin.Forms;
using Command = Xamarin.Forms.Command;
namespace TINK.ViewModel.BikesAtStation
{
@ -36,6 +37,22 @@ namespace TINK.ViewModel.BikesAtStation
/// </summary>
private IStation Station { get; }
/// <summary>
/// True if ListView of Bikes is refreshing after user pulled;
/// </summary>
private bool _isRefreshing = false;
public bool IsRefreshing
{
get { return _isRefreshing; }
set
{
_isRefreshing = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsRefreshing)));
}
}
public Command RefreshCommand { get; }
/// <summary>
/// Constructs bike collection view model.
/// </summary>
@ -75,11 +92,23 @@ namespace TINK.ViewModel.BikesAtStation
? string.Format(AppResources.MarkingBikesAtStationStationId, Station.Id)
: string.Empty;
/// <summary>
/// Holds what should be executed on pull to refresh
/// </summary>
RefreshCommand = new Command(async () => {
IsRefreshing = true;
await OnAppearing();
IsRefreshing = false;
});
CollectionChanged += (sender, eventargs) =>
{
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsNoBikesAtStationVisible)));
OnPropertyChanged(new PropertyChangedEventArgs(nameof(NoBikesAtStationText)));
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsLoginRequiredHintVisible)));
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsRefreshing)));
};
}
@ -131,7 +160,7 @@ namespace TINK.ViewModel.BikesAtStation
get
{
return IsNoBikesAtStationVisible
? $"Momentan sind keine Fahrräder an dieser Station verfügbar."
? AppResources.MarkingBikesAtStationNoBikesAvailable
: string.Empty;
}
}
@ -215,6 +244,8 @@ namespace TINK.ViewModel.BikesAtStation
/// </summary>
public async Task OnAppearing()
{
IsIdle = false;
Log.ForContext<BikesAtStationPageViewModel>().Information($"Bikes at station {Station.StationName} is appearing, either due to tap on a station or to app being shown again.");
ActionText = AppResources.ActivityTextOneMomentPlease;
@ -334,7 +365,7 @@ namespace TINK.ViewModel.BikesAtStation
}
/// <summary> Create task which updates my bike view model.</summary>
private void UpdateTask()
public void UpdateTask()
{
PostAction(
unused =>