ContentPage.ToolbarItems disappear after change page by slash

mammadkomamammadkoma Member ✭✭

ContentPage.ToolbarItems disappear after change page by slash

Hi
This is MainPage with ToolBar:

<ContentPage.ToolbarItems>


</ContentPage.ToolbarItems>

MainViewModel:
Logout = new BitDelegateCommand(async () =>
{
await securityService.Logout();
await navigationService.NavigateAsync("/Login");
});

LoginViewModel:
await securityService.LoginWithCredentials(UserName, Password, "Owner", "secret");
await navigationService.NavigateAsync("/Main");

When I click LogOut and Login again ToolbarItems disappear in MainPage.
When I remove / (slash) before "/Login" or "/Main" , problem resolves.
But I don't want user can back to before page after login or after logout.
What should I do?

Answers

  • mammadkomamammadkoma Member ✭✭
    edited May 2018

    Nobody ?!

  • NikolayMNikolayM USMember ✭✭

    I don`t know what navigationService you are using but ToolbarItems must be set on every page. Give more information on what you are using and what do you expect to happen.

  • mammadkomamammadkoma Member ✭✭

    Prism
    When I click LogOut and Login again ToolbarItems disappear in MainPage.
    When I remove / (slash) before "/Login" or "/Main" , problem resolves.
    But I don't want that user can back to before page after login or after logout.

  • mammadkomamammadkoma Member ✭✭
    edited May 2018

    using Bit.ViewModel;
    using Bit.ViewModel.Contracts;
    using Prism.Navigation;
    using Prism.Services;
    using System;
    
    namespace Sanaap.App.ViewModels
    {
        public class MainViewModel : BitViewModelBase
        {
            public BitDelegateCommand GoToMySosRequests { get; set; }
    
            public BitDelegateCommand Logout { get; set; }
    
            public BitDelegateCommand SubmitSosRequest { get; set; }
    
            public BitDelegateCommand SubmitSosRequestByCall { get; set; }
    
            public bool IsBusy { get; set; } = false;
    
            public MainViewModel(INavigationService navigationService,
                ISecurityService securityService, IDeviceService deviceService)
            {
                GoToMySosRequests = new BitDelegateCommand(async () =>
                {
                    await navigationService.NavigateAsync("MySosRequests");
                });
    
                Logout = new BitDelegateCommand(async () =>
                {
                    await securityService.Logout();
                    await navigationService.NavigateAsync("/Login");
                });
    
                SubmitSosRequest = new BitDelegateCommand(async () =>
                {
                    await navigationService.NavigateAsync("SubmitSosRequest");
                });
    
                SubmitSosRequestByCall = new BitDelegateCommand(() =>
                {
                    deviceService.OpenUri(new Uri("tel://02141558"));
                });
            }
        }
    }
    
  • mammadkomamammadkoma Member ✭✭

    Nobody ?!

Sign In or Register to comment.