private void OnNewPlaylistInserted(object sender, Event.PlaylistChangedEventArgs e)
 {
     this.NewPlaylistViewModel.PlaylistInserted -= OnNewPlaylistInserted;
     this.NewPlaylistViewModel.IsOpen = false;
     this.NewPlaylistViewModel = null;
     //Refreshing all the playlist views
     Messenger.Default.Send<PlaylistChangeMessage>(new PlaylistChangeMessage());
     Playlist playlist = e.Playlist;
     if (playlist != null)
     {
         this.AddTracksToPlaylist(playlist);
     }
 }
 private NewPlaylistUserControlViewModel CreateNewPlaylistModel(InsertMode insertMode)
 {
     var newPlaylistViewModel = new NewPlaylistUserControlViewModel(this.DataService, this.AccountService, this.ResourceService)
     {
         IsOpen = true,
         InsertMode = insertMode
     };
     newPlaylistViewModel.PlaylistInserted += this.OnNewPlaylistInserted;
     return newPlaylistViewModel;
 }
 protected virtual void OpenNewPlaylistDialog()
 {
     this.NewPlaylistViewModel = new NewPlaylistUserControlViewModel(this.DataService, this.AccountService, this.ResourceService);
     this.NewPlaylistViewModel.IsOpen = true;
     this.NewPlaylistViewModel.PlaylistInserted += OnNewPlaylistInserted;
 }
 private void CompleteToPlaylist(MenuItemViewModel menuItem)
 {
     //Necessary because NewCompleteToPlaylistViewModel is an own viewmodel.
     MenuNewPlaylistViewModel menuNewPlaylistViewModel = menuItem as MenuNewPlaylistViewModel;
     if (menuNewPlaylistViewModel != null)
     {
         this.NewCompleteToPlaylistViewModel = this.CreateNewPlaylistModel(InsertMode.All);
     }
     this.ChoosePlaylist(menuItem, InsertMode.All);
 }