public async Task Show(MiniPlayerType miniPlayerType) { this.miniPlayerType = miniPlayerType; // The order in the owner chain is very important. // It makes sure the overlapping of the windows is correct: // From Top to Bottom: Me -> mParent -> mShadow this.Owner = this.parent; this.parent.LocationChanged += Parent_LocationChanged; this.alignCoverPlayerPlaylistVertically = SettingsClient.Get <bool>("Behaviour", "CoverPlayerAlignPlaylistVertically"); this.SetWindowBorder(SettingsClient.Get <bool>("Appearance", "ShowWindowBorder")); // Makes sure the playlist doesn't appear briefly at the topleft // of the screen just before it is positioned by Me.SetGeometry() this.Top = this.parent.Top; this.Left = this.parent.Left; base.Show(); this.windowHandle = new WindowInteropHelper(this).Handle; this.SetTransparency(); await this.SetGeometry(); }
private void ToggleMiniPlayerPlaylist(MiniPlayerType miniPlayerType, bool isMiniPlayerListExpanded) { switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.isCoverPlayerListExpanded = isMiniPlayerListExpanded; break; case MiniPlayerType.MicroPlayer: this.isMicroPlayerListExpanded = isMiniPlayerListExpanded; break; case MiniPlayerType.NanoPlayer: this.isNanoPlayerListExpanded = isMiniPlayerListExpanded; break; default: break; // Shouldn't happen } if (isMiniPlayerListExpanded) { this.miniPlayerPlaylist.Show(miniPlayerType); } else { this.miniPlayerPlaylist.Hide(); } }
private void SetMiniPlayer(MiniPlayerType miniPlayerType, double playerWidth, double playerHeight, bool isMiniPlayerListExpanded) { // Hide the playlist BEFORE changing window dimensions to avoid strange behaviour this.miniPlayerPlaylist.Hide(); this.WindowState = WindowState.Normal; this.ResizeMode = ResizeMode.CanMinimize; this.ShowWindowControls = false; // Set MinWidth and MinHeight BEFORE SetMiniPlayerDimensions(). This prevents flicker. if (this.HasBorder) { // Correction to take into account the window border, otherwise the content // misses 2px horizontally and vertically when displaying the window border this.MinWidth = playerWidth + 2; this.MinHeight = playerHeight + 2; } else { this.MinWidth = playerWidth; this.MinHeight = playerHeight; } this.SetMiniPlayerDimensions(); // Show the playlist AFTER changing window dimensions to avoid strange behaviour if (isMiniPlayerListExpanded) { this.miniPlayerPlaylist.Show(miniPlayerType); } }
private void SetPlayerContextMenuCheckBoxes(MiniPlayerType miniPlayerType) { this.IsCoverPlayerChecked = false; this.IsMicroPlayerChecked = false; this.IsNanoPlayerChecked = false; switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.IsCoverPlayerChecked = true; break; case MiniPlayerType.MicroPlayer: this.IsMicroPlayerChecked = true; break; case MiniPlayerType.NanoPlayer: this.IsNanoPlayerChecked = true; break; default: break; // Doesn't happen } }
private void SetMiniPlayer(MiniPlayerType miniPlayerType, bool openPlaylist) { this.isMiniPlayerActive = true; // Hide the playlist BEFORE changing window dimensions to avoid strange behaviour this.PlaylistVisibilityChangeRequested(this, new PlaylistVisibilityChangeRequestedEventArgs(false, MiniPlayerType.CoverPlayer)); this.WindowStateChangeRequested(this, new WindowStateChangeRequestedEventArgs(WindowState.Normal)); this.ResizeModeChangeRequested(this, new ResizeModeChangeRequestedEventArgs(ResizeMode.CanMinimize)); double width = 0; double height = 0; switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: width = Constants.CoverPlayerWidth; height = Constants.CoverPlayerHeight; break; case MiniPlayerType.MicroPlayer: width = Constants.MicroPlayerWidth; height = Constants.MicroPlayerHeight; break; case MiniPlayerType.NanoPlayer: width = Constants.NanoPlayerWidth; height = Constants.NanoPlayerHeight; break; default: // Can't happen break; } // Set MinWidth and MinHeight BEFORE SetMiniPlayerDimensions(). This prevents flicker. Size minimumSize = new Size(width, height); if (SettingsClient.Get <bool>("Appearance", "ShowWindowBorder")) { // Correction to take into account the window border, otherwise the content // misses 2px horizontally and vertically when displaying the window border minimumSize = new Size(width + 2, height + 2); } this.MinimumSizeChangeRequested(this, new MinimumSizeChangeRequestedEventArgs(minimumSize)); this.GeometryChangeRequested(this, new GeometryChangeRequestedEventArgs( SettingsClient.Get <int>("MiniPlayer", "Top"), SettingsClient.Get <int>("MiniPlayer", "Left"), minimumSize)); // Show the playlist AFTER changing window dimensions to avoid strange behavior if (openPlaylist) { this.PlaylistVisibilityChangeRequested(this, new PlaylistVisibilityChangeRequestedEventArgs(true, miniPlayerType)); } }
private void SetPlayerType(bool isMiniPlayer, MiniPlayerType miniPlayerType) { // Save the player type in the settings SettingsClient.Set <bool>("General", "IsMiniPlayer", isMiniPlayer); // Only save the Mini Player Type in the settings if the current player is set to the Mini Player if (isMiniPlayer) { SettingsClient.Set <int>("General", "MiniPlayerType", (int)miniPlayerType); } // Set the current player type this.isMiniPlayer = isMiniPlayer; this.selectedMiniPlayerType = miniPlayerType; // Prevents saving window state and size to the Settings XML while switching players this.allowSaveWindowGeometry = false; // Sets the geometry of the player if (isMiniPlayer) { PART_MiniPlayerButton.ToolTip = ResourceUtils.GetStringResource("Language_Restore"); switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.CoverPlayer, Constants.CoverPlayerWidth, Constants.CoverPlayerHeight, this.isCoverPlayerListExpanded); break; case MiniPlayerType.MicroPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.MicroPlayer, Constants.MicroPlayerWidth, Constants.MicroPlayerHeight, this.isMicroPlayerListExpanded); break; case MiniPlayerType.NanoPlayer: this.ClosingText.FontSize = Constants.SmallBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.NanoPlayer, Constants.NanoPlayerWidth, Constants.NanoPlayerHeight, this.isNanoPlayerListExpanded); break; default: break; // Doesn't happen } } else { this.ClosingText.FontSize = Constants.LargeBackgroundFontSize; PART_MiniPlayerButton.ToolTip = ResourceUtils.GetStringResource("Language_Mini_Player"); this.SetFullPlayer(); } this.allowSaveWindowGeometry = true; }
private void SetPlayer(bool isMiniPlayer, MiniPlayerType miniPlayerType) { // Clear the player's content for smoother Window resizing this.ClearPlayerContent(); // Determine if the player position is locked this.SetWindowPositionLocked(isMiniPlayer); // Set the player type this.SetPlayerType(isMiniPlayer, miniPlayerType); // Set the content of the player window this.SetPlayerContent(150); }
public async void SetPlayer(bool isMiniPlayer, MiniPlayerType miniPlayerType, bool isInitializing = false) { string screenName = typeof(Empty).FullName; // Clear player content this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, typeof(Empty).FullName); // Save the player type in the settings SettingsClient.Set <bool>("General", "IsMiniPlayer", isMiniPlayer); // Only save the Mini Player Type in the settings if the current player is set to the Mini Player if (isMiniPlayer) { SettingsClient.Set <int>("General", "MiniPlayerType", (int)miniPlayerType); } // Prevents saving window state and size to the Settings XML while switching players this.canSaveWindowGeometry = false; // Sets the geometry of the player if (isMiniPlayer | (!this.windowsIntegrationService.IsTabletModeEnabled & this.windowsIntegrationService.IsStartedFromExplorer)) { switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.SetMiniPlayer(MiniPlayerType.CoverPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.CoverPlayer); screenName = this.coverPlayerPage; break; case MiniPlayerType.MicroPlayer: this.SetMiniPlayer(MiniPlayerType.MicroPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.MicroPlayer); screenName = this.microplayerPage; break; case MiniPlayerType.NanoPlayer: this.SetMiniPlayer(MiniPlayerType.NanoPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.NanoPlayer); screenName = this.nanoPlayerPage; break; default: break; // Doesn't happen } } else { this.SetFullPlayer(); // Default case screenName = this.fullPlayerPage; // Special cases if (SettingsClient.Get <bool>("FullPlayer", "IsNowPlayingSelected")) { if (isInitializing) { if (SettingsClient.Get <bool>("Startup", "ShowLastSelectedPage")) { screenName = this.nowPlayingPage; } } else { screenName = this.nowPlayingPage; } } } // Determine if the player position is locked this.SetWindowPositionLockedFromSettings(); // Determine if the player is this.SetWindowTopmostFromSettings(); // Delay, otherwise content is never shown (probably because regions don't exist yet at startup) await Task.Delay(150); // Navigate to content this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, screenName); this.canSaveWindowGeometry = true; }
public PlaylistVisibilityChangeRequestedEventArgs(bool isPlaylistVisible, MiniPlayerType miniPlayerType) { this.IsPlaylistVisible = isPlaylistVisible; this.MiniPlayerType = miniPlayerType; }
private void SetMiniPlayer(MiniPlayerType miniPlayerType, bool openPlaylist) { // Hide the playlist BEFORE changing window dimensions to avoid strange behaviour this.miniPlayerPlaylist.Hide(); this.WindowState = WindowState.Normal; this.ResizeMode = ResizeMode.CanMinimize; this.ShowWindowControls = false; double width = 0; double height = 0; switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; width = Constants.CoverPlayerWidth; height = Constants.CoverPlayerHeight; break; case MiniPlayerType.MicroPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; width = Constants.MicroPlayerWidth; height = Constants.MicroPlayerHeight; break; case MiniPlayerType.NanoPlayer: this.ClosingText.FontSize = Constants.SmallBackgroundFontSize; width = Constants.NanoPlayerWidth; height = Constants.NanoPlayerHeight; break; default: // Can't happen break; } // Set MinWidth and MinHeight BEFORE SetMiniPlayerDimensions(). This prevents flicker. if (this.HasBorder) { // Correction to take into account the window border, otherwise the content // misses 2px horizontally and vertically when displaying the window border this.MinWidth = width + 2; this.MinHeight = height + 2; } else { this.MinWidth = width; this.MinHeight = height; } this.SetGeometry( SettingsClient.Get <int>("MiniPlayer", "Top"), SettingsClient.Get <int>("MiniPlayer", "Left"), Convert.ToInt32(this.MinWidth), Convert.ToInt32(this.MinHeight), Constants.DefaultShellTop, Constants.DefaultShellLeft); this.SetWindowTopmostFromSettings(); // Show the playlist AFTER changing window dimensions to avoid strange behaviour if (openPlaylist) { this.miniPlayerPlaylist.Show(miniPlayerType); } }
private async void SetPlayer(bool isMiniPlayer, MiniPlayerType miniPlayerType) { string screenName = typeof(Empty).FullName; // Clear player content this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, typeof(Empty).FullName); // Save the player type in the settings SettingsClient.Set <bool>("General", "IsMiniPlayer", isMiniPlayer); // Only save the Mini Player Type in the settings if the current player is set to the Mini Player if (isMiniPlayer) { SettingsClient.Set <int>("General", "MiniPlayerType", (int)miniPlayerType); } // Prevents saving window state and size to the Settings XML while switching players this.canSaveWindowGeometry = false; // Sets the geometry of the player if (isMiniPlayer | (!this.windowsIntegrationService.IsTabletModeEnabled & this.windowsIntegrationService.IsStartedFromExplorer)) { PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Restore"); switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.SetMiniPlayer(MiniPlayerType.CoverPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.CoverPlayer); screenName = typeof(CoverPlayer).FullName; break; case MiniPlayerType.MicroPlayer: this.SetMiniPlayer(MiniPlayerType.MicroPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.MicroPlayer); screenName = typeof(MicroPlayer).FullName; break; case MiniPlayerType.NanoPlayer: this.SetMiniPlayer(MiniPlayerType.NanoPlayer, this.activeMiniPlayerPlaylist == ActiveMiniPlayerPlaylist.NanoPlayer); screenName = typeof(NanoPlayer).FullName; break; default: break; // Doesn't happen } } else { this.ClosingText.FontSize = Constants.LargeBackgroundFontSize; PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Mini_Player"); this.SetFullPlayer(); screenName = typeof(FullPlayer.FullPlayer).FullName; } // Determine if the player position is locked this.SetWindowPositionLockedFromSettings(); // Delay, otherwise content is never shown (probably because regions don't exist yet at startup) await Task.Delay(150); // Navigate to content this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, screenName); this.canSaveWindowGeometry = true; }
private async void SetPlayer(bool isMiniPlayer, MiniPlayerType miniPlayerType) { Page page = null; // Clear player content //this.ShellFrame.Navigate(this.container.Resolve<Empty>()); // Save the player type in the settings SettingsClient.Set <bool>("General", "IsMiniPlayer", isMiniPlayer); // Only save the Mini Player Type in the settings if the current player is set to the Mini Player if (isMiniPlayer) { SettingsClient.Set <int>("General", "MiniPlayerType", (int)miniPlayerType); } // Prevents saving window state and size to the Settings XML while switching players this.canSaveWindowGeometry = false; // Sets the geometry of the player if (isMiniPlayer | (!this.windowsIntegrationService.IsTabletModeEnabled & this.windowsIntegrationService.IsStartedFromExplorer)) { PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Restore"); switch (miniPlayerType) { case MiniPlayerType.CoverPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.CoverPlayer, Constants.CoverPlayerWidth, Constants.CoverPlayerHeight); page = this.container.Resolve <CoverPlayerPage>(); break; case MiniPlayerType.MicroPlayer: this.ClosingText.FontSize = Constants.MediumBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.MicroPlayer, Constants.MicroPlayerWidth, Constants.MicroPlayerHeight); page = this.container.Resolve <MicroPlayerPage>(); break; case MiniPlayerType.NanoPlayer: this.ClosingText.FontSize = Constants.SmallBackgroundFontSize; this.SetMiniPlayer(MiniPlayerType.NanoPlayer, Constants.NanoPlayerWidth, Constants.NanoPlayerHeight); page = this.container.Resolve <NanoPlayerPage>(); break; default: break; // Doesn't happen } } else { this.ClosingText.FontSize = Constants.LargeBackgroundFontSize; PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Mini_Player"); this.SetFullPlayer(); page = this.container.Resolve <FullPlayerPage>(); } // Determine if the player position is locked this.SetWindowPositionLockedFromSettings(); // Delay, otherwise content is never shown (probably because regions don't exist yet at startup) await Task.Delay(150); // Navigate to content this.ShellFrame.Navigate(page); this.canSaveWindowGeometry = true; }