MainWindow.xaml.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Windows;
  2. using WpfApp4.model;
  3. namespace WpfApp4
  4. {
  5. /// <summary>
  6. /// Interaction logic for MainWindow.xaml
  7. /// </summary>
  8. public partial class MainWindow : Window
  9. {
  10. public IEnumerable<mechanic> PersonList { get; set; }
  11. public MainWindow()
  12. {
  13. InitializeComponent();
  14. DataContext = this;
  15. Globals.dataProvider = new LocalDataProvider();
  16. PersonList = Globals.dataProvider.getPerson();
  17. }
  18. private void ExitButton_Click(object sender, RoutedEventArgs e)
  19. {
  20. Application.Current.Shutdown();
  21. }
  22. }
  23. interface IDataProvider
  24. {
  25. IEnumerable<mechanic> getPerson();
  26. }
  27. public class LocalDataProvider : IDataProvider
  28. {
  29. private object name;
  30. public IEnumerable<mechanic> getPerson()
  31. {
  32. return new mechanic[] {
  33. new mechanic {
  34. doljnost="Мойщик",
  35. name="Чувакер"},
  36. new mechanic{
  37. doljnost="Отладчик",
  38. name="Мистер Мистерио"},
  39. new mechanic{
  40. doljnost="Директор",
  41. name="Мистер крутой"},
  42. };
  43. }
  44. }
  45. public class doljnost
  46. {
  47. }
  48. }