-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppShell.xaml.cs
33 lines (26 loc) · 1008 Bytes
/
AppShell.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.ComponentModel;
using System.Globalization;
namespace MaApp;
public partial class AppShell : Shell, INotifyPropertyChanged
{
public AppShell()
{
InitializeComponent();
}
// this is set after user logged in (according to the current user's permissions on different modules
public Dictionary<string, int> Permissions { get; set; }
}
public class PermissionsToVisibility : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo info)
{
if (value == null || (value as Dictionary<string, int>).Count == 0) return false;
Dictionary<string, int> perms = value as Dictionary<string, int>;
string module = parameter as string;
if (perms.ContainsKey(module))
return perms[module] > 0;
else
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}