TourImage.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Avalonia.Media;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace UPtur.Models
  8. {
  9. public partial class Tour
  10. {
  11. public Avalonia.Media.Imaging.Bitmap GetPic
  12. {
  13. get
  14. {
  15. Avalonia.Media.Imaging.Bitmap pic = null;
  16. try
  17. {
  18. pic = new Avalonia.Media.Imaging.Bitmap($"Assets/Pictures/{Name}.jpg");
  19. return pic;
  20. }
  21. catch
  22. {
  23. pic = new Avalonia.Media.Imaging.Bitmap("Assets/Pictures/pic.png");
  24. return pic;
  25. }
  26. }
  27. }
  28. public string Actual
  29. {
  30. get
  31. {
  32. if (IsActual[0] == true)
  33. {
  34. return "Актуален";
  35. }
  36. else
  37. {
  38. return "Не актуален";
  39. }
  40. }
  41. }
  42. public SolidColorBrush Color
  43. {
  44. get
  45. {
  46. if (IsActual[0] == true)
  47. {
  48. return new SolidColorBrush(Avalonia.Media.Color.FromRgb(10, 206, 76));
  49. }
  50. else
  51. {
  52. return new SolidColorBrush(Avalonia.Media.Color.FromRgb(249, 0, 0));
  53. }
  54. }
  55. }
  56. }
  57. }