mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
3.0.275
This commit is contained in:
parent
f38b516d25
commit
578fcee611
70 changed files with 6828 additions and 9625 deletions
|
@ -1,34 +1,35 @@
|
|||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
using TINK.Services.CopriApi.ServerUris;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TINK.ViewModel.Contact
|
||||
{
|
||||
public class HelpContactViewModel : INotifyPropertyChanged
|
||||
public class FeesAndBikesPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary> Gets the platfrom specific prefix. </summary>
|
||||
private Func<string, string> ResourceProvider { get; set; }
|
||||
|
||||
/// <summary> Holds value wether site caching is on or off.</summary>
|
||||
bool IsSiteCachingOn { get; }
|
||||
|
||||
private string FeesResourcePath { get; }
|
||||
|
||||
private string BikesResourcePath { get; }
|
||||
|
||||
|
||||
/// <summary> Constructs view model.</summary>
|
||||
/// <param name="isSiteCachingOn">Set of user permissions</param>
|
||||
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
public HelpContactViewModel(
|
||||
public FeesAndBikesPageViewModel(
|
||||
string hostName,
|
||||
bool isSiteCachingOn,
|
||||
Func<string, string> resourceProvider)
|
||||
string feesResourcePath,
|
||||
string bikesResourcePath,
|
||||
bool isSiteCachingOn)
|
||||
{
|
||||
HostName = hostName;
|
||||
FeesResourcePath = feesResourcePath;
|
||||
BikesResourcePath = bikesResourcePath;
|
||||
IsSiteCachingOn = isSiteCachingOn;
|
||||
|
||||
ResourceProvider = resourceProvider
|
||||
?? throw new ArgumentException($"Can not instantiate {typeof(HelpContactViewModel)}-object. No ressource provider availalbe.");
|
||||
|
||||
}
|
||||
|
||||
/// <summary> Holds the name of the host.</summary>
|
||||
|
@ -39,16 +40,16 @@ namespace TINK.ViewModel.Contact
|
|||
{
|
||||
RentBikeText = new HtmlWebViewSource
|
||||
{
|
||||
Html = HostName.GetIsCopri()
|
||||
? ResourceProvider("HtmlResouces.V02.InfoRentBike.html")
|
||||
: await ViewModelHelper.GetSource($"https://{HostName}/{CopriHelper.SHAREE_SILTEFOLDERNAME}/tariff_info_1.html", IsSiteCachingOn)
|
||||
Html = !string.IsNullOrEmpty(FeesResourcePath)
|
||||
? await ViewModelHelper.GetSource($"https://{HostName}/{FeesResourcePath}" /* "site/tariff_info_1.html" */, IsSiteCachingOn)
|
||||
: await Task.FromResult(ViewModelHelper.FromBody("No fees resource available. Resource path is null or empty."))
|
||||
};
|
||||
|
||||
TypesOfBikesText = new HtmlWebViewSource
|
||||
{
|
||||
Html = HostName.GetIsCopri()
|
||||
? ResourceProvider("HtmlResouces.V02.InfoTypesOfBikes.html")
|
||||
: await ViewModelHelper.GetSource($"https://{HostName}/{CopriHelper.SHAREE_SILTEFOLDERNAME}/bike_info.html", IsSiteCachingOn)
|
||||
Html = !string.IsNullOrEmpty(BikesResourcePath)
|
||||
? await ViewModelHelper.GetSource($"https://{HostName}/{BikesResourcePath}" /*"site/bike_info.html"*/, IsSiteCachingOn)
|
||||
: await Task.FromResult(ViewModelHelper.FromBody("No bikes instruction resource available. Resource path is null or empty."))
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue