MainWindow.xaml.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System.Diagnostics;
  2. using System.Text;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Data;
  6. using System.Windows.Documents;
  7. using System.Windows.Input;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. using System.Windows.Navigation;
  11. using System.Windows.Shapes;
  12. using wpf_template.models;
  13. namespace wpf_template
  14. {
  15. public partial class MainWindow : Window
  16. {
  17. public IEnumerable<people> peopleList { get; set; }
  18. public MainWindow()
  19. {
  20. InitializeComponent();
  21. DataContext = this;
  22. Globals.dataProvider = new LocalDataProvider();
  23. peopleList = Globals.dataProvider.getpeople();
  24. }
  25. private void ExitButton_Click(object sender, RoutedEventArgs e)
  26. {
  27. Application.Current.Shutdown();
  28. }
  29. }
  30. interface IDataProvider
  31. {
  32. IEnumerable<people> getpeople();
  33. }
  34. public class LocalDataProvider : IDataProvider
  35. {
  36. public IEnumerable<people> getpeople()
  37. {
  38. return new people[]{
  39. new people
  40. {
  41. price=500,
  42. name="Марина",
  43. age=19
  44. },
  45. new people
  46. {
  47. price=9600,
  48. name="Вика",
  49. age=21
  50. },
  51. new people
  52. {
  53. price=50,
  54. name="Кристина",
  55. age=17
  56. },
  57. };
  58. }
  59. }
  60. }
  61. /* public class LocalDataProvider : IDataProvider
  62. {
  63. public IEnumerable<places> getplaces()
  64. {
  65. return new places[]
  66. {
  67. new places
  68. {
  69. place = "Йолка",
  70. price = 500,
  71. },
  72. new places
  73. {
  74. place = "КБ",
  75. price = 600,
  76. },
  77. new places
  78. {
  79. place = "Шарага",
  80. price = 505
  81. }
  82. };
  83. }
  84. }
  85. }
  86. */