Exemple #1
0
        public async Task NavigateBackAsync(CancellationToken token, params KeyValuePair <string, object>[] parameters)
        {
            await UpdateAuthorizationAsync(token);

            var currentPage = _navigationProvider.GetNavigation().CurrentPage();

            if (!IsAuthorized() && IsAuthorizedNavigation(currentPage.GetType(), out var alternativeTag))
            {
                await _navigationService.NavigateToRootAsync(token, parameters);

                await _navigationService.NavigateWithReplaceAsync(alternativeTag, token, parameters);
            }
            else
            {
                await _navigationService.NavigateBackAsync(token, parameters);
            }
        }
Exemple #2
0
        public async Task <UserMenu> GetMenuAsync()
        {
            if (!_ancSession.UserId.HasValue)
            {
                throw new AncAuthorizationException("请登陆");
            }
            var permissions = await _permissionService.GetAllPermissionsAsync(_ancSession.UserId.Value);

            MenuDefinition menuDefinition = NavigationProvider.GetNavigation();
            UserMenu       userMenu       = new UserMenu(menuDefinition);

            CheckPermission(permissions, menuDefinition.Items, userMenu.Items);
            return(userMenu);
        }