-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppShell.xaml.cs
32 lines (26 loc) · 906 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
using BitBuggy.Shipping.Maui.ViewModels;
using System.ComponentModel;
namespace BitBuggy.Shipping.Maui;
public partial class AppShell : Shell
{
private readonly AccountViewModel _accountViewModel;
public AppShell(AccountViewModel accountViewModel)
{
_accountViewModel = accountViewModel;
BindingContext = _accountViewModel;
_accountViewModel.PropertyChanged += OnAccountViewModelPropertyChanged;
InitializeComponent();
}
private void OnAccountViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(AccountViewModel.SignedIn))
{
EmployeeTab.FlyoutItemIsVisible = _accountViewModel.ManagementStaff;
ForceLayout();
}
}
private async void OnAppearing(object sender, EventArgs e)
{
await _accountViewModel.LoginSilentAsync();
}
}