mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 11:37:28 +02:00
Version 3.0.350
This commit is contained in:
parent
7f49fb0ac5
commit
40b96f0350
70 changed files with 12021 additions and 8388 deletions
|
@ -625,6 +625,23 @@ namespace TINK.Model
|
|||
AppResources.ChangeLog_3_0_347_SB,
|
||||
new List<AppFlavor> { AppFlavor.ShareeBike }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 348),
|
||||
AppResources.ChangeLog_3_0_348,
|
||||
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad, AppFlavor.ShareeBike },
|
||||
new List<DevicePlatform> { DevicePlatform.Android }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 349),
|
||||
AppResources.ChangeLog_3_0_349,
|
||||
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad, AppFlavor.ShareeBike },
|
||||
new List<DevicePlatform> { DevicePlatform.Android }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 350),
|
||||
AppResources.ChangeLog_3_0_350_SB_MK,
|
||||
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
|
||||
},
|
||||
};
|
||||
|
||||
/// <summary> Manges the whats new information.</summary>
|
||||
|
|
|
@ -694,6 +694,37 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to App ugraded to target api level 31 (Android 12)..
|
||||
/// </summary>
|
||||
public static string ChangeLog_3_0_348 {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangeLog_3_0_348", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The permission query for Location and Detect Nearby Devices has been adapted to Android 12. Please allow both to rent our bikes without any problems..
|
||||
/// </summary>
|
||||
public static string ChangeLog_3_0_349 {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangeLog_3_0_349", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Your current position will now be displayed on the map as a blue dot, provided you turn on your location service. <br/>
|
||||
///<br/>
|
||||
///When logging in, you can now view the password you entered. <br/>
|
||||
///<br/>
|
||||
///Try it out!.
|
||||
/// </summary>
|
||||
public static string ChangeLog_3_0_350_SB_MK {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangeLog_3_0_350_SB_MK", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to We have fixed some bugs. Enjoy the ride!.
|
||||
/// </summary>
|
||||
|
|
|
@ -1085,4 +1085,17 @@ Einstellung hinzugefügt mit der festgelegt werden kann, ob die App mit der Seit
|
|||
gestartet wird.<br/>
|
||||
Kleinere Verbesserungen.<br/></value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_348" xml:space="preserve">
|
||||
<value>App aktualisiert auf Ziel Api-Level 31 (Android 12).</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_349" xml:space="preserve">
|
||||
<value>Die Berechtigungs-Abfrage für Standort und Geräte in der Nähe wurde an Android 12 angepasst. Bitte lassen Sie beides zu, um unsere Räder problemlos mieten zu können.</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_350_SB_MK" xml:space="preserve">
|
||||
<value>Ihre aktuelle Position wird nun auf der Karte als blauer Punkt angezeigt. Schalten Sie dazu Ihren Standortdienst ein. <br/>
|
||||
<br/>
|
||||
Beim Login können Sie nun Ihr eingegebenes Passwort einsehen.<br/>
|
||||
<br/>
|
||||
Probieren Sie es aus!</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1175,4 +1175,17 @@ Minor improvements.<br/></value>
|
|||
<data name="ErrorNotConnectedToNetwork" xml:space="preserve">
|
||||
<value>Not connected to network.</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="ChangeLog_3_0_348" xml:space="preserve">
|
||||
<value>App ugraded to target api level 31 (Android 12).</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_349" xml:space="preserve">
|
||||
<value>The permission query for Location and Detect Nearby Devices has been adapted to Android 12. Please allow both to rent our bikes without any problems.</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_350_SB_MK" xml:space="preserve">
|
||||
<value>Your current position will now be displayed on the map as a blue dot, provided you turn on your location service. <br/>
|
||||
<br/>
|
||||
When logging in, you can now view the password you entered. <br/>
|
||||
<br/>
|
||||
Try it out!</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1480,6 +1480,26 @@ Einstellung hinzugefügt mit der festgelegt werden kann, ob die App mit der Seit
|
|||
gestartet wird.<br/>
|
||||
Kleinere Verbesserungen.<br/></target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_3_0_348" translate="yes" xml:space="preserve">
|
||||
<source>App ugraded to target api level 31 (Android 12).</source>
|
||||
<target state="translated">App aktualisiert auf Ziel Api-Level 31 (Android 12).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_3_0_349" translate="yes" xml:space="preserve">
|
||||
<source>The permission query for Location and Detect Nearby Devices has been adapted to Android 12. Please allow both to rent our bikes without any problems.</source>
|
||||
<target state="translated">Die Berechtigungs-Abfrage für Standort und Geräte in der Nähe wurde an Android 12 angepasst. Bitte lassen Sie beides zu, um unsere Räder problemlos mieten zu können.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_3_0_350_SB_MK" translate="yes" xml:space="preserve">
|
||||
<source>Your current position will now be displayed on the map as a blue dot, provided you turn on your location service. <br/>
|
||||
<br/>
|
||||
When logging in, you can now view the password you entered. <br/>
|
||||
<br/>
|
||||
Try it out!</source>
|
||||
<target state="translated">Ihre aktuelle Position wird nun auf der Karte als blauer Punkt angezeigt. Schalten Sie dazu Ihren Standortdienst ein. <br/>
|
||||
<br/>
|
||||
Beim Login können Sie nun Ihr eingegebenes Passwort einsehen.<br/>
|
||||
<br/>
|
||||
Probieren Sie es aus!</target>
|
||||
</trans-unit>
|
||||
</group>
|
||||
</body>
|
||||
</file>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<PackageReference Include="Plugin.BLE" Version="2.1.3" />
|
||||
<PackageReference Include="Plugin.BluetoothLE" Version="6.3.0.19" />
|
||||
<PackageReference Include="Plugin.Permissions" Version="6.0.1" />
|
||||
<PackageReference Include="Serilog" Version="2.11.0" />
|
||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="System.Collections" Version="4.3.0" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms;
|
||||
using TINK.View;
|
||||
using TINK.Model.Station;
|
||||
using System;
|
||||
|
@ -22,6 +22,7 @@ using TINK.MultilingualResources;
|
|||
using TINK.Repository;
|
||||
using TINK.Services.Geolocation;
|
||||
using TINK.Model.State;
|
||||
using TINK.ViewModel.Map;
|
||||
|
||||
namespace TINK.ViewModel.Contact
|
||||
{
|
||||
|
@ -161,7 +162,7 @@ namespace TINK.ViewModel.Contact
|
|||
/// <summary>
|
||||
/// One time setup: Sets pins into map and connects to events.
|
||||
/// </summary>
|
||||
private void InitializePins(StationDictionary stations)
|
||||
private async void InitializePins(StationDictionary stations)
|
||||
{
|
||||
// Add pins to stations.
|
||||
Log.ForContext<SelectStationPageViewModel>().Debug($"Request to draw {stations.Count} pins.");
|
||||
|
@ -188,8 +189,35 @@ namespace TINK.ViewModel.Contact
|
|||
|
||||
Pins.Add(l_oPin);
|
||||
}
|
||||
|
||||
//Add blue dot for showing current location of user
|
||||
Location currentLocation = null;
|
||||
try
|
||||
{
|
||||
currentLocation = await GeolocationService.GetAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
}
|
||||
|
||||
if (currentLocation != null)
|
||||
{
|
||||
var currentLocationPin = new Pin()
|
||||
{
|
||||
Position = new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
Label = "currentLocationPin",
|
||||
Type = PinType.Place,
|
||||
Tag = "NotClickable",
|
||||
Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName)
|
||||
};
|
||||
|
||||
Pins.Add(currentLocationPin);
|
||||
}
|
||||
}
|
||||
|
||||
public string currentLocationPinName = $"Location_Pin{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
|
||||
/// <summary> Update all stations from TINK. </summary>
|
||||
/// <param name="stationsColorList">List of colors to apply.</param>
|
||||
private void UpdatePinsColor(IList<Color> stationsColorList)
|
||||
|
@ -199,24 +227,30 @@ namespace TINK.ViewModel.Contact
|
|||
// Update colors of pins.
|
||||
for (int pinIndex = 0; pinIndex < stationsColorList.Count; pinIndex++)
|
||||
{
|
||||
|
||||
var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId)
|
||||
&& stationId <= CUSTOM_ICONS_COUNT
|
||||
? $"{stationId}" // there is a station marker with index letter for given station id
|
||||
: "Open"; // there is no station marker. Use open marker.
|
||||
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
|
||||
var l_iName = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
if (Pins[pinIndex].Tag.ToString() == "NotClickable")
|
||||
{
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(l_iName);
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName);
|
||||
}
|
||||
catch (Exception l_oException)
|
||||
else
|
||||
{
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Station icon {l_strName} can not be loaded. {@l_oException}.", l_oException);
|
||||
Pins[pinIndex].Label = stationId.ToString();
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]);
|
||||
var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId)
|
||||
&& stationId <= CUSTOM_ICONS_COUNT
|
||||
? $"{stationId}" // there is a station marker with index letter for given station id
|
||||
: "Open"; // there is no station marker. Use open marker.
|
||||
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
|
||||
var l_iName = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
{
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(l_iName);
|
||||
}
|
||||
catch (Exception l_oException)
|
||||
{
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Station icon {l_strName} can not be loaded. {@l_oException}.", l_oException);
|
||||
Pins[pinIndex].Label = stationId.ToString();
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
Pins[pinIndex].IsVisible = true;
|
||||
|
@ -449,14 +483,18 @@ namespace TINK.ViewModel.Contact
|
|||
/// <param name="selectedStationId">Id of station user clicked on.</param>
|
||||
public async void OnStationClicked(string selectedStationId)
|
||||
{
|
||||
try
|
||||
//Make shure currentLocationPin can not be clicked
|
||||
if (selectedStationId != "NotClickable")
|
||||
{
|
||||
Log.ForContext<SelectStationPageViewModel>().Information($"User taped station {selectedStationId}.");
|
||||
try
|
||||
{
|
||||
Log.ForContext<SelectStationPageViewModel>().Information($"User taped station {selectedStationId}.");
|
||||
|
||||
// Lock action to prevent multiple instances of "BikeAtStation" being opened.
|
||||
IsMapPageEnabled = false;
|
||||
|
||||
TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId)
|
||||
|
||||
// Lock action to prevent multiple instances of "BikeAtStation" being opened.
|
||||
IsMapPageEnabled = false;
|
||||
|
||||
TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId)
|
||||
?? new Station(selectedStationId, new List<string>(), null); // Station might not be in list StationDictinaly because this list is not updatd in background task.
|
||||
|
||||
#if TRYNOTBACKSTYLE
|
||||
|
@ -468,23 +506,28 @@ namespace TINK.ViewModel.Contact
|
|||
// Show page.
|
||||
ViewService.ShowPage(ViewTypes.ContactPage, AppResources.MarkingContactPageTitle);
|
||||
#else
|
||||
await ViewService.ShowPage("//ContactPage");
|
||||
await ViewService.ShowPage("//ContactPage");
|
||||
#endif
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception);
|
||||
await ViewService.DisplayAlert(
|
||||
"Fehler",
|
||||
$"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}",
|
||||
"OK");
|
||||
}
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception);
|
||||
await ViewService.DisplayAlert(
|
||||
"Fehler",
|
||||
$"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}",
|
||||
"OK");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -513,23 +556,26 @@ namespace TINK.ViewModel.Contact
|
|||
var colors = new List<Color>();
|
||||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
if (stationId != "NotClickable")
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
continue;
|
||||
}
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
continue;
|
||||
}
|
||||
|
||||
colors.Add(Color.Red);
|
||||
colors.Add(Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
return colors;
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace TINK.ViewModel.Map
|
|||
/// <summary>
|
||||
/// One time setup: Sets pins into map and connects to events.
|
||||
/// </summary>
|
||||
private void InitializePins(StationDictionary stations)
|
||||
public async void InitializePins(StationDictionary stations)
|
||||
{
|
||||
// Add pins to stations.
|
||||
Log.ForContext<MapPageViewModel>().Debug($"Request to draw {stations.Count} pins.");
|
||||
|
@ -225,8 +225,35 @@ namespace TINK.ViewModel.Map
|
|||
|
||||
Pins.Add(pin);
|
||||
}
|
||||
|
||||
//Add blue dot for showing current location of user
|
||||
Location currentLocation = null;
|
||||
try
|
||||
{
|
||||
currentLocation = await GeolocationService.GetAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
}
|
||||
|
||||
if (currentLocation != null)
|
||||
{
|
||||
var currentLocationPin = new Pin()
|
||||
{
|
||||
Position = new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
Label = "currentLocationPin",
|
||||
Type = PinType.Place,
|
||||
Tag = "NotClickable",
|
||||
Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName)
|
||||
};
|
||||
|
||||
Pins.Add(currentLocationPin);
|
||||
}
|
||||
}
|
||||
|
||||
public string currentLocationPinName = $"Location_Pin{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
|
||||
/// <summary> Update all stations from TINK. </summary>
|
||||
/// <param name="stationsColorList">List of colors to apply.</param>
|
||||
private void UpdatePinsColor(IList<Color> stationsColorList)
|
||||
|
@ -236,24 +263,30 @@ namespace TINK.ViewModel.Map
|
|||
// Update colors of pins.
|
||||
for (int pinIndex = 0; pinIndex < stationsColorList.Count; pinIndex++)
|
||||
{
|
||||
|
||||
var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId)
|
||||
if (Pins[pinIndex].Tag.ToString() == "NotClickable")
|
||||
{
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName);
|
||||
}
|
||||
else
|
||||
{
|
||||
var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId)
|
||||
&& stationId <= CUSTOM_ICONS_COUNT
|
||||
? $"{stationId}" // there is a station marker with index letter for given station id
|
||||
: "Open"; // there is no station marker. Use open marker.
|
||||
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
|
||||
var name = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
{
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(name);
|
||||
}
|
||||
catch (Exception excption)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Station icon {name} can not be loaded. {@excption}.", name, excption);
|
||||
Pins[pinIndex].Label = stationId.ToString();
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]);
|
||||
var name = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
{
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(name);
|
||||
}
|
||||
catch (Exception excption)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Station icon {name} can not be loaded. {@excption}.", name, excption);
|
||||
Pins[pinIndex].Label = stationId.ToString();
|
||||
Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
Pins[pinIndex].IsVisible = true;
|
||||
|
@ -294,6 +327,11 @@ namespace TINK.ViewModel.Map
|
|||
return "Red";
|
||||
}
|
||||
|
||||
if (color == Color.Black)
|
||||
{
|
||||
return "NotClickable";
|
||||
}
|
||||
|
||||
return color.ToString();
|
||||
}
|
||||
|
||||
|
@ -642,14 +680,17 @@ namespace TINK.ViewModel.Map
|
|||
/// <param name="selectedStationId">Id of station user clicked on.</param>
|
||||
public async void OnStationClicked(string selectedStationId)
|
||||
{
|
||||
try
|
||||
//Make shure currentLocationPin can not be clicked
|
||||
if (selectedStationId != "NotClickable")
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Information($"User taped station {selectedStationId}.");
|
||||
|
||||
// Lock action to prevent multiple instances of "BikeAtStation" being opened.
|
||||
IsMapPageEnabled = false;
|
||||
// Lock action to prevent multiple instances of "BikeAtStation" being opened.
|
||||
IsMapPageEnabled = false;
|
||||
|
||||
TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId)
|
||||
TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId)
|
||||
?? new Station(selectedStationId, new List<string>(), null); // Station might not be in list StationDictinaly because this list is not updatd in background task.
|
||||
|
||||
#if TRYNOTBACKSTYLE
|
||||
|
@ -657,24 +698,31 @@ namespace TINK.ViewModel.Map
|
|||
typeof(BikesAtStationPage),
|
||||
p_strStationName);
|
||||
#else
|
||||
// Show page.
|
||||
await ViewService.PushAsync(ViewTypes.BikesAtStation);
|
||||
{
|
||||
// Show page.
|
||||
await ViewService.PushAsync(ViewTypes.BikesAtStation);
|
||||
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
IsMapPageEnabled = true;
|
||||
ActionText = "";
|
||||
|
||||
Log.ForContext<MapPageViewModel>().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception);
|
||||
await ViewService.DisplayAlert(
|
||||
"Fehler",
|
||||
$"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}",
|
||||
"OK");
|
||||
}
|
||||
Log.ForContext<MapPageViewModel>().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception);
|
||||
await ViewService.DisplayAlert(
|
||||
"Fehler",
|
||||
$"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}",
|
||||
"OK");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -703,23 +751,30 @@ namespace TINK.ViewModel.Map
|
|||
var colors = new List<Color>();
|
||||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
if (stationId != "NotClickable")
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
continue;
|
||||
}
|
||||
|
||||
colors.Add(Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
continue;
|
||||
colors.Add(Color.Black);
|
||||
}
|
||||
|
||||
colors.Add(Color.Red);
|
||||
}
|
||||
|
||||
return colors;
|
||||
|
@ -832,6 +887,34 @@ namespace TINK.ViewModel.Map
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Command object to bind CurrentLocation Button to view model.</summary>
|
||||
public System.Windows.Input.ICommand OnCurrentLocationButtonClicked => new Xamarin.Forms.Command(async () => await CenterToCurrentLocation());
|
||||
|
||||
/// <summary> User request to center to currentLocation. </summary>
|
||||
public async Task CenterToCurrentLocation()
|
||||
{
|
||||
Location currentLocation = null;
|
||||
try
|
||||
{
|
||||
currentLocation = await GeolocationService.GetAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
}
|
||||
|
||||
if (currentLocation != null)
|
||||
{
|
||||
TinkApp.UserMapSpan = MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
TinkApp.ActiveMapSpan.Radius);
|
||||
|
||||
TinkApp.Save();
|
||||
}
|
||||
|
||||
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.ActiveMapSpan);
|
||||
}
|
||||
|
||||
/// <summary> Command object to bind login button to view model.</summary>
|
||||
public System.Windows.Input.ICommand OnToggleTinkToKonrad => new Xamarin.Forms.Command(async () => await ToggleTinkToKonrad());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue