mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-07-03 19:56:37 +02:00
65 lines
2.4 KiB
C#
65 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using TINK.Model;
|
|
using TINK.Model.Connector;
|
|
|
|
namespace TINK.ViewModel.Settings
|
|
{
|
|
/// <summary> Holds the filters to display..</summary>
|
|
/// <remarks> Former name: FilterCollectionMutable.</remarks>
|
|
public class SettingsBikeFilterViewModel : ObservableCollection<FilterItemMutable>
|
|
{
|
|
/// <summary> Constructs a filter collection object.</summary>
|
|
/// <param name="p_oFilterSettings">All available filters.</param>
|
|
/// <param name="p_oFilterGroupUser">Filters which apply to logged in user.</param>
|
|
public SettingsBikeFilterViewModel(
|
|
IGroupFilterSettings p_oFilterSettings,
|
|
IEnumerable<string> p_oFilterGroupUser)
|
|
{
|
|
foreach (var l_oFilter in p_oFilterSettings)
|
|
{
|
|
if (l_oFilter.Key == FilterHelper.FILTERTINKGENERAL)
|
|
{
|
|
Add(new FilterItemMutable(
|
|
l_oFilter.Key,
|
|
l_oFilter.Value,
|
|
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
|
|
"TINK Lastenräder"));
|
|
continue;
|
|
}
|
|
if (l_oFilter.Key == FilterHelper.FILTERKONRAD)
|
|
{
|
|
Add(new FilterItemMutable(
|
|
l_oFilter.Key,
|
|
l_oFilter.Value,
|
|
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
|
|
"Konrad Stadträder"));
|
|
continue;
|
|
}
|
|
|
|
Add(new FilterItemMutable(
|
|
l_oFilter.Key,
|
|
l_oFilter.Value,
|
|
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
|
|
l_oFilter.Key));
|
|
}
|
|
}
|
|
|
|
/// <summary> Get filter collection which might have been modified for serialization purposes.</summary>
|
|
public Dictionary<string, FilterState> FilterCollection
|
|
{
|
|
get
|
|
{
|
|
var l_Dictionary = new Dictionary<string, FilterState>();
|
|
foreach (var l_oEntry in this)
|
|
{
|
|
l_Dictionary.Add(l_oEntry.Key, l_oEntry.State);
|
|
}
|
|
|
|
return l_Dictionary;
|
|
}
|
|
}
|
|
}
|
|
}
|