StatisticsVM.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Linq;
  2. using YJMPD_UWP.Helpers;
  3. using YJMPD_UWP.Model.Object;
  4. namespace YJMPD_UWP.ViewModels
  5. {
  6. public class StatisticsVM : TemplateVM
  7. {
  8. Statistics st;
  9. public StatisticsVM() : base("Statistics")
  10. {
  11. st = Settings.Statistics;
  12. }
  13. public string Information
  14. {
  15. get
  16. {
  17. return "This page holds all the statistics for " + Settings.Username;
  18. }
  19. }
  20. public string Distance
  21. {
  22. get
  23. {
  24. return st.Distance + "km";
  25. }
  26. }
  27. public string LeaderCount
  28. {
  29. get
  30. {
  31. return st.Selected + "";
  32. }
  33. }
  34. public string MatchesCount
  35. {
  36. get
  37. {
  38. return st.Matches + "";
  39. }
  40. }
  41. public string PointsTotal
  42. {
  43. get
  44. {
  45. return st.Points.Sum() + "";
  46. }
  47. }
  48. public string PointsAverage
  49. {
  50. get
  51. {
  52. if (st.Points.Count < 1)
  53. return "0";
  54. else
  55. return (st.Points.Sum() / st.Matches) + "";
  56. }
  57. }
  58. public string PointsMax
  59. {
  60. get
  61. {
  62. if (st.Points.Count < 1)
  63. return "0";
  64. else
  65. return st.Points.Max() + "";
  66. }
  67. }
  68. public string PointsMin
  69. {
  70. get
  71. {
  72. if (st.Points.Count < 1)
  73. return "0";
  74. else
  75. return st.Points.Min() + "";
  76. }
  77. }
  78. }
  79. }