Exemplo n.º 1
0
        private void AppThemeComboBoxChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ViewModel.IsComboboxBlockingEnabled)
            {
                return;
            }

            switch (((ComboBoxItem)(sender as ComboBox)?.SelectedItem)?.Name.ToLower())
            {
            case "defaulttheme":
                SettingsService.Instance.ApplicationThemeType     = AppTheme.Default;
                ((AppShell)Window.Current.Content).RequestedTheme = ElementTheme.Default;
                break;

            case "darktheme":
                SettingsService.Instance.ApplicationThemeType     = AppTheme.Dark;
                ((AppShell)Window.Current.Content).RequestedTheme = ElementTheme.Dark;
                break;

            case "lighttheme":
                SettingsService.Instance.ApplicationThemeType     = AppTheme.Light;
                ((AppShell)Window.Current.Content).RequestedTheme = ElementTheme.Light;
                break;

            default:
                SettingsService.Instance.ApplicationThemeType     = AppTheme.Default;
                ((AppShell)Window.Current.Content).RequestedTheme = ElementTheme.Default;
                break;
            }

            // Reload the style
            TitlebarHelper.UpdateTitlebarStyle();
        }
Exemplo n.º 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            PlaybackViewModel = new PlaybackViewModel(CoreWindow.GetForCurrentThread().Dispatcher);
            _mainAppViewId    = (int)e.Parameter;

            // Set the accent color
            TitlebarHelper.UpdateTitlebarStyle();

            SimpleIoc.Default.GetInstance <ITelemetryService>().TrackPage("Compact Overlay View");
        }
Exemplo n.º 3
0
        public AppShell(string path)
        {
            // Init the XAML
            LoggingService.Log(LoggingService.LogType.Debug, "Loading Shell XAML");
            InitializeComponent();

            // Set the accent color
            TitlebarHelper.UpdateTitlebarStyle();

            LoggingService.Log(LoggingService.LogType.Debug, "Attaching Event Handlers");

            // When the page is loaded (after the following and xaml init)
            // we can perform the async work
            Loaded += async(sender, args) => await PerformAsyncWork(path);

            // Unload events
            Unloaded += (sender, args) => Dispose();

            var titleBar = CoreApplication.GetCurrentView().TitleBar;

            titleBar.LayoutMetricsChanged += (s, e) =>
            {
                AppTitle.Margin = new Thickness(CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset + 12, 8, 0, 0);
            };

            // This is a dirty to show the now playing
            // bar when a track is played. This method
            // updates the required layout for the now
            // playing bar.
            PlaybackService.Instance.OnTrackChange += InstanceOnOnCurrentTrackChanged;


            // Create a shell frame shadow for mobile and desktop
            if (DeviceHelper.IsDesktop)
            {
                ShellFrame.CreateElementShadow(new Vector3(4, 0, 0), 40, new Color {
                    A = 82, R = 0, G = 0, B = 0
                },
                                               ShellFrameShadow);
            }

            // Events for Xbox
            if (DeviceHelper.IsXbox)
            {
                // Make xbox selection easy to see
                Application.Current.Resources["CircleButtonStyle"] =
                    Application.Current.Resources["XboxCircleButtonStyle"];
            }

            RootFrame.Focus(FocusState.Keyboard);
        }
Exemplo n.º 4
0
        public OverlayView()
        {
            InitializeComponent();

            _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

            ViewModel.Service.PropertyChanged += Service_PropertyChanged;

            // Set the accent color
            TitlebarHelper.UpdateTitlebarStyle();

            BackgroundImage.Source =
                new BitmapImage(new Uri(ArtworkConverter.ConvertObjectToImage(ViewModel.Service.CurrentTrack)));
            TrackTitle.Text = ViewModel.Service.CurrentTrack.Title;
            TrackUser.Text  = ViewModel.Service.CurrentTrack.User.Username;
        }
Exemplo n.º 5
0
        public OverlayView()
        {
            InitializeComponent();

            Loaded += (sender, args) =>
            {
                PlaybackViewModel = new PlaybackViewModel(CoreWindow.GetForCurrentThread().Dispatcher);
            };

            Unloaded += (sender, args) =>
            {
                PlaybackViewModel?.Dispose();
                PlaybackViewModel = null;
            };

            // Set the accent color
            TitlebarHelper.UpdateTitlebarStyle();
        }
Exemplo n.º 6
0
        public MainShell(string path)
        {
            // Init the XAML
            InitializeComponent();

            // Set the accent color
            TitlebarHelper.UpdateTitlebarStyle();

            // When the page is loaded (after the following and xaml init)
            // we can perform the async work
            Loaded += async(sender, args) => await PerformAsyncWork(path);

            // Unload events
            Unloaded += (sender, args) => Dispose();

            // This is a dirty to show the now playing
            // bar when a track is played. This method
            // updates the required layout for the now
            // playing bar.
            PlaybackService.Instance.PropertyChanged += ServiceOnPropertyChanged;

            // Create a shell frame shadow for mobile and desktop
            if (DeviceHelper.IsDesktop || DeviceHelper.IsMobile)
            {
                ShellFrame.CreateElementShadow(new Vector3(0, 0, 0), 20, new Color {
                    A = 52, R = 0, G = 0, B = 0
                },
                                               ShellFrameShadow);
            }

            // Events for Xbox
            if (DeviceHelper.IsXbox)
            {
                // Pane is hidden by default
                MainSplitView.IsPaneOpen              = false;
                MainSplitView.DisplayMode             = SplitViewDisplayMode.CompactOverlay;
                MainSplitView.Margin                  = new Thickness();
                MainSplitView.LightDismissOverlayMode = LightDismissOverlayMode.On;

                // Center all navigation icons
                NavbarScrollViewer.VerticalAlignment = VerticalAlignment.Center;

                // Show background blur image
                XboxOnlyGrid.Visibility = Visibility.Visible;
                ShellFrame.Background   = new SolidColorBrush(Colors.Transparent);

                // Splitview pane gets background
                SplitViewPaneGrid.Background =
                    Application.Current.Resources["InAppBackgroundBrush"] as CustomAcrylicBrush;

                // Make xbox selection easy to see
                Application.Current.Resources["CircleButtonStyle"] =
                    Application.Current.Resources["XboxCircleButtonStyle"];
            }

            // Events for Mobile
            if (DeviceHelper.IsMobile)
            {
                // Splitview pane gets background
                SplitViewPaneGrid.Background =
                    Application.Current.Resources["MobileBlurHeader"] as CustomAcrylicBrush;

                // Amoled Magic
                Application.Current.Resources["ShellBackground"] =
                    new SolidColorBrush(Application.Current.RequestedTheme == ApplicationTheme.Dark
                       ? Colors.Black
                        : Colors.White);

                MainSplitView.IsPaneOpen  = false;
                MainSplitView.DisplayMode = SplitViewDisplayMode.Overlay;
                MainSplitView.Margin      = new Thickness(0);

                SplitViewPaneGrid.Margin = new Thickness {
                    Top = 48
                };

                MobileMenu.Visibility      = Visibility.Visible;
                HamburgerButton.Visibility = Visibility.Collapsed;
            }

            if (DeviceHelper.IsDesktop)
            {
                MainSplitView.IsPaneOpen = SettingsService.Instance.IsMenuOpen;
            }

            // Focus on the root frame
            RootFrame.Focus(FocusState.Programmatic);
        }