public void StartPartyMode() { ServiceRegistration.Get <ILogger>().Info("PartyMusicPlayerModel: Starting party mode"); SaveSettings(); if (!LoadPlaylist()) { return; } LoadPlayRepeatMode(); IPlayerContextManager pcm = ServiceRegistration.Get <IPlayerContextManager>(); IPlayerContext audioPlayerContext = pcm.OpenAudioPlayerContext(Consts.MODULE_ID_PARTY_MUSIC_PLAYER, Consts.RES_PLAYER_CONTEXT_NAME, false, Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER, Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER); IPlaylist playlist = audioPlayerContext.Playlist; playlist.StartBatchUpdate(); try { playlist.Clear(); foreach (MediaItem mediaItem in _mediaItems) { playlist.Add(mediaItem); } playlist.PlayMode = PlayMode; playlist.RepeatMode = RepeatMode; _playerContext = audioPlayerContext; } finally { playlist.EndBatchUpdate(); } audioPlayerContext.Play(); IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePushAsync(Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER); }