mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-23 06:16:34 +02:00
Initial version.
This commit is contained in:
parent
193aaa1a56
commit
b72c67a53e
228 changed files with 25924 additions and 0 deletions
|
@ -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; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue