コード例 #1
0
        /// <summary>
        /// Срабатывает при прямом запуске приложения.
        /// </summary>
        /// <param name="e">Передаваемые данные.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                Window.Current.Content = rootFrame;
                rootFrame.Navigate(typeof(ShellView));

                Frame.Navigated += OnNavigated;

                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
                {
                    HardwareButtons.BackPressed += OnBackPressed;
                }

                UpdateBackButtonVisibility();

                if (e.PrelaunchActivated == false)
                {
                    Window.Current.Activate();
                }

                AppHelper app = new AppHelper();
                app.CheckTheme();
                app.GetJumpList();

                UpdateBackButtonVisibility();
            }
        }
コード例 #2
0
        /// <summary>
        /// Срабатывает при открытии файла.
        /// </summary>
        /// <param name="args">Передаваемые данные.</param>
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                Window.Current.Content = rootFrame;
                rootFrame.Navigate(typeof(ShellView));

                Frame.Navigated += OnNavigated;

                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
                {
                    HardwareButtons.BackPressed += OnBackPressed;
                }

                UpdateBackButtonVisibility();

                Window.Current.Activate();

                AppHelper app = new AppHelper();
                app.CheckTheme();
                app.GetJumpList();

                UpdateBackButtonVisibility();

                await Task.Delay(1);

                ChoosingNextPage((IStorageFile)args.Files[0]);

                Frame.BackStack.Clear();
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility
                    = AppViewBackButtonVisibility.Collapsed;
            }
            else
            {
                ChoosingNextPage((IStorageFile)args.Files[0]);
            }
        }