using System.Threading.Tasks; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Net; using MediaBrowser.UI; using MediaBrowser.UI.Controller; using MediaBrowser.UI.Controls; using MediaBrowser.UI.Playback; using MediaBrowser.UI.Playback.InternalPlayer; using System.ComponentModel.Composition; using System.Windows; using System.Windows.Controls; namespace MediaBrowser.Plugins.DefaultTheme.Resources { /// /// Class AppResources /// [Export(typeof(ResourceDictionary))] public partial class AppResources : ResourceDictionary { /// /// Gets the instance. /// /// The instance. public static AppResources Instance { get; private set; } /// /// Initializes a new instance of the class. /// public AppResources() { InitializeComponent(); Instance = this; UIKernel.Instance.PlaybackManager.PlaybackStarted += PlaybackManager_PlaybackStarted; UIKernel.Instance.PlaybackManager.PlaybackCompleted += PlaybackManager_PlaybackCompleted; } /// /// Handles the Click event of the NowPlayingButton control. /// /// The source of the event. /// The instance containing the event data. void NowPlaying_Click(object sender, RoutedEventArgs e) { App.Instance.NavigateToInternalPlayerPage(); } /// /// Handles the PlaybackCompleted event of the PlaybackManager control. /// /// The source of the event. /// The instance containing the event data. /// void PlaybackManager_PlaybackCompleted(object sender, PlaybackStopEventArgs e) { App.Instance.ApplicationWindow.Dispatcher.Invoke(() => NowPlayingButton.Visibility = Visibility.Collapsed); } /// /// Handles the PlaybackStarted event of the PlaybackManager control. /// /// The source of the event. /// The instance containing the event data. void PlaybackManager_PlaybackStarted(object sender, PlaybackEventArgs e) { if (e.Player is BaseInternalMediaPlayer) { App.Instance.ApplicationWindow.Dispatcher.Invoke(() => NowPlayingButton.Visibility = Visibility.Visible); } } /// /// Weathers the button click. /// /// The sender. /// The instance containing the event data. void WeatherButtonClick(object sender, RoutedEventArgs e) { App.Instance.DisplayWeather(); } /// /// Settingses the button click. /// /// The sender. /// The instance containing the event data. void SettingsButtonClick(object sender, RoutedEventArgs e) { App.Instance.NavigateToSettingsPage(); } /// /// This is a common element that appears on every page. /// /// The view button. public Button ViewButton { get { return TreeHelper.FindChild