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

            titleBar = ApplicationView.GetForCurrentView().TitleBar;

            //Allows other Classes to use methods in this Class
            Current = this;

            Start_Settings();
            tip = new Tip();

            Login_Start.Begin();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;
            this.NavigationCacheMode = NavigationCacheMode.Required;

            if(Setting_SOMP == true)
            {
                RadioButton_3.IsChecked = true;
                RadioButton_3_Click(null, null);
            }

            Baaga();

            DC.Trace("(MainPage Loaded)");
            DC.Hide();

            //UpdateColorsStart();
        }
Пример #2
0
 internal CustomTitleBar()
 {
     _titleBar = ApplicationView.GetForCurrentView().TitleBar;
     if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
     {
         _statusBar = StatusBar.GetForCurrentView();
         _statusBar.BackgroundOpacity = 1.0;
     }
 }
Пример #3
0
        public Home_Admin()
        {
            this.InitializeComponent();

            // formats title bar
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            formattableTitleBar.ButtonForegroundColor = Colors.White;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            // Show user logged in
            welcomeTxtBlock.Text = "Welcome, " + App.userLogged_firstName + " " + App.userLogged_lastName; // Show user logged
            userNameTxtBlk.Text  = App.userLogged_lastName.ToUpper() + ", " + App.userLogged_firstName;
            userIdTxtBlk.Text    = App.userLogged_id;
        }
Пример #4
0
    private static void StyleTitleBar()
    {
        ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

        // Transparent colors
        titleBar.ForegroundColor               = Colors.Transparent;
        titleBar.BackgroundColor               = Colors.Transparent;
        titleBar.ButtonBackgroundColor         = Colors.Transparent;
        titleBar.InactiveBackgroundColor       = Colors.Transparent;
        titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

        // Theme aware colors
        titleBar.ButtonForegroundColor         = titleBar.ButtonHoverForegroundColor = titleBar.ButtonPressedForegroundColor = Colors.White;
        titleBar.ButtonHoverBackgroundColor    = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF);
        titleBar.ButtonPressedBackgroundColor  = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF);
        titleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF);
        titleBar.InactiveForegroundColor       = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0);
    }
Пример #5
0
        public static void ApplyColorToTitleBarButtons(Color?backgroundColor = null, Color?foregroundColor = null, Color?inactiveBackgroundColor = null, Color?inactiveForegroundColor = null, Color?buttonPressedForegroundColor = null, Color?buttonHoverBackgroundColor = null, Color?buttonHoverForegroundColor = null)
        {
            if (backgroundColor is null)
            {
                backgroundColor = _systemAccentBrush.Color;
            }

            ApplicationViewTitleBar titleBar = TitleBar;

            titleBar.ButtonBackgroundColor         = backgroundColor;
            titleBar.ButtonForegroundColor         = foregroundColor ?? Colors.White;
            titleBar.ButtonInactiveBackgroundColor = inactiveBackgroundColor ?? Colors.LightGray;
            titleBar.ButtonInactiveForegroundColor = inactiveForegroundColor ?? Colors.Gray;
            titleBar.ButtonPressedBackgroundColor  = backgroundColor;
            titleBar.ButtonPressedForegroundColor  = buttonPressedForegroundColor ?? Colors.White;
            titleBar.ButtonHoverBackgroundColor    = buttonHoverBackgroundColor ?? ExtrapolateModestButtonHoverBackground(backgroundColor.Value);
            titleBar.ButtonHoverForegroundColor    = buttonHoverForegroundColor ?? Colors.White;
        }
        private async void Properties_Loaded(object sender, RoutedEventArgs e)
        {
            App.AppSettings.ThemeModeChanged += AppSettings_ThemeModeChanged;
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
            {
                // Set window size in the loaded event to prevent flickering
                ApplicationView.GetForCurrentView().Consolidated += Properties_Consolidated;
                TitleBar = ApplicationView.GetForCurrentView().TitleBar;
                TitleBar.ButtonBackgroundColor         = Colors.Transparent;
                TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() => App.AppSettings.UpdateThemeElements.Execute(null));
            }
            else
            {
            }

            ViewModel.GetFilePermissions();
        }
Пример #7
0
        private void OnGridLoad(object sender, RoutedEventArgs e)
        {
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase"))
            {
                Grid grid = sender as Grid;
                Windows.UI.Xaml.Media.AcrylicBrush acrylicBrush = new Windows.UI.Xaml.Media.AcrylicBrush();
                acrylicBrush.BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop;
                acrylicBrush.TintColor        = Color.FromArgb(255, 0, 0, 0);
                acrylicBrush.FallbackColor    = Color.FromArgb(255, 0, 0, 0);
                acrylicBrush.TintOpacity      = 0.6;
                grid.Background = acrylicBrush;

                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            }
        }
Пример #8
0
        public BasePage()
        {
            this.InitializeComponent();
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            LoadLoginData();
            if (Common.Logined)
            {
                TextBlockUserName.Text           = Common.LoginedUser.UserName;
                PersonPictureUser.ProfilePicture = new BitmapImage(new Uri(Common.LoginedUser.ImgUrl));
            }
            Common.BaseFrame     = BaseFrame;
            NavMain.SelectedItem = NavMain.MenuItems[0];
            Common.BaseFrame.Navigate(typeof(Home));
        }
Пример #9
0
        public MainPage()
        {
            this.InitializeComponent();

            //pagina.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri("ms-appx://..//Assets/bck.jpg")), Stretch = Stretch.None };
            pagina.Background = new ImageBrush {
                ImageSource = new BitmapImage(new Uri(this.BaseUri, "../Assets/bck.jpg")), Stretch = Stretch.None
            };

            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Disabled;
        }
Пример #10
0
        private void extendIntoTitleBar()
        {
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            if (CheckContract.isAPIContractExist(6))
            {
                var viewTitleBar = ApplicationView.GetForCurrentView().TitleBar;
                viewTitleBar.ButtonBackgroundColor         = Colors.Transparent;
                viewTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                viewTitleBar.ButtonForegroundColor         = (Color)Resources["SystemBaseHighColor"];
            }
            else
            {
                ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            }
        }
Пример #11
0
        private static void SetTitleBarButtonForeground(ElementTheme theme)
        {
            Color color;

            if (theme == ElementTheme.Dark)
            {
                color = Colors.White;
            }
            else
            {
                color = Colors.Black;
            }

            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ButtonForegroundColor         = color;
            titleBar.ButtonInactiveForegroundColor = color;
        }
        protected async override void OnActivated(IActivatedEventArgs e)
        {
            Frame frame = Window.Current.Content as Frame;

            if (e.Kind == ActivationKind.Protocol)
            {
                var protocolArgs = (ProtocolActivatedEventArgs)e;
                await LoginPage.GetToken(protocolArgs.Uri.ToString());
            }

            if (e is ToastNotificationActivatedEventArgs)
            {
                var         toastActivationArgs = e as ToastNotificationActivatedEventArgs;
                QueryString args = QueryString.Parse(toastActivationArgs.Argument);
                switch (args.ToString())
                {
                case "action&NextIllust":
                    MainPage.mp.SetWallpaper(await MainPage.mp.update());
                    if (frame.Content is MainPage)
                    {
                        break;
                    }
                    frame.Navigate(typeof(MainPage));
                    break;

                case "action&BatterySetting":
                    //唤起Windows电源设置
                    await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:batterysaver"));

                    if (frame.Content is MainPage)
                    {
                        break;
                    }
                    frame.Navigate(typeof(MainPage));
                    break;
                }
            }
            Window.Current.Activate();
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
        }
Пример #13
0
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            try
            {
                var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///CortanaCommad.xml"));

                await VoiceCommandDefinitionManager.
                InstallCommandDefinitionsFromStorageFileAsync(storageFile);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            Frame rootFrame = Window.Current.Content as Frame;
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
            if (rootFrame == null)
            {
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                }


                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                Window.Current.Activate();
            }
        }
Пример #14
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (!(Window.Current.Content is Frame rootFrame))
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // Titlebar customization
                if (RunningOnDesktop)
                {
                    CoreApplicationViewTitleBar CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                    CoreTitleBar.ExtendViewIntoTitleBar = true;

                    ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    titleBar.ButtonBackgroundColor         = Colors.Transparent;
                    titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                }

                rootFrame.NavigationFailed += OnNavigationFailed;

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

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                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
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Пример #15
0
        protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
        {
            // Change minimum window size
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 200));

            // Darken the window title bar using a color value to match app theme
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            if (titleBar != null)
            {
                var titleBarColor = (Color)Current.Resources["SystemChromeMediumColor"];
                titleBar.BackgroundColor       = titleBarColor;
                titleBar.ButtonBackgroundColor = titleBarColor;
            }

            // Ensure the current window is active
            Window.Current.Activate();
            return(Task.FromResult(true));
        }
Пример #16
0
 public void SetColors(ApplicationViewTitleBar titlebar)
 {
     if (titlebar == null)
     {
         return;
     }
     titlebar.BackgroundColor               = BackgroundColor;
     titlebar.ForegroundColor               = ForegroundColor;
     titlebar.InactiveBackgroundColor       = InactiveBackgroundColor;
     titlebar.InactiveForegroundColor       = InactiveForegroundColor;
     titlebar.ButtonBackgroundColor         = ButtonBackgroundColor;
     titlebar.ButtonForegroundColor         = ButtonForegroundColor;
     titlebar.ButtonPressedBackgroundColor  = ButtonPressedBackgroundColor;
     titlebar.ButtonPressedForegroundColor  = ButtonPressedForegroundColor;
     titlebar.ButtonHoverBackgroundColor    = ButtonHoverBackgroundColor;
     titlebar.ButtonHoverForegroundColor    = ButtonHoverForegroundColor;
     titlebar.ButtonInactiveBackgroundColor = ButtonInactiveBackgroundColor;
     titlebar.ButtonInactiveForegroundColor = ButtonInactiveForegroundColor;
 }
Пример #17
0
        private void ShowMainPage(bool isWelcome)
        {
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.BackgroundColor               = Colors.Transparent;
            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                Window.Current.Content      = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                if (isWelcome)
                {
                    ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 400)); // min 192x48 max 500x500
                    ApplicationView.PreferredLaunchViewSize      = new Size(500, 400);           //min 500x320
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
                    rootFrame.Navigate(typeof(WelcomePage));
                }
                else
                {
                    ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(530, 500));
                    ApplicationView.PreferredLaunchViewSize      = new Size(530, 660);
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
                    rootFrame.Navigate(typeof(WhatsNewPage));
                }
            }

            Window.Current.Activate();

            UISettings uiSettings = new UISettings();

            uiSettings.ColorValuesChanged += UiSettings_ColorValuesChanged;
            UiSettings_ColorValuesChanged(uiSettings, null);
        }
Пример #18
0
        private void ExtendAcrylic()
        {
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase") && AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Mobile")
            {
                CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                coreTitleBar.ExtendViewIntoTitleBar = true;

                ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;
                formattableTitleBar.ButtonBackgroundColor         = Colors.Transparent;
                formattableTitleBar.BackgroundColor               = Colors.Transparent;
                formattableTitleBar.ButtonHoverBackgroundColor    = (RequestedTheme == ApplicationTheme.Light) ? Color.FromArgb(255, 200, 200, 200) : Color.FromArgb(255, 64, 64, 64);
                formattableTitleBar.ButtonHoverForegroundColor    = (RequestedTheme == ApplicationTheme.Light) ? Colors.Black : Colors.White;
                formattableTitleBar.ButtonPressedBackgroundColor  = Color.FromArgb(255, 119, 93, 29);
                formattableTitleBar.ButtonForegroundColor         = (RequestedTheme == ApplicationTheme.Light) ? Colors.Black : Colors.White;
                formattableTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                formattableTitleBar.InactiveBackgroundColor       = Colors.Transparent;
                formattableTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            }
        }
Пример #19
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)
        {
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

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

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            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
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Пример #20
0
 private async void Properties_Loaded(object sender, RoutedEventArgs e)
 {
     AppSettings.ThemeModeChanged += AppSettings_ThemeModeChanged;
     AppSettings.PropertyChanged  += AppSettings_PropertyChanged;
     if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
     {
         // Set window size in the loaded event to prevent flickering
         ApplicationView.GetForCurrentView().TryResizeView(new Windows.Foundation.Size(400, 550));
         ApplicationView.GetForCurrentView().Consolidated += Properties_Consolidated;
         TitleBar = ApplicationView.GetForCurrentView().TitleBar;
         TitleBar.ButtonBackgroundColor         = Colors.Transparent;
         TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
         await CoreApplication.MainView.ExecuteOnUIThreadAsync(() => AppSettings.UpdateThemeElements.Execute(null));
     }
     else
     {
         propertiesDialog.Closed += PropertiesDialog_Closed;
     }
 }
Пример #21
0
        private async void Properties_Loaded(object sender, RoutedEventArgs e)
        {
            Microsoft.UI.Xaml.Controls.BackdropMaterial.SetApplyToRootOrPageBackground(sender as Control, true);

            AppSettings.ThemeModeChanged += AppSettings_ThemeModeChanged;
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
            {
                // Set window size in the loaded event to prevent flickering
                TitleBar = ApplicationView.GetForCurrentView().TitleBar;
                TitleBar.ButtonBackgroundColor         = Colors.Transparent;
                TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() => AppSettings.UpdateThemeElements.Execute(null));
            }
            else
            {
                propertiesDialog         = DependencyObjectHelpers.FindParent <ContentDialog>(this);
                propertiesDialog.Closed += PropertiesDialog_Closed;
            }
        }
Пример #22
0
        private void SetupTitleBar()
        {
            ApplicationView view = ApplicationView.GetForCurrentView();

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationViewTitleBar titleBar = view.TitleBar;

            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                StatusBar statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    try
                    {
                        statusBar.BackgroundOpacity = 1;
                        statusBar.BackgroundColor   = ((AcrylicBrush)Current.Resources["AcrylicCommandBarBackground"]).TintColor;
                        statusBar.ForegroundColor   = ((SolidColorBrush)Current.Resources["Foreground"]).Color;
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError(default(EventId), ex, "Error caught accessing resources. (Group 1)");
                    }
                }
            }

            try
            {
                view.TitleBar.ButtonForegroundColor         = ((SolidColorBrush)Current.Resources["Foreground"]).Color;
                view.TitleBar.ButtonHoverBackgroundColor    = ((SolidColorBrush)Current.Resources["MidBG"]).Color;
                view.TitleBar.ButtonHoverForegroundColor    = ((SolidColorBrush)Current.Resources["Foreground"]).Color;
                view.TitleBar.ButtonPressedBackgroundColor  = ((SolidColorBrush)Current.Resources["LightBG"]).Color;
                view.TitleBar.ButtonPressedForegroundColor  = ((SolidColorBrush)Current.Resources["Foreground"]).Color;
                view.TitleBar.ButtonInactiveForegroundColor = ((SolidColorBrush)Current.Resources["MidBG_hover"]).Color;
                view.TitleBar.InactiveForegroundColor       = ((SolidColorBrush)Current.Resources["MidBG_hover"]).Color;
            }
            catch (Exception ex)
            {
                Logger.LogError(default(EventId), ex, "Error caught accessing resources (Group 2).");
            }
        }
Пример #23
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)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

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

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                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
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }

            // SRC: https://stackoverflow.com/questions/33440438/how-to-hide-collapse-title-bar-in-a-uwp-app/33504852
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
        }
Пример #24
0
        public static void SetToolbarChrome(UIElement element)
        {
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor         = Colors.Transparent;
            formattableTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            if (element != null)
            {
                Window.Current.SetTitleBar(element);
            }

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                StatusBar.GetForCurrentView().BackgroundColor   = AppAccent;
                StatusBar.GetForCurrentView().BackgroundOpacity = 0.7;
                StatusBar.GetForCurrentView().ForegroundColor   = Colors.White;
            }
        }
Пример #25
0
        private Task OnInitializeTitleBar()
        {
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.BackgroundColor               = (Color)Application.Current.Resources["TitleBarBackgroundColor"];
            titleBar.ForegroundColor               = (Color)Application.Current.Resources["TitleBarForegroundColor"];
            titleBar.ButtonBackgroundColor         = (Color)Application.Current.Resources["TitleBarButtonBackgroundColor"];
            titleBar.ButtonForegroundColor         = (Color)Application.Current.Resources["TitleBarForegroundColor"];
            titleBar.InactiveBackgroundColor       = (Color)Application.Current.Resources["TitleBarInactiveBackgroundColor"];
            titleBar.InactiveForegroundColor       = (Color)Application.Current.Resources["TitleBarInactiveForegroundColor"];
            titleBar.ButtonInactiveBackgroundColor = (Color)Application.Current.Resources["TitleBarButtonInactiveBackgroundColor"];
            titleBar.ButtonInactiveForegroundColor = (Color)Application.Current.Resources["TitleBarInactiveForegroundColor"];
            titleBar.ButtonHoverBackgroundColor    = (Color)Application.Current.Resources["TitleBarButtonHoverBackgroundColor"];
            titleBar.ButtonHoverForegroundColor    = (Color)Application.Current.Resources["TitleBarForegroundColor"];
            titleBar.ButtonPressedBackgroundColor  = (Color)Application.Current.Resources["TitleBarButtonPressedBackgroundColor"];
            titleBar.ButtonPressedForegroundColor  = (Color)Application.Current.Resources["TitleBarForegroundColor"];

            return(Task.FromResult(0));
        }
        public Scenario1_Colors()
        {
            this.InitializeComponent();
            titleBar = ApplicationView.GetForCurrentView().TitleBar;

            // Infer the radio button selection from the title bar colors.
            if (titleBar.ButtonBackgroundColor == null)
            {
                UseStandardColors.IsChecked = true;
            }
            else if (titleBar.ButtonBackgroundColor.Value.A > 0)
            {
                UseCustomColors.IsChecked = true;
            }
            else
            {
                TransparentWhenExtended.IsChecked = true;
            }
        }
Пример #27
0
        /// <summary>
        /// Set colors and frame
        /// </summary>
        /// <param name="args">Argmunets</param>
        /// <returns></returns>
        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            //draw into the title bar
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            //remove the solid-colored backgrounds behind the caption controls and system back button
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            SolidColorBrush btnForegroundColor        = Current.Resources["TitleBarForegroundThemeBrush"] as SolidColorBrush;
            SolidColorBrush btnBackgroundHoverColor   = Current.Resources["TitleBarPressedBackgroundThemeBrush"] as SolidColorBrush;
            SolidColorBrush btnHoverColor             = Current.Resources["TitleBarButtonHoverThemeBrush"] as SolidColorBrush;
            SolidColorBrush btnBackgroundPressedColor = Current.Resources["TitleBarHoverBackgroundThemeBrush"] as SolidColorBrush;
            SolidColorBrush btnPressedColor           = Current.Resources["TitleBarButtonPressedThemeBrush"] as SolidColorBrush;

            titleBar.BackgroundColor               = Colors.Transparent;
            titleBar.ForegroundColor               = btnForegroundColor.Color;
            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonForegroundColor         = btnForegroundColor.Color;
            titleBar.ButtonHoverBackgroundColor    = btnBackgroundHoverColor.Color;
            titleBar.ButtonHoverForegroundColor    = btnHoverColor.Color;
            titleBar.ButtonPressedBackgroundColor  = btnBackgroundPressedColor.Color;
            titleBar.ButtonPressedForegroundColor  = btnPressedColor.Color;
            titleBar.InactiveBackgroundColor       = Colors.Transparent;
            titleBar.InactiveForegroundColor       = btnForegroundColor.Color;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            titleBar.ButtonInactiveForegroundColor = btnForegroundColor.Color;

            if (Window.Current.Content as ModalDialog == null)
            {
                // create a new frame
                var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);

                // create modal root
                Window.Current.Content = new ModalDialog
                {
                    DisableBackButtonWhenModal = true,
                    Content      = new Views.Shell(nav),
                    ModalContent = new Views.Busy(),
                };
            }
            await Task.CompletedTask;
        }
Пример #28
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationView         view     = ApplicationView.GetForCurrentView();
            ApplicationViewTitleBar titleBar = view.TitleBar;

            titleBar.ButtonBackgroundColor         = Windows.UI.Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.Transparent;

            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
            }
        }
        public LocalMainPage()
        {
            // Maintain state between pages
            this.NavigationCacheMode = NavigationCacheMode.Enabled;


            LinkList = new ObservableCollection <Link>();

            // Show one entry at startup
            LinkList.Add(new Link());

            this.InitializeComponent();

            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
        }
Пример #30
0
        public MainPage()
        {
            InitializeComponent();
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;
            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            formattableTitleBar.ButtonForegroundColor = Colors.DarkGray;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
            coreTitleBar.ExtendViewIntoTitleBar = true;

            NavigationCacheMode = NavigationCacheMode.Required;
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(200, 100));
            History.HistoryChanged += new PropertyChangedEventHandler((e, d) =>
            {
                EditionValue.Copy(History.Current.effect);
                UpdatePreview(false);
            });
            History.Default = new HistoryObject(EffectType.Unkown, DefaultValue);

            if (!SettingStorage.EnableDebug) PivotGrid.Items.Remove(ToolsPivot); //Super ugly (visibilty.collapsed no work for pivot..
        }
Пример #31
0
        public MainPage()
        {
            mainPage = this;
            //Debug.WriteLine("test");
            this.InitializeComponent();

            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
            //ApplicationView.PreferredLaunchViewSize = new Size(1280, 720);
            //ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            // Default switch frame to top menu
            MangaFrame.Navigate(typeof(TopMenuPage));

            Task.Run(() => SetCategories());
        }
Пример #32
0
        private void SetCloseButtonBackgroundColorFromTheme(ThemeListener sender)
        {
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            switch (sender.CurrentTheme)
            {
            case ApplicationTheme.Light:
                titleBar.ButtonForegroundColor      = ((SolidColorBrush)Application.Current.Resources["base03"]).Color;
                titleBar.ButtonHoverBackgroundColor = ((SolidColorBrush)Application.Current.Resources["base2"]).Color;
                break;

            case ApplicationTheme.Dark:
                titleBar.ButtonForegroundColor      = ((SolidColorBrush)Application.Current.Resources["base3"]).Color;
                titleBar.ButtonHoverBackgroundColor = ((SolidColorBrush)Application.Current.Resources["base03"]).Color;
                break;

            default:
                break;
            }
        }
Пример #33
0
        public MainPage()
        {
            this.InitializeComponent();

            /*
             * var titleBar = ApplicationView.GetForCurrentView().TitleBar;
             * titleBar.ForegroundColor = Windows.UI.Colors.Black;
             * titleBar.BackgroundColor = Windows.UI.Colors.WhiteSmoke;
             * titleBar.ButtonForegroundColor = Windows.UI.Colors.Black;
             * titleBar.ButtonBackgroundColor = Windows.UI.Colors.WhiteSmoke;
             */

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ButtonBackgroundColor         = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            titleBar.ButtonForegroundColor = Windows.UI.Colors.Black;
        }
Пример #34
0
 public MainPage()
 {
     this.InitializeComponent();
     titleBar = ApplicationView.GetForCurrentView().TitleBar;
 }
Пример #35
0
 internal CustomTitleBar()
 {
     _titleBar = ApplicationView.GetForCurrentView().TitleBar;
 }