Exemplo n.º 1
0
        public AppShell()
        {
            InitializeComponent();

            Current = this;

            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
            DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;

            //AppFrame.Language = ApplicationLanguages.Languages[0];
            AppFrame.CacheSize = 1; // TODO: change this value to a cache size that is appropriate for your application

            //ApplicationView view = ApplicationView.GetForCurrentView();
            //bool isInFullScreenMode = view.IsFullScreenMode;
            //view.TryEnterFullScreenMode();



            //var titleBar = ApplicationView.GetForCurrentView().TitleBar;
            //titleBar.BackgroundColor = Colors.Transparent;
            //titleBar.ForegroundColor = Colors.White;
            //titleBar.ButtonBackgroundColor = Colors.Maroon;
            //titleBar.ButtonForegroundColor = Colors.Yellow;

            //CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            //Window.Current.SetTitleBar(customTitleBar);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user. Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            //if (System.Diagnostics.Debugger.IsAttached)
            //    DebugSettings.EnableFrameRateCounter = true;
#endif
            var titleBar = ApplicationView.GetForCurrentView().TitleBar;
            if (titleBar != null)
            {
                Color titleBarColor = (Color)Current.Resources["SystemChromeMediumColor"];
                titleBar.BackgroundColor = titleBarColor;
                titleBar.ButtonBackgroundColor = titleBarColor;
            }

            AppManager.Init();

            var shell = Window.Current.Content as AppShell;
            if (shell == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                shell = new AppShell();

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

                Window.Current.Content = shell;
            }

            if (e.PrelaunchActivated == false)
            {
                // TODO: This is not a prelaunch activation. Perform operations which
                // assume that the user explicitly launched the app such as updating
                // the online presence of the user on a social network, updating a
                // what's new feed, etc.

                if (shell.AppFrame.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
                    shell.AppFrame.Navigate(typeof(ProfilesPage), e.Arguments, new SuppressNavigationTransitionInfo());
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 200));
        }