Song.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MusicPlayer
  7. {
  8. public class Song
  9. {
  10. public string SongID { get; set; }
  11. public string Name { get; set; }
  12. public string Album { get; set; }
  13. public string Artist { get; set; }
  14. public string Url { get { return GetURL(); } set { SetURL(value); } }
  15. private APIHandler api;
  16. private string url;
  17. public Song(string songid, string name, string album, string artist, APIHandler api)
  18. {
  19. SongID = songid;
  20. Name = name;
  21. Album = album;
  22. Artist = artist;
  23. this.api = api;
  24. url = "";
  25. }
  26. private string GetURL()
  27. {
  28. if (url == "")
  29. {
  30. url = api.GetSongURLByID(SongID);
  31. }
  32. return url;
  33. }
  34. private void SetURL(string str)
  35. {
  36. url = str;
  37. }
  38. }
  39. }