2022-10-03 17:55:10 +02:00
|
|
|
using System;
|
2022-08-30 15:42:25 +02:00
|
|
|
using System.Globalization;
|
2021-05-13 20:16:41 +02:00
|
|
|
using System.Threading.Tasks;
|
2024-04-09 12:53:23 +02:00
|
|
|
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
|
|
|
|
using ShareeBike.ViewModel;
|
|
|
|
using ShareeBike.ViewModel.WhatsNew.Gtc;
|
2021-05-13 20:16:41 +02:00
|
|
|
using Xamarin.Forms;
|
|
|
|
using Xamarin.Forms.Xaml;
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
namespace ShareeBike.View.WhatsNew.Gtc
|
2021-05-13 20:16:41 +02:00
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
2023-11-21 15:26:57 +01:00
|
|
|
public partial class GtcPage : ContentPage, IViewService
|
2022-09-06 16:08:19 +02:00
|
|
|
{
|
2023-11-21 15:26:57 +01:00
|
|
|
public GtcPage()
|
2022-09-06 16:08:19 +02:00
|
|
|
{
|
|
|
|
InitializeComponent();
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2023-11-21 15:26:57 +01:00
|
|
|
gtcViewModel = new GtcViewModel(
|
2022-09-06 16:08:19 +02:00
|
|
|
App.ModelRoot.NextActiveUri.Host,
|
|
|
|
App.ModelRoot.IsSiteCachingOn,
|
|
|
|
(resourceName) => ViewModelResourceHelper.GetSource(resourceName),
|
|
|
|
this);
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2023-11-21 15:26:57 +01:00
|
|
|
BindingContext = gtcViewModel;
|
2022-09-06 16:08:19 +02:00
|
|
|
}
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Displays alert message.</summary>
|
|
|
|
/// <param name="title">Title of message.</param>
|
|
|
|
/// <param name="message">Message to display.</param>
|
|
|
|
/// <param name="details">Detailed error description.</param>
|
|
|
|
/// <param name="cancel">Type of buttons.</param>
|
|
|
|
public async Task DisplayAdvancedAlert(
|
|
|
|
string title,
|
|
|
|
string message,
|
|
|
|
string details,
|
|
|
|
string cancel)
|
|
|
|
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Displays detailed alert message.</summary>
|
|
|
|
/// <param name="title">Title of message.</param>
|
|
|
|
/// <param name="message">Message to display.</param>
|
|
|
|
/// <param name="details">Detailed error description.</param>
|
|
|
|
/// <param name="accept">Text of accept button.</param>
|
|
|
|
/// <param name="cancel">Text of cancel button.</param>
|
|
|
|
/// <returns>True if user pressed accept.</returns>
|
|
|
|
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
|
|
|
|
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
|
2021-06-26 20:57:55 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Invoked when page is shown. </summary>
|
|
|
|
protected async override void OnAppearing()
|
2023-11-21 15:26:57 +01:00
|
|
|
=> await gtcViewModel.OnAppearing();
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Reference to view model.</summary>
|
2023-11-21 15:26:57 +01:00
|
|
|
GtcViewModel gtcViewModel;
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
public async Task PopModalAsync()
|
|
|
|
=> await Navigation.PopModalAsync();
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Pushes a page onto the stack. </summary>
|
|
|
|
/// <param name="p_oTypeOfPage">Page to display.</param>
|
|
|
|
public Task PushAsync(ViewTypes p_oTypeOfPage)
|
|
|
|
=> throw new NotImplementedException();
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
public Task PushModalAsync(ViewTypes p_oTypeOfPage)
|
|
|
|
=> throw new NotImplementedException();
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
/// <summary> Shows a page.</summary>
|
|
|
|
/// <param name="route">Route of the page to show.</param>
|
|
|
|
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
|
2021-05-13 20:16:41 +02:00
|
|
|
|
2021-06-26 20:57:55 +02:00
|
|
|
#if USCSHARP9
|
2021-05-13 20:16:41 +02:00
|
|
|
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
|
2021-06-26 20:57:55 +02:00
|
|
|
#else
|
2023-09-22 11:38:42 +02:00
|
|
|
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
|
2021-06-26 20:57:55 +02:00
|
|
|
#endif
|
2022-09-06 16:08:19 +02:00
|
|
|
}
|
2022-10-03 17:55:10 +02:00
|
|
|
}
|