Пример #1
0
        public MainPage()
        {
            this.InitializeComponent();

            // Clear the current tile
            //TileUpdateManager.CreateTileUpdaterForApplication().Clear();

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop")
            {
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                TopCommandBar.Visibility = Visibility.Visible;
            }

            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;

            //Transparent buttons, with gray foreground
            titleBar.ButtonBackgroundColor         = Color.FromArgb(0, 242, 0, 242);
            titleBar.ButtonForegroundColor         = Color.FromArgb(255, 150, 150, 150);
            titleBar.InactiveBackgroundColor       = Color.FromArgb(0, 242, 0, 242);
            titleBar.ButtonInactiveBackgroundColor = Color.FromArgb(0, 242, 0, 242);

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();

                if (App.localSettings.Values["Theme"].Equals("Dark"))
                {
                    statusBar.BackgroundColor   = Color.FromArgb(255, 23, 23, 23); //31 31 31
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Color.FromArgb(255, 255, 255, 255);
                }
                else
                {
                    statusBar.BackgroundColor   = Color.FromArgb(255, 242, 242, 242); // 230
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Color.FromArgb(255, 0, 0, 0);
                }

                //statusBar.HideAsync();

                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
                BottomCommandBar.Visibility = Visibility.Visible;
            }

            FirstRunDialogHelper.ShowIfAppropriateAsync();
            rootFrame.Navigate(typeof(Home));
        }
Пример #2
0
        // ###############################################################################################
        public MainPage()
        {
            this.InitializeComponent();

            // Clear the current tile
            //TileUpdateManager.CreateTileUpdaterForApplication().Clear();

            if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop")
            {
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            }

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();

                if (App.localSettings.Values["Theme"].Equals("Dark"))
                {
                    statusBar.BackgroundColor   = Color.FromArgb(255, 23, 23, 23); //31 31 31
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Color.FromArgb(255, 255, 255, 255);
                }
                else
                {
                    statusBar.BackgroundColor   = Color.FromArgb(255, 242, 242, 242); // 230
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Color.FromArgb(255, 0, 0, 0);
                }

                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            }

            // Subscribe to light/dark theme change event
            uiSettings.ColorValuesChanged += ColorValuesChanged;

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            FirstRunDialogHelper.ShowIfAppropriateAsync();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            // Extend acrylic
            ExtendAcrylicIntoTitleBar();
        }