private void OnMenuItemClicked(object sender, RoutedEventArgs args) { var menuItem = (MenuItem)sender; MediaItemsListModelItem mediaItem = (MediaItemsListModelItem)menuItem.CommandParameter; var tag = menuItem.Tag.ToString(); switch (tag) { case DeleteTag: DeleteLibraryItemCommand.GetCommand().Execute(mediaItem); break; case AddToQueueTag: AddItemToQueueCommand.GetCommand().Execute(mediaItem); break; case DownloadNowTag: DownloadNowCommand.GetCommand().Execute(mediaItem); break; case ShowLinksTag: ShowLinksCommand.GetCommand().Execute(mediaItem); break; case ShowDescriptionTag: ShowDescriptionCommand.GetCommand().Execute(mediaItem); break; default: break; } }
private void OnContextMenuActivated(object sender, RoutedEventArgs args) { var menuItem = (MenuItem)sender; var tag = menuItem.Tag.ToString(); switch (tag) { case "DeleteTag": DeleteLibraryItemCommand.GetCommand().Execute((sender as MenuItem).CommandParameter as LibraryModelItem); break; default: break; } }