private void OnBuildAlbumRelatedCommandBar(AlbumRelatedCommandBarPayload payload)
        {
            payload.CommandBar.AddCommand(
                new CommandModel
            {
                Content          = "Browse",
                Command          = new DelegateCommand <Tuple <string, string> >(ExecuteBrowseForAlbum),
                CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                Icon             = AppIcons.Search.ToImage()
            });

            payload.CommandBar.AddCommand(
                new CommandModel
            {
                Content          = "Play",
                Command          = new DelegateCommand <Tuple <string, string> >(ExecutePlayArtistAlbum),
                CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                Icon             = AppIcons.Play.ToImage()
            });

            payload.CommandBar.AddCommand(
                new CommandModel
            {
                Content          = "Queue",
                Command          = new DelegateCommand <Tuple <string, string> >(ExecuteQueueArtistAlbum),
                CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                Icon             = AppIcons.Add.ToImage()
            });
        }
Example #2
0
        private void AssociatedObjectOnMouseRightButtonUp(object sender, MouseButtonEventArgs mouseButtonEventArgs)
        {
            var element = sender as FrameworkElement;

            if (element != null)
            {
                var eventAggregator = ServiceLocator.Current.TryResolve <IEventAggregator>();
                var commandBar      = new CommandBar();
                var payload         = new AlbumRelatedCommandBarPayload(ArtistName, AlbumName, commandBar);
                element.ContextMenu = new CommandBarContextMenu
                {
                    DataContext = commandBar
                };
                eventAggregator.GetEvent <BuildAlbumRelatedCommandBarEvent>().Publish(payload);
            }
        }
        private void OnBuildAlbumRelatedCommandBar(AlbumRelatedCommandBarPayload payload)
        {
            payload.CommandBar.AddCommand(
                new CommandModel
                {
                    Content = "Browse",
                    Command = new DelegateCommand<Tuple<string, string>>(ExecuteBrowseForAlbum),
                    CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                    Icon = AppIcons.Search.ToImage()
                });

            payload.CommandBar.AddCommand(
                new CommandModel
                {
                    Content = "Play",
                    Command = new DelegateCommand<Tuple<string, string>>(ExecutePlayArtistAlbum),
                    CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                    Icon = AppIcons.Play.ToImage()
                });

            payload.CommandBar.AddCommand(
                new CommandModel
                {
                    Content = "Queue",
                    Command = new DelegateCommand<Tuple<string, string>>(ExecuteQueueArtistAlbum),
                    CommandParameter = Tuple.Create(payload.ArtistName, payload.AlbumName),
                    Icon = AppIcons.Add.ToImage()
                });
        }