private async void colorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ViewModel.IsComboboxBlockingEnabled) { return; } var selectedItem = ((ComboBoxItem)(sender as ComboBox)?.SelectedItem)?.Content?.ToString(); switch (selectedItem) { case "SoundCloud Orange": SettingsService.Current.AppAccentColor = "#FFFF5500"; AccentHelper.UpdateAccentColor(); break; case "System Accent": SettingsService.Current.AppAccentColor = "ACCENT"; AccentHelper.UpdateAccentColor(); break; case "Custom": await new ColorDialog().ShowAsync(); break; } }
public Overlay() { InitializeComponent(); _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; ViewModel.Service.PropertyChanged += Service_PropertyChanged; // Set the accent color AccentHelper.UpdateAccentColor(); BackgroundImage.Blur(40).Start(); BackgroundImage.Source = new BitmapImage(new Uri(ArtworkConverter.ConvertObjectToImage(ViewModel.Service.CurrentTrack))); }
public async Task CreateDynamicAccentWithColor() { await TestHost.SwitchToAppThread(); var applicationTheme = ThemeManager.DetectAppStyle(Application.Current); var ex = Record.Exception(() => AccentHelper.ApplyColor(Colors.Red, "CustomAccentRed")); Assert.Null(ex); var detected = ThemeManager.DetectAppStyle(Application.Current); Assert.NotNull(detected); Assert.Equal("CustomAccentRed", detected.Item2.Name); ex = Record.Exception(() => AccentHelper.ApplyColor(Colors.Green, "CustomAccentGreen")); Assert.Null(ex); detected = ThemeManager.DetectAppStyle(Application.Current); Assert.NotNull(detected); Assert.Equal("CustomAccentGreen", detected.Item2.Name); ThemeManager.ChangeAppStyle(Application.Current, applicationTheme.Item2, applicationTheme.Item1); }
public void Apply() { SettingsService.Current.AppAccentColor = ColorPicker.Color.ToString(); AccentHelper.UpdateAccentColor(); Hide(); }
public MainShell(string path) { // Init the XAML InitializeComponent(); // Set the accent color AccentHelper.UpdateAccentColor(); // Amoled Magic if (App.IsMobile) { Application.Current.Resources["ShellBackground"] = new SolidColorBrush(Application.Current.RequestedTheme == ApplicationTheme.Dark ? Colors.Black : Colors.White); } // Make xbox selection easy to see if (App.IsXbox) { Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playint bar. Service.PropertyChanged += (sender, args) => { if (args.PropertyName != "CurrentTrack") { return; } if (Service.CurrentTrack == null || !App.IsDesktop || RootFrame.CurrentSourcePageType == typeof(Track)) { HideNowPlayingBar(); } else { ShowNowPlayingBar(); } }; // Create the blur for desktop if (App.IsDesktop) { CreateShellFrameShadow(); } else { HideNowPlayingBar(); } if (App.IsXbox) { // Pane is hidden by default MainSplitView.IsPaneOpen = false; // Show the search bar SearchXboxTab.Visibility = Visibility.Visible; // Center all navigation icons NavbarScrollViewer.VerticalAlignment = VerticalAlignment.Center; // Show background blur image XboxOnlyGrid.Visibility = Visibility.Visible; ShellFrame.Background = new SolidColorBrush(Colors.Transparent); } // Mobile Specific stuff if (App.IsMobile) { RootFrame.Margin = new Thickness { Left = 0, Right = 0, Top = 0, Bottom = 64 }; MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; MobileNavigation.Visibility = Visibility.Visible; NowPlaying.Visibility = Visibility.Collapsed; } else { MobileNavigation.Visibility = Visibility.Collapsed; } RootFrame.Focus(FocusState.Programmatic); }