sharee.bike-App/LastenradBayern/TINK/View/Settings/AnyPermissionToVisibleConverter.cs

34 lines
1.2 KiB
C#
Raw Permalink Normal View History

2021-11-07 19:42:59 +01:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Xamarin.Forms;
using TINK.Model.User.Account;
using System.Linq;
using System.Reflection;
namespace TINK.View.Settings
{
/// <summary>
/// Translates user permissions into visibility state.
/// Used for container which holds a bunch of GUI elemets which migth all/ partly/ none be visible
/// If all childs are invisible frame must be invisible as well. As soon as one child is visible frame must be visible as well.
/// </summary>
public class AnyPermissionToVisibleConverter : IValueConverter
{
/// <summary> Converts permission value into visible state.</summary>
/// <param name="value">Permission value from view model used to derive whether object is visible or not.</param>
/// <returns>Boolean value indicating whether object is visible or not.</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((Permissions)(value)) != Permissions.None;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Permissions.None;
}
}
}