Пример #1
0
        /// <summary>
        /// Add the data of a single media.
        /// </summary>
        /// <param name="media"></param>
        private void addToMediaDataList(NBMedia media)
        {
            NBMediaDataItem newItem = new NBMediaDataItem(media);

            if (!mediaDataItems.Contains(newItem))
            {
                mediaDataItems.Add(newItem);
            }
        }
Пример #2
0
        /// <summary>
        /// When the Play button is pressed, this is run to play the media.
        /// </summary>
        /// <param name="sender">Where the call comes from.</param>
        /// <param name="e">The information about the click.</param>
        private void btnPlayMedia_Click(object sender, RoutedEventArgs e)
        {
            Button          clickedButton = (Button)sender;
            NBMediaDataItem mediaData     = (NBMediaDataItem)clickedButton.DataContext;

            PlayMediasArgs   args             = new PlayMediasArgs(this, mediaData.MediaSource);
            PlayMediaCommand playMediaCommand = new PlayMediaCommand();

            if (playMediaCommand.CanExecute(args))
            {
                playMediaCommand.Execute(args);
            }
        }
Пример #3
0
        /// <summary>
        /// When the delete button is clicked, the media deletion process will execute when it passes all checks.
        /// </summary>
        /// <param name="sender">Where the call comes from.</param>
        /// <param name="e">The information about the click.</param>
        private void btnDeleteMedia_Click(object sender, RoutedEventArgs e)
        {
            Button          clickedButton = (Button)sender;
            NBMediaDataItem mediaData     = (NBMediaDataItem)clickedButton.DataContext;

            DeleteMediaArgs    args = new DeleteMediaArgs(mediaData.MediaSource);
            DeleteMediaCommand deleteMediaCommand = new DeleteMediaCommand();

            if (deleteMediaCommand.CanExecute(args))
            {
                deleteMediaCommand.Execute(args);
            }
        }
Пример #4
0
        /// <summary>
        /// When I click on a new item from the medias list, this will be called.
        /// </summary>
        /// <param name="e">Stores information about what happened to the selected item(s).</param>
        private void lstMedia_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            foreach (object prevItem in e.RemovedItems)
            {
                NBMediaDataItem item = prevItem as NBMediaDataItem;

                item.IsSelected = false;
            }

            foreach (object prevItem in e.AddedItems)
            {
                NBMediaDataItem item = prevItem as NBMediaDataItem;

                item.IsSelected = true;
            }
        }