using System.Windows.Data; using System.Windows.Input; using Podder.Model; using Podder.Properties; namespace Podder.UI { /// <summary> /// Allows the user to add and remove podcasts. /// </summary> public partial class PodcastsDialog : ConfigurableWindow { #region Data ConfigurableWindowSettings _configurableWindowSettings; #endregion // Data #region Constructor public PodcastsDialog(PodcastCollection podcasts, Podcast selectedPodcast) { InitializeComponent(); // Create a PodcastsControl and give it a new collection view // so that changes made in this dialog do not reflect in the main UI. ListCollectionView podcastsView = new ListCollectionView(podcasts); podcastsView.Filter = podcast => podcast is FavoriteEpisodes == false; if (podcastsView.PassesFilter(selectedPodcast)) podcastsView.MoveCurrentTo(selectedPodcast); // Set the DataContext to our special collection view // so that it takes effect in the dialog. base.DataContext = podcastsView; PodcastsControl podcastsControl = new PodcastsControl(podcastsView); base.Content = podcastsControl; Commands.AutoDetectFeedUrlOnClipboard.Execute(null, podcastsControl); } #endregion // Constructor #region Base Class Overrides #region CreateSettings protected override IConfigurableWindowSettings CreateSettings() { if (_configurableWindowSettings == null) { _configurableWindowSettings = new ConfigurableWindowSettings( Settings.Default, "PodcastsDialogIsFirstRun", "PodcastsDialogLocation", "PodcastsDialogSize", "PodcastsDialogState"); } return _configurableWindowSettings; } #endregion // CreateSettings #region OnClosed protected override void OnClosed(System.EventArgs e) { base.OnClosed(e); if (_configurableWindowSettings.IsFirstRun) _configurableWindowSettings.IsFirstRun = false; } #endregion // OnClosed #endregion // Base Class Overrides #region Command Sinks #region Close void Close_Executed(object sender, ExecutedRoutedEventArgs e) { this.Close(); } #endregion // Close #endregion // Command Sinks } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)