Exemplo n.º 1
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
            ApplicationView.PreferredLaunchViewSize      = new Size {
                Width = 1056, Height = 790
            };
            await BitmapCache.ClearCacheAsync(TimeSpan.FromHours(24));

            await PhotosDataSource.Load();

            await FeaturedControlsDataSource.Load();

            var shell = Window.Current.Content as AppShell;

            if (shell == null)
            {
                shell = new AppShell()
                {
                    Language = Windows.Globalization.ApplicationLanguages.Languages[0]
                };
                NavigationService.Initialize(typeof(App), shell.AppFrame);
                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }

            Window.Current.Content = shell;

            if (shell.AppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page suppressing the initial entrance animation.
                shell.AppFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo());
            }

            Window.Current.Activate();
        }
Exemplo n.º 2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     this.Items = new ObservableCollection <object>(FeaturedControlsDataSource.GetItems());
     AppShell.Current.Shell.SelectItem("Home");
     base.OnNavigatedTo(e);
 }