mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-28 23:36:27 +02:00
Small refactoring
This commit is contained in:
parent
34590fbc7d
commit
ba3f987d2a
2 changed files with 141 additions and 114 deletions
|
@ -22,7 +22,7 @@ namespace TINK.View.Map
|
|||
private MapPageViewModel MapPageViewModel { get; set; }
|
||||
|
||||
/// <summary> Initialization status to ensure initialization logic is not called multiple times. </summary>
|
||||
private bool viewInitialized = false;
|
||||
private bool isInitializationStarted = false;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs map page instance.
|
||||
|
@ -136,12 +136,13 @@ namespace TINK.View.Map
|
|||
protected async override void OnAppearing()
|
||||
{
|
||||
// Don't repeat the initialization if it has been completed already.
|
||||
if (viewInitialized) return;
|
||||
if (isInitializationStarted) return;
|
||||
isInitializationStarted = true;
|
||||
|
||||
// Pass reference to member Navigation to show bikes at station x dialog.
|
||||
try
|
||||
{
|
||||
MapPageViewModel = createMapPageViewModel();
|
||||
MapPageViewModel = CreateMapPageViewModel();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -166,7 +167,7 @@ namespace TINK.View.Map
|
|||
|
||||
try
|
||||
{
|
||||
applyCustomiOSStyling();
|
||||
ApplyCustomiOSStyling();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -188,7 +189,7 @@ namespace TINK.View.Map
|
|||
try
|
||||
{
|
||||
// Pre move and scanle maps to avoid initial display of map in Rome.
|
||||
premoveAndScaleMap();
|
||||
PremoveAndScaleMap();
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
|
@ -206,14 +207,13 @@ namespace TINK.View.Map
|
|||
Log.ForContext<MapPage>().Error("Invoking OnAppearing on map page view model failed. {Exception}", exception);
|
||||
return;
|
||||
}
|
||||
viewInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Premoves the Map to a certain location.
|
||||
/// </summary>
|
||||
private void premoveAndScaleMap()
|
||||
private void PremoveAndScaleMap()
|
||||
{
|
||||
Log.ForContext<MapPage>().Verbose("Moving and scaling map.");
|
||||
MapPageViewModel.MoveAndScale(
|
||||
|
@ -226,7 +226,7 @@ namespace TINK.View.Map
|
|||
/// <summary>
|
||||
/// Creates the Map Page's view model.
|
||||
/// </summary>
|
||||
private MapPageViewModel createMapPageViewModel()
|
||||
private MapPageViewModel CreateMapPageViewModel()
|
||||
{
|
||||
Log.ForContext<MapPage>().Verbose("Constructing map page view model.");
|
||||
return new MapPageViewModel(
|
||||
|
@ -243,7 +243,7 @@ namespace TINK.View.Map
|
|||
/// <summary>
|
||||
/// Applies iOS specific styling to branded Buttons.
|
||||
/// </summary>
|
||||
private void applyCustomiOSStyling()
|
||||
private void ApplyCustomiOSStyling()
|
||||
{
|
||||
if (Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
|
@ -267,7 +267,6 @@ namespace TINK.View.Map
|
|||
// View model might be null.
|
||||
await MapPageViewModel?.OnDisappearing();
|
||||
}
|
||||
viewInitialized = false;
|
||||
base.OnDisappearing();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue