/// <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(); }
public AppShell() { InitializeComponent(); Routing.RegisterRoute(nameof(AddMedicinePage), typeof(AddMedicinePage)); BindingContext = vm = new AppShellViewModel(); }
public AppShell() { InitializeComponent(); Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage)); Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage)); BindingContext = new AppShellViewModel(this); }
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); }
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)); }
public AppShell() { PageService pageService = new PageService(); shellView = new AppShellViewModel(pageService); InitializeComponent(); //Routing.RegisterRoute(nameof(DataPage), typeof(DataPage)); //Routing.RegisterRoute(nameof(EntryPage), typeof(EntryPage)); }
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); }
public AppShell(AppShellViewModel viewModel, MainPage main) { InitializeComponent(); viewModel.CurrentPage = this; viewModel.UserAccount.CurrentPage = this; mainPage.Content = main; BindingContext = viewModel; }
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()); }
public App() { InitializeComponent(); DependencyService.Get <INotificationManager>().Initialize(); Xamarin.Forms.DataGrid.DataGridComponent.Init(); MainPage = new Views.AppShellView(); Home = MainPage.BindingContext as AppShellViewModel; }
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; }
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); }
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); }
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); }
public AppShell() { this.InitializeComponent(); // Set the data context _viewModel = new AppShellViewModel(); DataContext = _viewModel; Loaded += (senderl, args) => { Current = this; }; SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested; }
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"]; }
public AppShell() { InitializeComponent(); BindingContext = new AppShellViewModel(this, Navigation); }
public AppShell(IRegionManager regionManager) { InitializeComponent(); DataContext = new AppShellViewModel(); }