/Application/GUI/Controls/NowPlaying.xaml.cs
C# | 93 lines | 50 code | 11 blank | 32 comment | 2 complexity | 6aced851b3f3e28f53f5c6bde926aec6 MD5 | raw file
1/** 2 * NowPlaying.xaml.cs 3 * 4 * The "Now Playing" screen. 5 * 6 * * * * * * * * * 7 * 8 * This code is part of the Stoffi Music Player Project. 9 * Visit our website at: stoffiplayer.com 10 * 11 * This program is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; either version 14 * 3 of the License, or (at your option) any later version. 15 * 16 * See stoffiplayer.com/license for more information. 17 **/ 18 19using System; 20using System.Collections.Generic; 21using System.Linq; 22using System.Text; 23using System.Threading; 24using System.Windows; 25using System.Windows.Controls; 26using System.Windows.Data; 27using System.Windows.Documents; 28using System.Windows.Input; 29using System.Windows.Media; 30using System.Windows.Media.Imaging; 31using System.Windows.Navigation; 32using System.Windows.Shapes; 33using System.Windows.Threading; 34 35namespace Stoffi 36{ 37 /// <summary> 38 /// Interaction logic for NowPlaying.xaml 39 /// </summary> 40 public partial class NowPlaying : UserControl 41 { 42 #region Constructor 43 44 /// <summary> 45 /// 46 /// </summary> 47 public NowPlaying() 48 { 49 U.L(LogLevel.Debug, "NOW PLAYING", "Initialize"); 50 InitializeComponent(); 51 52 MediaManager.NavigateBrowser += new NavigateBrowserDelegate(MediaManager_NavigateBrowser); 53 if (SettingsManager.CurrentTrack != null) 54 { 55 InfoPaneArtist.Text = SettingsManager.CurrentTrack.Artist; 56 InfoPaneTitle.Text = SettingsManager.CurrentTrack.Title; 57 } 58 U.L(LogLevel.Debug, "NOW PLAYING", "Initialized"); 59 } 60 61 #endregion 62 63 #region Methods 64 65 #region Event handlers 66 67 /// <summary> 68 /// Invoked when the user clicks on the YouTube video 69 /// </summary> 70 /// <param name="sender">The sender of the event</param> 71 /// <param name="e">The event data</param> 72 private void Browser_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 73 { 74 Console.WriteLine("Left"); 75 } 76 77 /// <summary> 78 /// Invoked when the browser needs to navigate. 79 /// </summary> 80 /// <param name="source">The URI to navigate to</param> 81 private void MediaManager_NavigateBrowser(Uri source) 82 { 83 Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() 84 { 85 Browser.Source = source; 86 })); 87 } 88 89 #endregion 90 91 #endregion 92 } 93}