Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 20:03:07 +02:00
parent 193aaa1a56
commit b72c67a53e
228 changed files with 25924 additions and 0 deletions

View file

@ -0,0 +1,81 @@
using System;
using System.Windows.Input;
using Xamarin.Forms;
namespace TINK.ViewModel.Info.BikeInfo
{
public class CourouselPageItemViewModel
{
public CourouselPageItemViewModel(
string p_strTitle,
string p_strLegend,
int p_iCurrentPageIndex,
Func<int> p_iPagesCountProvider,
Action p_oCloseAction,
ImageSource image = null)
{
Title = p_strTitle;
IsImageVisble = image != null;
if (IsImageVisble)
{
Image = image;
}
DescriptionText = p_strLegend;
CurrentPageIndex = p_iCurrentPageIndex;
PagesCountProvider = p_iPagesCountProvider;
CloseAction = p_oCloseAction;
}
/// <summary> Gets the title of the navigation page. </summary>
public string Title { get; }
public bool IsImageVisble { get; }
/// <summary> Gets the image. </summary>
public ImageSource Image { get; }
/// <summary> Gets the text which describes the image. </summary>
public string DescriptionText { get; }
/// <summary> Get the progress of the carousselling progress.</summary>
public double ProgressValue
{
get
{
var l_oCount = PagesCountProvider();
return l_oCount > 0 ? (double)CurrentPageIndex / l_oCount : 0;
}
}
/// <summary> Gets if user can leave carousel page.</summary>
public bool IsCloseVisible
{
get
{
return PagesCountProvider() == CurrentPageIndex;
}
}
/// <summary>
/// Commang object to bind login button to view model.
/// </summary>
public ICommand OnCloseRequest
{
get
{
return new Command(() => CloseAction());
}
}
/// <summary> Returns one based index of the current page. </summary>
private int CurrentPageIndex { get; }
/// <summary> Gets the count of carousel pages. </summary>
private Func<int> PagesCountProvider { get; }
/// <summary> Action to actuate when close is invoked. </summary>
private Action CloseAction { get; }
}
}