Esempio n. 1
0
        private async void StartApp(string args, ApplicationExecutionState previousState)
        {
            MainOuterFrame = Window.Current.Content as _1_1.Views.OuterFrame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (MainOuterFrame == null)
            {
                RootFrame = new ApplicationFrame();
                RootFrame.NavigationFailed += OnNavigationFailed;

                MainOuterFrame = new _1_1.Views.OuterFrame(RootFrame);
                Window.Current.Content = MainOuterFrame;// MainHamburgerBar;
                MainOuterFrame.SizeChanged += (s, e) =>
                {
                    CurrentWidth = e.NewSize.Width;
                    ContentWidthChanged?.Invoke(s, e);
                };
                await Initialize();
                // Create a Frame to act as the navigation context and navigate to the first page
                Common.SuspensionManager.RegisterFrame(RootFrame, "appFrame");

                // Place the frame in the current Window
                //MainHamburgerBar.Content = RootFrame;
                //MainHamburgerBar.SetRootFrame(RootFrame);
                if (previousState == ApplicationExecutionState.Terminated)
                {
                    await Common.SuspensionManager.RestoreAsync();
                }
            }

            if (RootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter

                //if (BandwidthManager.EffectiveBandwidthOptions == BandwidthOptions.Low)
                //{
                //    switch (SettingsManager.GetSetting<int>("LimitedData.LaunchPage", false, 0))
                //    {
                //        case 0:
                //            RootFrame.Navigate(typeof(BusMapPage), "CurrentLocation");
                //            break;
                //        case 1:
                //            RootFrame.Navigate(typeof(FavoritesPage));
                //            break;
                //        case 2:
                //            RootFrame.Navigate(typeof(RoutesPage));
                //            break;
                //    }
                //}
                //else
                //{
                //    switch (SettingsManager.GetSetting<int>("LaunchPage", false, 0))
                //    {
                //        case 0:
                //            RootFrame.Navigate(typeof(BusMapPage), "CurrentLocation");
                //            break;
                //        case 1:
                //            RootFrame.Navigate(typeof(FavoritesPage));
                //            break;
                //        case 2:
                //            RootFrame.Navigate(typeof(RoutesPage));
                //            break;
                //    }
                //}

                //Test Page
                //RootFrame.Navigate(typeof(_1_1.Views.Pages.TransitMapPage));
                RootFrame.Navigate(typeof(_1_1.Views.Pages.TestPage1));
            }
            Window.Current.Activate();

            Message.ShowMessage(new Message() { ShortSummary = "Public transit data powered by OneBusAway.", Caption = "Welcome!", FullText = "This app uses data provided by the OneBusAway api. OneBusAway also provides its own app for this platform, and is available for free. This app builds on the functions of the official app, and provides additional functionality not available in OneBusAway's own app.", Id = 1 });
            //if (CurrentApp.LicenseInformation.IsTrial)
            //    MainHamburgerBar.ShowAds = true;

            //using (var db = FileManager.GetDatabase())
            //{
            //    db.CreateTable<BusTrip>();
            //    db.Insert(new BusTrip() { Destination = "Federal Way", Route = "187", Shape = "Square" });
            //}
        }
Esempio n. 2
0
        private async void StartApp(string args, ApplicationExecutionState previousState)
        {
            MainOuterFrame = Window.Current.Content as _1_1.Views.OuterFrame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (MainOuterFrame == null)
            {
                RootFrame = new ApplicationFrame();
                RootFrame.NavigationFailed += OnNavigationFailed;

                MainOuterFrame              = new _1_1.Views.OuterFrame(RootFrame);
                Window.Current.Content      = MainOuterFrame;// MainHamburgerBar;
                MainOuterFrame.SizeChanged += (s, e) =>
                {
                    CurrentWidth = e.NewSize.Width;
                    ContentWidthChanged?.Invoke(s, e);
                };
                await Initialize();

                // Create a Frame to act as the navigation context and navigate to the first page
                Common.SuspensionManager.RegisterFrame(RootFrame, "appFrame");

                // Place the frame in the current Window
                //MainHamburgerBar.Content = RootFrame;
                //MainHamburgerBar.SetRootFrame(RootFrame);
                if (previousState == ApplicationExecutionState.Terminated)
                {
                    await Common.SuspensionManager.RestoreAsync();
                }
            }

            if (RootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter

                //if (BandwidthManager.EffectiveBandwidthOptions == BandwidthOptions.Low)
                //{
                //    switch (SettingsManager.GetSetting<int>("LimitedData.LaunchPage", false, 0))
                //    {
                //        case 0:
                //            RootFrame.Navigate(typeof(BusMapPage), "CurrentLocation");
                //            break;
                //        case 1:
                //            RootFrame.Navigate(typeof(FavoritesPage));
                //            break;
                //        case 2:
                //            RootFrame.Navigate(typeof(RoutesPage));
                //            break;
                //    }
                //}
                //else
                //{
                //    switch (SettingsManager.GetSetting<int>("LaunchPage", false, 0))
                //    {
                //        case 0:
                //            RootFrame.Navigate(typeof(BusMapPage), "CurrentLocation");
                //            break;
                //        case 1:
                //            RootFrame.Navigate(typeof(FavoritesPage));
                //            break;
                //        case 2:
                //            RootFrame.Navigate(typeof(RoutesPage));
                //            break;
                //    }
                //}

                //Test Page
                //RootFrame.Navigate(typeof(_1_1.Views.Pages.TransitMapPage));
                RootFrame.Navigate(typeof(_1_1.Views.Pages.TestPage1));
            }
            Window.Current.Activate();

            Message.ShowMessage(new Message()
            {
                ShortSummary = "Public transit data powered by OneBusAway.", Caption = "Welcome!", FullText = "This app uses data provided by the OneBusAway api. OneBusAway also provides its own app for this platform, and is available for free. This app builds on the functions of the official app, and provides additional functionality not available in OneBusAway's own app.", Id = 1
            });
            //if (CurrentApp.LicenseInformation.IsTrial)
            //    MainHamburgerBar.ShowAds = true;

            //using (var db = FileManager.GetDatabase())
            //{
            //    db.CreateTable<BusTrip>();
            //    db.Insert(new BusTrip() { Destination = "Federal Way", Route = "187", Shape = "Square" });
            //}
        }