コード例 #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
ファイル: AppShell.xaml.cs プロジェクト: g1357/DemoAuth
        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
ファイル: AppShell.xaml.cs プロジェクト: Mehigh17/Fluid-IRC
        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();
 }