This commit is contained in:
Oliver Hauff 2022-01-22 18:32:22 +01:00
parent 6ed1579494
commit 3c97e2f4aa
34 changed files with 278 additions and 135 deletions

View file

@ -652,6 +652,24 @@
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-mdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\sharee_no_background.png" />
</ItemGroup>
<Import Project="..\TINK\LastenradBayern.projitems" Label="Shared" Condition="Exists('..\TINK\LastenradBayern.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.276" android:versionCode="276">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key>
<string>LastenradBayern</string>
<key>CFBundleVersion</key>
<string>276</string>
<string>277</string>
<key>CFBundleShortVersionString</key>
<string>3.0.276</string>
<string>3.0.277</string>
</dict>
</plist>

View file

@ -135,13 +135,13 @@ namespace TINK
store = new Store();
Barrel.ApplicationId = "TINKApp";
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "baei987w";
const string MERCHANTID = "23456789";
// Create new app instnace.
Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault();
return Shell.Current.CurrentPage;
#endif
}

View file

@ -1,7 +1,9 @@
using System;
using System.Threading.Tasks;
using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -9,8 +11,11 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{
public ContactPage ()
{
@ -71,8 +76,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
{
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{
await Task.CompletedTask;
@ -83,6 +88,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage);
#endif
}
#if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType());
var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif
if (page == null)
{

View file

@ -7,6 +7,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Image
HeightRequest="140"
@ -16,6 +17,12 @@
HorizontalOptions="CenterAndExpand"
FontSize="Large"
Grid.Row="1"
Text="{Binding MasterDetailMenuTitlte}"/>
Text="{Binding MasterDetailMenuTitlte}"/>
<Label
HorizontalOptions="CenterAndExpand"
FontSize="Micro"
HorizontalTextAlignment="Center"
Grid.Row="2"
Text="gefördert vom Bayrischen Staatministerium für Wohnen, Bau und Verkehr"/>
</Grid>
</ContentView>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.276" android:versionCode="276">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key>
<string>Mein konrad</string>
<key>CFBundleVersion</key>
<string>276</string>
<string>277</string>
<key>CFBundleShortVersionString</key>
<string>3.0.276</string>
<string>3.0.277</string>
</dict>
</plist>

View file

@ -134,13 +134,13 @@ namespace TINK
store = new Store();
Barrel.ApplicationId = "TINKApp";
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "mkef9BuN";
const string MERCHANTID = "23456789";
// Create new app instnace.
Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault();
return Shell.Current.CurrentPage;
#endif
}

View file

@ -1,7 +1,9 @@
using System;
using System.Threading.Tasks;
using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -9,10 +11,14 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{
public ContactPage ()
public ContactPage ()
{
InitializeComponent ();
@ -71,8 +77,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
{
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{
await Task.CompletedTask;
@ -83,6 +89,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage);
#endif
}
#if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType());
var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif
if (page == null)
{

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.276" android:versionCode="276">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key>
<string>sharee.bike</string>
<key>CFBundleVersion</key>
<string>276</string>
<string>277</string>
<key>CFBundleShortVersionString</key>
<string>3.0.276</string>
<string>3.0.277</string>
</dict>
</plist>

View file

@ -134,13 +134,13 @@ namespace TINK
store = new Store();
Barrel.ApplicationId = "TINKApp";
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "oiF2kahH";
const string MERCHANTID = "23456789";
// Create new app instnace.
Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault();
return Shell.Current.CurrentPage;
#endif
}

View file

@ -1,7 +1,9 @@
using System;
using System.Threading.Tasks;
using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -9,10 +11,14 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{
public ContactPage ()
public ContactPage ()
{
InitializeComponent ();
@ -71,8 +77,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
{
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{
await Task.CompletedTask;
@ -83,6 +89,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage);
#endif
}
#if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType());
var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif
if (page == null)
{

View file

@ -477,7 +477,11 @@ namespace TINK.Model
},
{
new Version(3, 0, 276),
AppResources.ChangeLog3_0_276
AppResources.ChangeLog3_0_276
},
{
new Version(3, 0, 277),
AppResources.ChangeLog3_0_277
}
};

View file

@ -920,6 +920,15 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to Bugfix: No more closing of app on Select Bike page..
/// </summary>
public static string ChangeLog3_0_277 {
get {
return ResourceManager.GetString("ChangeLog3_0_277", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Lock of rented bike can not be found..
/// </summary>
@ -1736,6 +1745,24 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to No bike with id {0} found..
/// </summary>
public static string MessageErrorSelectBikeNoBikeFound {
get {
return ResourceManager.GetString("MessageErrorSelectBikeNoBikeFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error Selecting Bike!.
/// </summary>
public static string MessageErrorSelectBikeTitle {
get {
return ResourceManager.GetString("MessageErrorSelectBikeTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Login cookie must not be empty. {0}.
/// </summary>

View file

@ -742,4 +742,13 @@ Fehlerbehebung: Supportmails können wieder verschickt werden.</value>
<value>Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten.
{0}</value>
</data>
<data name="MessageErrorSelectBikeNoBikeFound" xml:space="preserve">
<value>Kein Fahrrad mit Id {0} gefunden.</value>
</data>
<data name="MessageErrorSelectBikeTitle" xml:space="preserve">
<value>Fehler beim Rad Wählen!</value>
</data>
<data name="ChangeLog3_0_277" xml:space="preserve">
<value>Fehlerbehebung: App schließt sich nicht mehr auf Fahrrad Wählen-Seite.</value>
</data>
</root>

View file

@ -837,4 +837,13 @@ Bugfix: Sending support mails works again. </value>
<value>An error occurred switching from cargo bikes/ city bikes.
{0}</value>
</data>
<data name="MessageErrorSelectBikeNoBikeFound" xml:space="preserve">
<value>No bike with id {0} found.</value>
</data>
<data name="MessageErrorSelectBikeTitle" xml:space="preserve">
<value>Error Selecting Bike!</value>
</data>
<data name="ChangeLog3_0_277" xml:space="preserve">
<value>Bugfix: No more closing of app on Select Bike page.</value>
</data>
</root>

View file

@ -998,6 +998,18 @@ Fehlerbehebung: Supportmails können wieder verschickt werden.</target>
<target state="translated">Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten.
{0}</target>
</trans-unit>
<trans-unit id="MessageErrorSelectBikeNoBikeFound" translate="yes" xml:space="preserve">
<source>No bike with id {0} found.</source>
<target state="translated">Kein Fahrrad mit Id {0} gefunden.</target>
</trans-unit>
<trans-unit id="MessageErrorSelectBikeTitle" translate="yes" xml:space="preserve">
<source>Error Selecting Bike!</source>
<target state="translated">Fehler beim Rad Wählen!</target>
</trans-unit>
<trans-unit id="ChangeLog3_0_277" translate="yes" xml:space="preserve">
<source>Bugfix: No more closing of app on Select Bike page.</source>
<target state="translated">Fehlerbehebung: App schließt sich nicht mehr auf Fahrrad Wählen-Seite.</target>
</trans-unit>
</group>
</body>
</file>

View file

@ -2,6 +2,9 @@
using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
#if !USEFLYOUT
using System.Threading.Tasks;
#endif
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.State;
@ -323,7 +326,7 @@ namespace TINK.ViewModel.Bikes.Bike
#if USEFLYOUT
=> new Xamarin.Forms.Command(() => ShowAgbPageAsync());
#else
=> new Xamarin.Forms.Command(async () => await OpenLoginPageAsync());
=> new Xamarin.Forms.Command(async () => await ShowAgbPageAsync());
#endif
/// <summary> Opens login page. </summary>

View file

@ -462,9 +462,12 @@ namespace TINK.ViewModel.Contact
typeof(BikesAtStationPage),
p_strStationName);
#else
#if USEFLYOUT
// Show page.
ViewService.ShowPage(ViewTypes.ContactPage, AppResources.MarkingContactPageTitle);
#else
await ViewService.ShowPage("//ContactPage");
#endif
IsMapPageEnabled = true;
ActionText = "";
}
@ -480,14 +483,14 @@ namespace TINK.ViewModel.Contact
"OK");
}
#endif
}
}
/// <summary>
/// Gets the list of station color for all stations.
/// </summary>
/// <param name="stationsId">Station id list to get color for.</param>
/// <returns></returns>
private static IList<Color> GetStationColors(
private static IList<Color> GetStationColors(
IEnumerable<string> stationsId,
BikeCollection bikesAll)
{

View file

@ -47,11 +47,28 @@ namespace TINK.ViewModel.FindBike
}
}
/// <summary>
/// True if any action can be performed (request and cancel request)
/// </summary>
public override bool IsIdle
{
get => base.IsIdle;
set
{
if (value == IsIdle)
return;
Log.ForContext<FindBikePageViewModel>().Debug($"Switch value of {nameof(IsIdle)} to {value}.");
base.IsIdle = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeEnabled))); // Enable select bike button.
}
}
/// <summary> Holds all bikes available.</summary>
public BikeCollection Bikes { get; set; }
/// <summary> Do not allow to select bike if id is not set.</summary>
public bool IsSelectBikeEnabled => BikeIdUserInput != null && BikeIdUserInput.Length > 0;
public bool IsSelectBikeEnabled => IsIdle && BikeIdUserInput != null && BikeIdUserInput.Length > 0;
/// <summary> Hide id input fields as soon as bike is found.</summary>
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
@ -125,123 +142,137 @@ namespace TINK.ViewModel.FindBike
/// <summary> Select a bike by ID</summary>
public async Task SelectBike()
{
var selectedBike = Bikes.FirstOrDefault(x => x.Id.Equals(BikeIdUserInput.Trim(), StringComparison.OrdinalIgnoreCase));
if (selectedBike == null)
try
{
await ViewService.DisplayAlert("Fehler bei Radauswahl!", $"Kein Rad mit Id {BikeIdUserInput} gefunden.", "OK");
return;
}
var selectedBike = Bikes.FirstOrDefault(x => x.Id.Equals(BikeIdUserInput.Trim(), StringComparison.OrdinalIgnoreCase));
var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } });
var lockIdList = bikeCollection
.GetLockIt()
.Cast<BikeInfo>()
.Select(x => x.LockInfo)
.ToList();
if (LockService is ILocksServiceFake serviceFake)
{
serviceFake.UpdateSimulation(bikeCollection);
}
// Check bluetooth and location permission and states
ActionText = AppResources.ActivityTextCheckBluetoothState;
if (bikeCollection.FirstOrDefault(x => x is BikeInfo btBike) != null
&& RuntimePlatform == Device.Android)
{
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (status != Status.Granted)
if (selectedBike == null)
{
var permissionResult = await PermissionsService.RequestAsync();
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
string.Format(AppResources.MessageErrorSelectBikeNoBikeFound, BikeIdUserInput),
AppResources.MessageAnswerOk);
return;
}
if (permissionResult != Status.Granted)
var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } });
var lockIdList = bikeCollection
.GetLockIt()
.Cast<BikeInfo>()
.Select(x => x.LockInfo)
.ToList();
if (LockService is ILocksServiceFake serviceFake)
{
serviceFake.UpdateSimulation(bikeCollection);
}
// Check bluetooth and location permission and states
ActionText = AppResources.ActivityTextCheckBluetoothState;
if (bikeCollection.FirstOrDefault(x => x is BikeInfo btBike) != null
&& RuntimePlatform == Device.Android)
{
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (status != Status.Granted)
{
var dialogResult = await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationPermissionOpenDialog,
AppResources.MessageAnswerYes,
AppResources.MessageAnswerNo);
var permissionResult = await PermissionsService.RequestAsync();
if (!dialogResult)
if (permissionResult != Status.Granted)
{
// User decided not to give access to locations permissions.
BikeCollection.Update(bikeCollection, Stations);
var dialogResult = await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationPermissionOpenDialog,
AppResources.MessageAnswerYes,
AppResources.MessageAnswerNo);
//await OnAppearing(() => UpdateTask());
if (!dialogResult)
{
// User decided not to give access to locations permissions.
BikeCollection.Update(bikeCollection, Stations);
ActionText = "";
IsIdle = true;
return;
//await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
}
// Open permissions dialog.
PermissionsService.OpenAppSettings();
}
}
// Open permissions dialog.
PermissionsService.OpenAppSettings();
// Location state
if (Geolocation.IsGeolcationEnabled == false)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
}
// Bluetooth state
if (await BluetoothService.GetBluetoothState() != BluetoothState.On)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
}
}
// Location state
if (Geolocation.IsGeolcationEnabled == false)
// Connect to bluetooth devices.
ActionText = AppResources.ActivityTextSearchBikes;
IEnumerable<LockInfoTdo> locksInfoTdo;
try
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
locksInfoTdo = await LockService.GetLocksStateAsync(
lockIdList.Select(x => x.ToLockInfoTdo()).ToList(),
LockService.TimeOut.MultiConnect);
}
catch (Exception exception)
{
Log.ForContext<FindBikePageViewModel>().Error("Getting bluetooth state failed. {Exception}", exception);
locksInfoTdo = new List<LockInfoTdo>();
}
// Bluetooth state
if (await BluetoothService.GetBluetoothState() != BluetoothState.On)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
BikeCollection.Update(bikeCollection, Stations);
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask());
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
}
}
// Connect to bluetooth devices.
ActionText = AppResources.ActivityTextSearchBikes;
IEnumerable<LockInfoTdo> locksInfoTdo;
try
ActionText = "";
IsIdle = true;
} catch (Exception exception)
{
locksInfoTdo = await LockService.GetLocksStateAsync(
lockIdList.Select(x => x.ToLockInfoTdo()).ToList(),
LockService.TimeOut.MultiConnect);
await ViewService.DisplayAlert(
AppResources.MessageErrorSelectBikeTitle,
exception.Message,
AppResources.MessageAnswerOk);
Log.ForContext<FindBikePageViewModel>().Error("Running command to select bike failed. {Exception}", exception);
return;
}
catch (Exception exception)
{
Log.ForContext<FindBikePageViewModel>().Error("Getting bluetooth state failed. {Exception}", exception);
locksInfoTdo = new List<LockInfoTdo>();
}
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
}
/// <summary> Create task which updates my bike view model.</summary>