Пример #1
0
        /// <summary>
        /// Initializes a new instance of the AppShell.
        /// </summary>
        public AppShell()
        {
            InitializeComponent();

            // Set the data context
            _viewModel  = new AppShellViewModel();
            DataContext = _viewModel;

            Loaded += (sender, args) =>
            {
                Current = this;

                togglePaneButton.Focus(FocusState.Programmatic);

                // We need to update the initial selection because
                // OnNavigatingToPage happens before Items are loaded in
                // both navigation bars.
                //UpdateSelectionState();
            };

            rootSplitView.RegisterPropertyChangedCallback(
                SplitView.DisplayModeProperty,
                (s, a) =>
            {
                // Ensure that we update the reported size of the TogglePaneButton when the SplitView's
                // DisplayMode changes.
                CheckTogglePaneButtonSizeChanged();
            });

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            ShellHelper.Instance.ChangeTitleColor();
        }
Пример #2
0
        public AppShell()
        {
            InitializeComponent();
            Routing.RegisterRoute(nameof(AddMedicinePage), typeof(AddMedicinePage));

            BindingContext = vm = new AppShellViewModel();
        }
Пример #3
0
        public AppShell()
        {
            InitializeComponent();
            Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage));
            Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage));

            BindingContext = new AppShellViewModel(this);
        }
Пример #4
0
    private AppShellViewModel GetViewModel(INavigationService fakeNavigationService)
    {
        AppShellViewModel vm = new AppShellViewModel(fakeNavigationService);

        vm.NavigationItems.Insert(0, new NavMenuItem(null, null, TestPageName));
        vm.SecondaryNavigationItems.Insert(0, new NavMenuItem(null, null, TestSecondaryPageName));

        return(vm);
    }
Пример #5
0
    public void CurrentSecondaryNavItem_WhenSet_CallsNavigateTo()
    {
        Mock <INavigationService> fakeNavigationService = new Mock <INavigationService>();
        AppShellViewModel         vm = GetViewModel(fakeNavigationService.Object);

        vm.CurrentSecondaryNavItem = vm.SecondaryNavigationItems[0];

        fakeNavigationService.Verify(service => service.NavigateTo(vm.SecondaryNavigationItems[0].PageNavigationName));
    }
Пример #6
0
        public AppShell()
        {
            PageService pageService = new PageService();

            shellView = new AppShellViewModel(pageService);
            InitializeComponent();
            //Routing.RegisterRoute(nameof(DataPage), typeof(DataPage));
            //Routing.RegisterRoute(nameof(EntryPage), typeof(EntryPage));
        }
Пример #7
0
 public async Task <ViewModelBase> Initialize()
 {
     _appVM                 = new AppShellViewModel();
     _appVM.Logout          = new RelayCommand(o => _authService.Logout());
     _appVM.ChangeView      = new RelayCommand(ChangeLayoutExecute);
     _appVM.IsAdmin         = _authService.IsAdmin;
     _appVM.ActiveViewModel = await _controllers["home"].Initialize();
     return(_appVM);
 }
Пример #8
0
        public AppShell(AppShellViewModel viewModel, MainPage main)
        {
            InitializeComponent();
            viewModel.CurrentPage             = this;
            viewModel.UserAccount.CurrentPage = this;

            mainPage.Content = main;
            BindingContext   = viewModel;
        }
Пример #9
0
    public void CurrentPageChanged_WhenRaised_DoesntCallNavigateTo()
    {
        Mock <INavigationService> fakeNavigationService = new Mock <INavigationService>();
        AppShellViewModel         vm = GetViewModel(fakeNavigationService.Object);

        fakeNavigationService.Setup(service => service.CurrentPageKey).Returns(TestPageName);
        fakeNavigationService.Raise(service => service.CurrentPageChanged += null, EventArgs.Empty);

        fakeNavigationService.Verify(service => service.NavigateTo(TestPageName), Times.Never());
    }
Пример #10
0
        public App()
        {
            InitializeComponent();

            DependencyService.Get <INotificationManager>().Initialize();

            Xamarin.Forms.DataGrid.DataGridComponent.Init();
            MainPage = new Views.AppShellView();
            Home     = MainPage.BindingContext as AppShellViewModel;
        }
Пример #11
0
        public AppShell(AppShellViewModel viewModel, INavigationService navService, IEventAggregator eventAggregator)
        {
            _navService      = navService ?? throw new ArgumentNullException(nameof(navService));
            _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));

            InitializeComponent();
            DataContextChanged += OnDataContextChanged;
            DataContext         = viewModel ?? throw new ArgumentNullException(nameof(viewModel));

            eventAggregator.GetEvent <NavigationStateChangedEvent>().Subscribe(OnNavigationStateChanged);
        }
        public AppShell()
        {
            InitializeComponent();

            Shell.SetBackgroundColor(this, Color.FromHex("ED028C"));
            Shell.SetForegroundColor(this, Color.White);
            Shell.SetTabBarIsVisible(this, false);

            viewModel      = new AppShellViewModel(AppContainer.Resolve <IBackendService>());
            BindingContext = viewModel;
        }
Пример #13
0
    public void CurrentPageChanged_OnSecondaryNavItemKey_SetsCurrentSecondaryNavItem()
    {
        Mock <INavigationService> mockNavigationService = new Mock <INavigationService>();
        AppShellViewModel         vm = GetViewModel(mockNavigationService.Object);

        mockNavigationService.Setup(service => service.CurrentPageKey).Returns(TestSecondaryPageName);
        mockNavigationService.Raise(service => service.CurrentPageChanged += null, EventArgs.Empty);

        Assert.Equal(vm.CurrentSecondaryNavItem.PageNavigationName, TestSecondaryPageName);
        Assert.Null(vm.CurrentNavItem);
    }
Пример #14
0
        public void Constructor_ShouldLoadNothing_IfNoConnectionIsEstablished()
        {
            //Arrange
            _crossConnectivityFake.ConnectionValue = false;

            //Act
            var sut = new AppShellViewModel(_backendServiceMock.Object);

            //Assert
            Assert.Null(sut.Rounds);
            _backendServiceMock.Verify(backend => backend.GetAllRounds(It.IsAny <String>()), Times.Never);
        }
Пример #15
0
        public void Constructor_ShouldLoadAllRounds_IfConnectionIsEstablished()
        {
            //Arrange
            _crossConnectivityFake.ConnectionValue = true;

            //Act
            var sut = new AppShellViewModel(_backendServiceMock.Object);

            //Assert
            Assert.That(sut.Rounds, Is.EqualTo(_allRounds));
            _backendServiceMock.Verify(backend => backend.GetAllRounds(It.IsAny <String>()), Times.Once);
        }
Пример #16
0
        public AppShell()
        {
            this.InitializeComponent();

            // Set the data context
            _viewModel  = new AppShellViewModel();
            DataContext = _viewModel;

            Loaded += (senderl, args) =>
            {
                Current = this;
            };

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;
        }
Пример #17
0
        public AppShell()
        {
            this.InitializeComponent();

            // Set the data context
            viewModel   = new AppShellViewModel();
            DataContext = viewModel;

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size {
                Width = 450, Height = 600
            });

            Loaded += (sender, args) =>
            {
                Current = this;

                togglePaneButton.Focus(FocusState.Programmatic);

                // We need to update the initial selection because
                // OnNavigatingToPage happens before Items are loaded in
                // both navigation bars.
                UpdateSelectionState();
            };

            rootSplitView.RegisterPropertyChangedCallback(
                SplitView.DisplayModeProperty,
                (s, a) =>
            {
                // Ensure that we update the reported size of the TogglePaneButton when the SplitView's
                // DisplayMode changes.
                CheckTogglePaneButtonSizeChanged();
            });

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            var titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ButtonBackgroundColor        = Colors.White;
            titleBar.ButtonHoverBackgroundColor   = (Color)Application.Current.Resources["AppAccentLightColor"];
            titleBar.ButtonPressedBackgroundColor = (Color)Application.Current.Resources["AppAccentColor"];
            titleBar.ButtonForegroundColor        = (Color)Application.Current.Resources["AppAccentForegroundColor"];
            titleBar.ButtonHoverForegroundColor   = (Color)Application.Current.Resources["AppAccentForegroundColor"];
        }
Пример #18
0
        public AppShell()
        {
            InitializeComponent();

            BindingContext = new AppShellViewModel(this, Navigation);
        }
Пример #19
0
 public AppShell(IRegionManager regionManager)
 {
     InitializeComponent();
     DataContext = new AppShellViewModel();
 }