Пример #1
0
        /// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        public AppShell()
        {
            InitializeComponent();

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

                CheckTogglePaneButtonSizeChanged();

                var titleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar;
                titleBar.IsVisibleChanged += TitleBar_IsVisibleChanged;
            };

            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;
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;


            NavMenuList.ItemsSource = navlist;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        public AppShell(IWalletRepository walletRepository)
        {
            InitializeComponent();
            _walletRepository = walletRepository;

            _navlist = BuildNavigationList();

            Loaded += (sender, args) =>
            {
                Current = this;
                TogglePaneButton.Focus(FocusState.Programmatic);
            };

            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;

            NavMenuList.ItemsSource = _navlist;
        }
Пример #3
0
        public MainPage()
        {
            InitializeComponent();
            NavigationCacheMode = NavigationCacheMode.Required;
            DataContext         = this;

            RootSplitView.RegisterPropertyChangedCallback(SplitView.DisplayModeProperty, (s, a) => { CheckTogglePaneButtonSizeChanged(); });

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            NavMenuList.ItemsSource = navlist;
        }
Пример #4
0
        /// <summary>
        /// Gest a hold of the current frame so that we can inspect the app back stack.
        /// </summary>
        /// <param name="handled">The handled flag.</param>
        public void BackRequested(ref bool handled)
        {
            if (AppFrame == null)
            {
                return;
            }

            if (RootSplitView.IsSwipeablePaneOpen &&
                RootSplitView.DisplayMode == SplitViewDisplayMode.Overlay || RootSplitView.DisplayMode == SplitViewDisplayMode.CompactOverlay)
            {
                handled = true;
                RootSplitView.CloseSwipeablePane();
            }
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        public MainPage()
        {
            DataContextChanged += (sender, args) => ViewModel = DataContext as MainPageViewModel;

            DataContext = new MainPageViewModel();


            InitializeComponent();

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

                CheckTogglePaneButtonSizeChanged();

                CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar;
                titleBar.IsVisibleChanged      += TitleBar_IsVisibleChanged;
                titleBar.ExtendViewIntoTitleBar = true;
            };

            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;
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;


            NavMenuList.ItemsSource   = _navlist;
            NavMenuList.SelectedIndex = 0;
        }
Пример #6
0
        // Declare the top level nav items

        /// <summary>
        ///     Initializes a new instance of the AppShell, sets the static 'Current' reference,
        ///     adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        ///     provide the nav menu list with the data to display.
        /// </summary>
        public AppShell()
        {
            InitializeComponent();

            Loading += async(sender, args) =>
            {
                // StatusBar is Mobile only
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
                }
            };

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

                //TogglePaneButton.Focus(FocusState.Programmatic);
                NavMenuList.SelectedIndex = 0;
                var dm = DataModelServiceFactory.CurrentDataModelService();

#if SQLITE
                var trips = await dm.LoadTripsAsync();

                if (AppSettings.HasRun && trips.Any())
                {
                    // Load trips from DB
                    foreach (var trip in trips)
                    {
                        AddTrip(trip.Name, trip.Id);
                    }
                    var parameter = new TripNavigationParameter {
                        TripId = trips.First().Id
                    }.GetJson();
                    NavigateToPage(typeof(TripDetailPage), parameter);
                    LandingPage.Visibility = Visibility.Collapsed;
                }
                else
                {
                    LandingPage.ShowCreateFirstTrip = true;
                }
#else
                // When connecting to Azure, this is where we authenticate and then load the seed data into the local tables.
                // Then sync to the cloud
                bool isAuthenticated = false;
                while (!isAuthenticated)
                {
                    var authResponse = await dm.AuthenticateAsync();

                    isAuthenticated = authResponse.Item1;
                    if (!isAuthenticated)
                    {
                        var dialog = new MessageDialog(authResponse.Item2);
                        dialog.Commands.Add(new UICommand("OK"));
                        await dialog.ShowAsync();
                    }
                }

                await SetBusyAsync("Synchronising");

                var trips = await dm.LoadTripsAsync();
                await ClearBusyAsync();

                if (trips.Any())
                {
                    AppSettings.HasRun = true;

                    // Load trips from DB
                    foreach (var trip in trips)
                    {
                        AddTrip(trip.Name, trip.Id);
                    }
                    var parameter = new TripNavigationParameter {
                        TripId = trips.First().Id
                    }.GetJson();
                    NavigateToPage(typeof(TripDetailPage), parameter);
                    LandingPage.Visibility = Visibility.Collapsed;
                }
                else
                {
                    LandingPage.ShowCreateFirstTrip = true;
                }
#endif
            };

            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;
            PopupManager.Configure(this, ParentedPopup, HitBlocker);
        }