Skip to content

Commit

Permalink
Move that into the subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
flagbug committed Jun 18, 2014
1 parent 0b2a087 commit 8255995
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Espera/Espera.View/Views/ShellView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,14 @@ private void WireDragAndDrop()
// Local songs and YouTube songs
this.PlaylistListBox.ItemContainerStyle.RegisterEventSetter<DragEventArgs>(DropEvent, x => new DragEventHandler(x))
.Where(x => x.Item2.Data.GetDataPresent(DataFormats.StringFormat) && (string)x.Item2.Data.GetData(DataFormats.StringFormat) == songSourceFormat)
.Select(x =>
.Subscribe(x =>
{
var target = (PlaylistEntryViewModel)((ListBoxItem)(x.Item1)).DataContext;
return target.Index;
})
.Subscribe(targetIndex =>
{
var addCommand = this.shellViewModel.CurrentSongSource.AddToPlaylistCommand;
if (addCommand.CanExecute(null))
{
addCommand.Execute(targetIndex);
addCommand.Execute(target.Index);
}
});

Expand Down

0 comments on commit 8255995

Please sign in to comment.