protected void SetPlayerUIContributor(Type playerUIContributorType, MediaWorkflowStateType stateType, IPlayer player, bool doUpdateScreen) { IPlayerUIContributor oldPlayerUIContributor; lock (_syncObj) oldPlayerUIContributor = PlayerUIContributor; try { if (oldPlayerUIContributor != null && playerUIContributorType == oldPlayerUIContributor.GetType()) { // Player UI contributor is already correct, but maybe must be initialized if (oldPlayerUIContributor.MediaWorkflowStateType != stateType || _oldPlayer != player) { oldPlayerUIContributor.Initialize(stateType, player); } _backgroundDisabled = oldPlayerUIContributor.BackgroundDisabled; _screenName = oldPlayerUIContributor.Screen; _oldPlayer = player; return; } IPlayerUIContributor playerUIContributor = InstantiatePlayerUIContributor(playerUIContributorType); if (playerUIContributor != null) { playerUIContributor.Initialize(stateType, player); _backgroundDisabled = playerUIContributor.BackgroundDisabled; _screenName = playerUIContributor.Screen; } else { _backgroundDisabled = false; _screenName = null; } lock (_syncObj) PlayerUIContributor = playerUIContributor; if (oldPlayerUIContributor != null) { oldPlayerUIContributor.Dispose(); } } finally { if (doUpdateScreen) { UpdateScreen(); } } }
protected void SetPlayerUIContributor(Type playerUIContributorType, MediaWorkflowStateType stateType, IPlayer player, bool doUpdateScreen) { IPlayerUIContributor oldPlayerUIContributor; lock (_syncObj) oldPlayerUIContributor = PlayerUIContributor; try { if (oldPlayerUIContributor != null && playerUIContributorType == oldPlayerUIContributor.GetType()) { // Player UI contributor is already correct, but maybe must be initialized if (oldPlayerUIContributor.MediaWorkflowStateType != stateType || _oldPlayer != player) oldPlayerUIContributor.Initialize(stateType, player); _backgroundDisabled = oldPlayerUIContributor.BackgroundDisabled; _screenName = oldPlayerUIContributor.Screen; _oldPlayer = player; return; } IPlayerUIContributor playerUIContributor = InstantiatePlayerUIContributor(playerUIContributorType); if (playerUIContributor != null) { playerUIContributor.Initialize(stateType, player); _backgroundDisabled = playerUIContributor.BackgroundDisabled; _screenName = playerUIContributor.Screen; } else { _backgroundDisabled = false; _screenName = null; } lock (_syncObj) PlayerUIContributor = playerUIContributor; if (oldPlayerUIContributor != null) oldPlayerUIContributor.Dispose(); } finally { if (doUpdateScreen) UpdateScreen(); } }