/Application/GUI/Controls/NowPlaying.xaml.cs

http://yet-another-music-application.googlecode.com/ · 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. using System;
  19. using System.Collections.Generic;
  20. using System.Linq;
  21. using System.Text;
  22. using System.Threading;
  23. using System.Windows;
  24. using System.Windows.Controls;
  25. using System.Windows.Data;
  26. using System.Windows.Documents;
  27. using System.Windows.Input;
  28. using System.Windows.Media;
  29. using System.Windows.Media.Imaging;
  30. using System.Windows.Navigation;
  31. using System.Windows.Shapes;
  32. using System.Windows.Threading;
  33. namespace Stoffi
  34. {
  35. /// <summary>
  36. /// Interaction logic for NowPlaying.xaml
  37. /// </summary>
  38. public partial class NowPlaying : UserControl
  39. {
  40. #region Constructor
  41. /// <summary>
  42. ///
  43. /// </summary>
  44. public NowPlaying()
  45. {
  46. U.L(LogLevel.Debug, "NOW PLAYING", "Initialize");
  47. InitializeComponent();
  48. MediaManager.NavigateBrowser += new NavigateBrowserDelegate(MediaManager_NavigateBrowser);
  49. if (SettingsManager.CurrentTrack != null)
  50. {
  51. InfoPaneArtist.Text = SettingsManager.CurrentTrack.Artist;
  52. InfoPaneTitle.Text = SettingsManager.CurrentTrack.Title;
  53. }
  54. U.L(LogLevel.Debug, "NOW PLAYING", "Initialized");
  55. }
  56. #endregion
  57. #region Methods
  58. #region Event handlers
  59. /// <summary>
  60. /// Invoked when the user clicks on the YouTube video
  61. /// </summary>
  62. /// <param name="sender">The sender of the event</param>
  63. /// <param name="e">The event data</param>
  64. private void Browser_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  65. {
  66. Console.WriteLine("Left");
  67. }
  68. /// <summary>
  69. /// Invoked when the browser needs to navigate.
  70. /// </summary>
  71. /// <param name="source">The URI to navigate to</param>
  72. private void MediaManager_NavigateBrowser(Uri source)
  73. {
  74. Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
  75. {
  76. Browser.Source = source;
  77. }));
  78. }
  79. #endregion
  80. #endregion
  81. }
  82. }