/Application/GUI/Controls/TrayNotification.xaml.cs

http://yet-another-music-application.googlecode.com/ · C# · 113 lines · 58 code · 15 blank · 40 comment · 0 complexity · 12b1f7b8ee8f7f93a1fa055959563e9a MD5 · raw file

  1. /**
  2. * TrayNotification.xaml.cs
  3. *
  4. * The notification that is shown in the tray area.
  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.IO;
  22. using System.Text;
  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. namespace Stoffi
  33. {
  34. /// <summary>
  35. /// Interaction logic for TrayNotification.xaml
  36. /// </summary>
  37. public partial class TrayNotification : UserControl
  38. {
  39. #region Members
  40. private StoffiWindow ParentWindow;
  41. #endregion
  42. #region Constructors
  43. /// <summary>
  44. ///
  45. /// </summary>
  46. /// <param name="numberOfUpgrades"></param>
  47. /// <param name="parent"></param>
  48. public TrayNotification(StoffiWindow parent)
  49. {
  50. U.L(LogLevel.Debug, "TRAY NOTIFICATION", "Initialize");
  51. InitializeComponent();
  52. U.L(LogLevel.Debug, "TRAY NOTIFICATION", "Initialized");
  53. TrackInformation.Visibility = System.Windows.Visibility.Collapsed;
  54. NewUpgrades.Visibility = System.Windows.Visibility.Visible;
  55. UpgradeTitle.Text = "New Upgrade Available";
  56. UpgradeDescription.Text = "Found new upgrade";
  57. ParentWindow = parent;
  58. }
  59. /// <summary>
  60. ///
  61. /// </summary>
  62. /// <param name="track"></param>
  63. /// <param name="parent"></param>
  64. public TrayNotification(TrackData track, StoffiWindow parent)
  65. {
  66. ParentWindow = parent;
  67. InitializeComponent();
  68. TrackArtist.Text = track.Artist;
  69. TrackTitle.Text = track.Title;
  70. AlbumArt.Source = FilesystemManager.GetImageTag(track);
  71. }
  72. #endregion
  73. #region Methods
  74. #region Event handlers
  75. /// <summary>
  76. ///
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. private void Close_Click(object sender, RoutedEventArgs e)
  81. {
  82. ParentWindow.trayIcon.CloseBalloon();
  83. }
  84. /// <summary>
  85. ///
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. private void Upgrade_Click(object sender, RoutedEventArgs e)
  90. {
  91. ParentWindow.trayIcon.CloseBalloon();
  92. UpgradeManager.ForceDownload = true;
  93. UpgradeManager.Probe(null, null);
  94. }
  95. #endregion
  96. #endregion
  97. }
  98. }