mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-07-04 10:56:28 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
|
@ -21,7 +21,8 @@ namespace TINK.ViewModel.Map
|
|||
public IGroupFilterMapPage FilterDictionary { get; }
|
||||
|
||||
/// <summary> Gets the activated filter.</summary>
|
||||
public string CurrentFilter {
|
||||
public string CurrentFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return FilterDictionary.FirstOrDefault(x => x.Value == FilterState.On).Key ?? string.Empty;
|
||||
|
@ -32,17 +33,18 @@ namespace TINK.ViewModel.Map
|
|||
public bool IsTinkEnabled => !string.IsNullOrEmpty(CurrentFilter) && CurrentFilter.GetBikeCategory() != FilterHelper.CARGOBIKE;
|
||||
|
||||
/// <summary> Gets color of the TINK button. </summary>
|
||||
public Color TinkColor => CurrentFilter.GetBikeCategory() == FilterHelper.CARGOBIKE ? Color.Blue : Color.Gray;
|
||||
|
||||
public Color TinkColor => CurrentFilter.GetBikeCategory() == FilterHelper.CARGOBIKE ? Color.White : Color.FromRgba(0, 0, 0, 0);
|
||||
public Color NoTinkColor => CurrentFilter.GetBikeCategory() == FilterHelper.CARGOBIKE ? Color.FromRgb(210, 17, 20) : Color.White;
|
||||
/// <summary> Gets value whether Konrad is enabled or not. </summary>
|
||||
public bool IsKonradEnabled => !string.IsNullOrEmpty(CurrentFilter) && CurrentFilter.GetBikeCategory() != FilterHelper.CITYBIKE;
|
||||
|
||||
/// <summary> Gets color of the Konrad button. </summary>
|
||||
public Color KonradColor => CurrentFilter.GetBikeCategory() == FilterHelper.CITYBIKE ? Color.Red : Color.Gray;
|
||||
public Color KonradColor => CurrentFilter.GetBikeCategory() == FilterHelper.CITYBIKE ? Color.White : Color.FromRgba(0, 0, 0, 0);
|
||||
public Color NoKonradColor => CurrentFilter.GetBikeCategory() == FilterHelper.CITYBIKE ? Color.FromRgb(210, 17, 20) : Color.White;
|
||||
|
||||
/// <summary> Gets whether toggle functionality is visible or not. </summary>
|
||||
public bool IsToggleVisible =>
|
||||
FilterDictionary.Select(x => x.Key).ContainsGroupId(FilterHelper.CITYBIKE)
|
||||
public bool IsToggleVisible =>
|
||||
FilterDictionary.Select(x => x.Key).ContainsGroupId(FilterHelper.CITYBIKE)
|
||||
&& FilterDictionary.Select(x => x.Key).ContainsGroupId(FilterHelper.CARGOBIKE)
|
||||
&& (IsTinkEnabled || IsKonradEnabled);
|
||||
|
||||
|
@ -56,27 +58,27 @@ namespace TINK.ViewModel.Map
|
|||
/// <returns></returns>
|
||||
public TinkKonradToggleViewModel DoToggle()
|
||||
{
|
||||
var l_oCurrentFilterSet = FilterDictionary.ToArray();
|
||||
var currentFilterSet = FilterDictionary.ToArray();
|
||||
|
||||
if (l_oCurrentFilterSet.Length < 2)
|
||||
if (currentFilterSet.Length < 2)
|
||||
{
|
||||
// There is nothing to toggle because filter set contains only one element.
|
||||
return new TinkKonradToggleViewModel(FilterDictionary);
|
||||
}
|
||||
|
||||
var l_oCurrentState = l_oCurrentFilterSet[l_oCurrentFilterSet.Length - 1].Value == FilterState.On
|
||||
var currentState = currentFilterSet[currentFilterSet.Length - 1].Value == FilterState.On
|
||||
? FilterState.On
|
||||
: FilterState.Off;
|
||||
|
||||
var l_oToggledFilterSet = new Dictionary<string, FilterState>();
|
||||
var toggledFilterSet = new Dictionary<string, FilterState>();
|
||||
|
||||
foreach (var l_oFilterElement in l_oCurrentFilterSet)
|
||||
foreach (var filterElement in currentFilterSet)
|
||||
{
|
||||
l_oToggledFilterSet.Add(l_oFilterElement.Key, l_oCurrentState);
|
||||
l_oCurrentState = l_oFilterElement.Value;
|
||||
toggledFilterSet.Add(filterElement.Key, currentState);
|
||||
currentState = filterElement.Value;
|
||||
}
|
||||
|
||||
return new TinkKonradToggleViewModel(new GroupFilterMapPage(l_oToggledFilterSet));
|
||||
return new TinkKonradToggleViewModel(new GroupFilterMapPage(toggledFilterSet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue