mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 15:06:26 +01:00
33 lines
992 B
C#
33 lines
992 B
C#
using System.Linq;
|
|
using ShareeBike.View.Map;
|
|
using ShareeBike.ViewModel.Map;
|
|
using Xamarin.Forms;
|
|
|
|
namespace ShareeBike
|
|
{
|
|
public static class BackdoorMethodHelpers
|
|
{
|
|
public static void DoTapPage(string stationId)
|
|
{
|
|
Serilog.Log.Information($"Request via backdoor to tap station {stationId}.");
|
|
var currentPage = GetCurrentPage();
|
|
var mapPageViewModel = (currentPage as MapPage)?.BindingContext as MapPageViewModel;
|
|
if (mapPageViewModel == null)
|
|
{
|
|
Serilog.Log.Error($"Request via backdoor to tap station {stationId} aborted because current page is not of expected type {typeof(MapPage).Name}. Type detected is {currentPage.GetType().Name}.");
|
|
return;
|
|
}
|
|
|
|
Serilog.Log.Information($"Invoking member to tap.");
|
|
mapPageViewModel?.OnStationClicked(stationId);
|
|
}
|
|
|
|
/// <summary> Gets the current page assumed that app is master detail page.</summary>
|
|
/// <returns></returns>
|
|
static Page GetCurrentPage()
|
|
{
|
|
return Shell.Current.CurrentPage;
|
|
}
|
|
|
|
}
|
|
}
|