Version 3.0.346

This commit is contained in:
Oliver Hauff 2022-10-17 18:45:38 +02:00
parent 1ba809dd59
commit 47c03f43fb
43 changed files with 609 additions and 117 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading;
using System.Threading.Tasks;
using Serilog;
@ -18,6 +18,11 @@ namespace TINK.View.FindBike
/// <summary> Refernce to view model. </summary>
FindBikePageViewModel m_oViewModel = null;
/// <summary>
/// Holds a value indicating whether page already subscribed to shell item changes or not.
/// </summary>
private bool _IsShellItemChangedReceived = false;
public FindBikePage() { }
/// <summary>
@ -76,6 +81,35 @@ namespace TINK.View.FindBike
await m_oViewModel.OnAppearing();
}
/// <summary>
/// Invoked when page is disappearing to
/// - stop the update process
/// - to subscribe to events.
/// </summary>
protected async override void OnDisappearing()
{
if (!_IsShellItemChangedReceived && Shell.Current != null)
{
// Subscribe to events.
// Do not do this on startup because Shell.Current is null, if FindeBikePage is startup page.
Shell.Current.Navigated += (sender, e) =>
{
if (e.Source != ShellNavigationSource.ShellItemChanged)
{
// Nothing to do.
return;
}
// Reset previous user input after switch of pages to allow user to select a differnt bike if one has been selected before.
m_oViewModel.BikeIdUserInput = String.Empty;
};
}
_IsShellItemChangedReceived = true;
await (m_oViewModel?.OnDisappearing() ?? Task.CompletedTask);
}
/// <summary>
/// Displays alert message.
@ -149,4 +183,4 @@ namespace TINK.View.FindBike
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery, co2Saving));
#endif
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
#if USEFLYOUT
using TINK.View.MasterDetail;
@ -267,7 +267,7 @@ namespace TINK.View.Map
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected override async void OnDisappearing()
protected async override void OnDisappearing()
{
if (MapPageViewModel != null)
{
@ -278,4 +278,4 @@ namespace TINK.View.Map
base.OnDisappearing();
}
}
}
}

View file

@ -59,11 +59,21 @@
</ListView>
</StackLayout>
</Frame>
<Frame
<!-- Picker to selct startup page -->
<Frame IsVisible="False">
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingStartupPage}"/>
<Picker
ItemsSource="{Binding StartupSettings.ServicesTextList}"
SelectedItem="{Binding StartupSettings.ActiveText}"/>
</StackLayout>
</Frame>
<!-- Themes -->
<Frame
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}">
<StackLayout>
<!-- Themes -->
<Label
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}"
Text="Theme"/>
<Picker
@ -235,4 +245,4 @@
</Frame>
</ScrollView>
</ContentPage.Content>
</ContentPage>
</ContentPage>