예제 #1
0
        /// <summary>
        /// Shows the details.
        /// </summary>
        /// <param name="e">The <see cref="Uncas.PodCastPlayer.Wpf.PodCastSelectedEventArgs"/> instance containing the event data.</param>
        private void ShowDetails(PodCastSelectedEventArgs e)
        {
            var details =
                new PodCastDetails(
                    e.PodCastId);

            contentControl.Content = details;
            details.PodCastSaved  +=
                this.Details_PodCastSaved;
        }
예제 #2
0
 /// <summary>
 /// Handles the EpisodesSelected event of the PodCastIndex control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Uncas.PodCastPlayer.Wpf.PodCastSelectedEventArgs"/> instance containing the event data.</param>
 private void PodCastIndex_EpisodesSelected(
     object sender,
     PodCastSelectedEventArgs e)
 {
     if (e.PodCastId.HasValue)
     {
         var index =
             new EpisodeIndex(
                 e.PodCastId.Value);
         contentControl.Content = index;
     }
 }
예제 #3
0
        /// <summary>
        /// Fires the event.
        /// </summary>
        /// <param name="selectedPodCast">The selected pod cast.</param>
        /// <param name="eventHandler">The event handler.</param>
        private void FireEvent(
            PodCastIndexViewModel selectedPodCast,
            EventHandler <PodCastSelectedEventArgs> eventHandler)
        {
            if (eventHandler == null)
            {
                return;
            }

            var podCastId =
                selectedPodCast != null ?
                selectedPodCast.Id :
                null;
            var podCastSelectedArgs =
                new PodCastSelectedEventArgs(
                    podCastId);

            eventHandler(
                this,
                podCastSelectedArgs);
        }
예제 #4
0
 /// <summary>
 /// Handles the PodCastCreated event of the PodCastNew control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Uncas.PodCastPlayer.Wpf.PodCastSelectedEventArgs"/> instance containing the event data.</param>
 private void PodCastNew_PodCastCreated(
     object sender,
     PodCastSelectedEventArgs e)
 {
     this.ShowDetails(e);
 }
예제 #5
0
        /// <summary>
        /// Handles the Click event of the CreateButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void CreateButton_Click(
            object sender,
            RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(urlTextBox.Text))
            {
                DisplayErrorMessage("No url provided");
                return;
            }

            Uri podCastUrl;

            try
            {
                podCastUrl = new Uri(urlTextBox.Text);
            }
            catch (UriFormatException)
            {
                DisplayErrorMessage("Invalid url");
                return;
            }

            PodCastNewViewModel result;

            try
            {
                result =
                    this.service.CreatePodCast(
                        podCastUrl);
            }
            catch (UtilityException ex)
            {
                // TODO: EXCEPTION: Resolve ambiguity: This can mean either 1) the uri is not a valid feed/pod cast, 2) the utility had problems retrieving the pod cast info.
                App.HandleException(
                    "Invalid pod cast or problems retrieving pod cast info.",
                    ex);
                return;
            }
            catch (RepositoryException ex)
            {
                App.HandleException(
                    "Unable to save new pod cast info.",
                    ex);
                return;
            }

            if (result.PodCastId.HasValue)
            {
                if (this.PodCastCreated != null)
                {
                    var eventArgs =
                        new PodCastSelectedEventArgs(
                            result.PodCastId);
                    this.PodCastCreated(
                        this,
                        eventArgs);
                }
            }
            else
            {
                DisplayErrorMessage("Pod cast not created properly.");
            }
        }