Guest User

Untitled

a guest
Jul 3rd, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. using Acr.UserDialogs;
  2. using SlogGISMobile.Models.Jianstra.Infobekum;
  3. using SlogGISMobile.Services;
  4. using Syncfusion.SfChart.XForms;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Collections.ObjectModel;
  8. using System.ComponentModel;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Input;
  12. using Xamarin.Forms;
  13. using Xamarin.Forms.Internals;
  14.  
  15. namespace SlogGISMobile.ViewModels.Jianstra.infobekum
  16. {
  17. [Preserve(AllMembers = true)]
  18. public class StatistikInfobekumLanjutanViewModel : BaseViewModel {
  19.  
  20. public ObservableCollection<Book> Data { get; set; }
  21.  
  22. private double pertamax;
  23. private double pertamax_rm;
  24. private double pertamax_pnbp;
  25.  
  26. public double Pertamax
  27. {
  28. get { return pertamax; }
  29. set
  30. {
  31. pertamax = value;
  32. this.NotifyPropertyChanged();
  33. }
  34. }
  35. public double Pertamax_rm
  36. {
  37. get { return pertamax_rm; }
  38. set
  39. {
  40. pertamax_rm = value;
  41. this.NotifyPropertyChanged();
  42. }
  43. }
  44. public double Pertamax_pnbp
  45. {
  46. get { return pertamax_pnbp; }
  47. set
  48. {
  49. pertamax_pnbp = value;
  50. this.NotifyPropertyChanged();
  51. }
  52. }
  53.  
  54. private double solar;
  55. private double solar_rm;
  56. private int solar_pnbp;
  57.  
  58. public double Solar
  59. {
  60. get { return solar; }
  61. set
  62. {
  63. solar = value;
  64. this.NotifyPropertyChanged();
  65. }
  66. }
  67. public double Solar_rm
  68. {
  69. get { return solar_rm; }
  70. set
  71. {
  72. solar_rm = value;
  73. this.NotifyPropertyChanged();
  74. }
  75. }
  76. public int Solar_pnbp
  77. {
  78. get { return solar_pnbp; }
  79. set
  80. {
  81. solar_pnbp = value;
  82. this.NotifyPropertyChanged();
  83. }
  84. }
  85.  
  86.  
  87. public StatistikInfobekumLanjutanViewModel()
  88. {
  89.  
  90.  
  91. Data = new ObservableCollection<Book>();
  92. FillData();
  93. FillPertamax();
  94. //FillSolar();
  95. }
  96.  
  97.  
  98. async void FillPertamax()
  99. {
  100. using (UserDialogs.Instance.Loading("loading..."))
  101. {
  102. var content = await ApiServices.ServiceClientInstance.GetPertamax(2020);
  103.  
  104. if (content != null)
  105. {
  106. Pertamax = content.data.pertamax;
  107. Pertamax_rm = content.data.rm;
  108. Pertamax_pnbp = content.data.pnbp;
  109. }
  110. else
  111. {
  112. await Application.Current.MainPage.DisplayAlert("Error", "Data Kosong Atau Kesalahan Dalam Pengambilan Data", "OK");
  113. }
  114. }
  115.  
  116. }
  117.  
  118. async void FillSolar()
  119. {
  120. using (UserDialogs.Instance.Loading("loading..."))
  121. {
  122. var content = await ApiServices.ServiceClientInstance.GetSolar(2020);
  123.  
  124. if (content != null)
  125. {
  126. Solar = content.data.solar;
  127. Solar_rm = content.data.rm;
  128. Solar_pnbp = content.data.pnbp;
  129. }
  130. else
  131. {
  132. await Application.Current.MainPage.DisplayAlert("Error", "Data Kosong Atau Kesalahan Dalam Pengambilan Data", "OK");
  133. }
  134. }
  135.  
  136. }
  137.  
  138. private void FillData()
  139. {
  140.  
  141. Book obj = new Book() { name = "Lemdiklat", qty = 23, target = 15 };
  142. Data.Add(obj);
  143. Book obj2 = new Book() { name = "Labfor", qty = 26, target = 11 };
  144. Data.Add(obj2);
  145. Book obj3 = new Book() { name = "Bareskrim", qty = 20, target = 29 };
  146. Data.Add(obj3);
  147.  
  148. }
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment