private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { FrameworkElement selectedElement = e.AddedItems[0] as FrameworkElement; if (selectedElement.Name == "SideDrawerItemHamburger") { HamburgerButtonSelected(); return; } SideDrawerItem item = sideDrawerItems.FirstOrDefault(x => x.Key == selectedElement.Name).Value; if (!isMenuOptionAllowed(item)) { undoSelect(); return; } if (item != null) { Navigation.Navigate(item.NavigationDestination); } } }
private bool isMenuOptionAllowed(SideDrawerItem item) { return((item.Deliverer && Model.IsDeliverer) || (item.Orderer && Model.IsOrderer) || (item.Unregistered && !Model.IsRegistered)); }