Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.33 KB | None | 0 0
  1. using Students.Core;
  2. using Students.Core.Enums;
  3. using Students.Core.Types;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.ComponentModel;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11.  
  12. namespace StudentsWPF.ViewModels
  13. {
  14.     class MainWindowModel : INotifyPropertyChanged
  15.     {
  16. private string _filePath;
  17. private Student _currentStudent;
  18. private StudentsClass _studentsCollection;
  19. private ObservableCollection<Student> _studentsObservableCollection;
  20. private ObservableCollection<string> _studentGenderObservableCollection;
  21.  
  22.        
  23.  
  24.         public MainWindowModel()
  25.         {
  26.            
  27.             Model m = new Model();
  28.             StudentsClass sc = m.Load(@"D:\pers\Downloads\Telegram Desktop\Students.xml");
  29.             StudentsObservableCollection = new ObservableCollection<Student>(sc.StudentsList);
  30.  
  31.             List<string> gender = new List<string>()
  32.             {
  33.                 Gender.MALE.ToString(),
  34.                 Gender.FEMALE.ToString()
  35.             };
  36.             StudentGenderObservableCollection = new ObservableCollection<string>(gender);
  37.         }
  38.  
  39. public string FilePath {
  40. get
  41. {
  42. return _filePath;
  43. }
  44. set
  45. {
  46. _filePath = value;
  47. OnPropertyChanged("FilePath");
  48. }
  49. }
  50.  
  51. public Student CurrentStudent  {
  52. get
  53. {
  54. return _currentStudent;
  55. }
  56. set
  57. {
  58. _currentStudent= value;
  59. OnPropertyChanged("CurrentStudent");
  60. }
  61. }
  62.  
  63. public StudentsClass StudentsCollection  {
  64. get
  65. {
  66. return _studentsCollection;
  67. }
  68. set
  69. {
  70. _studentsCollection = value;
  71. OnPropertyChanged("StudentsCollection");
  72. }
  73. }
  74.  
  75. public ObservableCollection<Student> StudentsObservableCollection  {
  76. get
  77. {
  78. return _studentsObservableCollection;
  79. }
  80. set
  81. {
  82. _studentsObservableCollection = value;
  83. OnPropertyChanged("StudentsObservableCollection");
  84. }
  85. }
  86.  
  87. public ObservableCollection<string> StudentGenderObservableCollection  {
  88. get
  89. {
  90. return _studentGenderObservableCollection;
  91. }
  92. set
  93. {
  94. _studentGenderObservableCollection = value;
  95. OnPropertyChanged("StudentGenderObservableCollection");
  96. }
  97. }
  98.  
  99.        public event PropertyChangedEventHandler PropertyChanged;
  100.     public void OnPropertyChanged([CallerMemberName]string prop = "")
  101.     {
  102.         if (PropertyChanged != null)
  103.             PropertyChanged(this, new PropertyChangedEventArgs(prop));
  104.     }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement