Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Students.Core;
- using Students.Core.Enums;
- using Students.Core.Types;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace StudentsWPF.ViewModels
- {
- class MainWindowModel : INotifyPropertyChanged
- {
- private string _filePath;
- private Student _currentStudent;
- private StudentsClass _studentsCollection;
- private ObservableCollection<Student> _studentsObservableCollection;
- private ObservableCollection<string> _studentGenderObservableCollection;
- public MainWindowModel()
- {
- Model m = new Model();
- StudentsClass sc = m.Load(@"D:\pers\Downloads\Telegram Desktop\Students.xml");
- StudentsObservableCollection = new ObservableCollection<Student>(sc.StudentsList);
- List<string> gender = new List<string>()
- {
- Gender.MALE.ToString(),
- Gender.FEMALE.ToString()
- };
- StudentGenderObservableCollection = new ObservableCollection<string>(gender);
- }
- public string FilePath {
- get
- {
- return _filePath;
- }
- set
- {
- _filePath = value;
- OnPropertyChanged("FilePath");
- }
- }
- public Student CurrentStudent {
- get
- {
- return _currentStudent;
- }
- set
- {
- _currentStudent= value;
- OnPropertyChanged("CurrentStudent");
- }
- }
- public StudentsClass StudentsCollection {
- get
- {
- return _studentsCollection;
- }
- set
- {
- _studentsCollection = value;
- OnPropertyChanged("StudentsCollection");
- }
- }
- public ObservableCollection<Student> StudentsObservableCollection {
- get
- {
- return _studentsObservableCollection;
- }
- set
- {
- _studentsObservableCollection = value;
- OnPropertyChanged("StudentsObservableCollection");
- }
- }
- public ObservableCollection<string> StudentGenderObservableCollection {
- get
- {
- return _studentGenderObservableCollection;
- }
- set
- {
- _studentGenderObservableCollection = value;
- OnPropertyChanged("StudentGenderObservableCollection");
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- public void OnPropertyChanged([CallerMemberName]string prop = "")
- {
- if (PropertyChanged != null)
- PropertyChanged(this, new PropertyChangedEventArgs(prop));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement