Ejemplo n.º 1
0
        public HelloWorldViewModel()
        {
            firstName = Factory.Backing(nameof(FirstName), "Anton", NotNullOrWhitespace.Then(NotEqual("Foo")));

            lastName = Factory.Backing(
                nameof(LastName),
                "Tcholakov",
                NotNullOrWhitespace.Then(NotEqual("Bar")).Then(x => x.Length < 10, "Length cannot exceed 10 characters"));

            sayHello = Factory.CommandAsyncChecked(
                Greet,
                () => this.IsValid && !this.OperationExecuting,
                cts.Token,
                exn => MessageBox.Show("Sorry I was too slow :-(."),
                nameof(IsValid),
                nameof(OperationExecuting));

            cancelCommand = Factory.CommandSyncChecked(
                () => this.cts?.Cancel(),
                () => this.OperationExecuting,
                nameof(OperationExecuting));

            DependencyTracker.AddPropertyDependencies(nameof(ReadyToGreet), nameof(OperationExecuting));
            DependencyTracker.AddPropertyDependencies(nameof(FullName), nameof(FirstName), nameof(LastName));
            DependencyTracker.AddPropertyDependencies(nameof(Greeting), nameof(FullName));
        }
Ejemplo n.º 2
0
        public MainVM()
        {
            ClassClassrooms  = XMLRead.ReadClassroom(Path.ClassroomXml).ToArray();
            ClassGroups      = XMLRead.ReadGroup(Path.GroupXml).ToArray();
            ClassTeachers    = XMLRead.ReadTeacher(Path.TeacherXml).ToArray();
            ClassSubjects    = XMLRead.ReadSubject(Path.SubjectXml).ToArray();
            ClassDepartments = XMLRead.ReadDepartment(Path.DepartmentXml).ToArray();

            Data = new ObservableCollection <ObservableCollection <DropItem> >();
            for (int i = 0; i < maxpair; i++)
            {
                Data.Add(new ObservableCollection <DropItem>());
            }


            openCommand     = this.Factory.CommandSync(Open);
            saveToExcel     = this.Factory.CommandSync(ExportToExcel);
            selectCommand   = this.Factory.CommandSyncParam <int>(Transform);
            closeWinCommand = this.Factory.CommandSync(Close);
            clearCommand    = this.Factory.CommandSync(Clear);

            index           = this.Factory.Backing <RowColumnIndex?>(nameof(Index), null);
            departmentIndex = this.Factory.Backing <int>(nameof(DepartmentIndex), 0);

            Columns = new ObservableCollection <string>();
            Rows    = new ObservableCollection <PairInfo>();
            Init();
        }
Ejemplo n.º 3
0
        public FacultyVM()
        {
            nameOfFaculty = this.Factory.Backing(nameof(NameOfFaculty), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(35)));
            codeOfFaculty = this.Factory.Backing(nameof(CodeOfFaculty), 0);

            saveFaculty = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 4
0
        public FacultyVM()
        {
            nameOfFaculty = this.Factory.Backing(nameof(NameOfFaculty), "");
            codeOfFaculty = this.Factory.Backing(nameof(CodeOfFaculty), 0);

            saveFaculty = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 5
0
        public ReadFromClassesVM(string[] namesOfSchedule)
        {
            NamesOfSchedule = namesOfSchedule;

            nameOfSchedule = this.Factory.Backing <string>(nameof(NameOfSchedule), null);

            readSchedule = this.Factory.CommandSyncParam <Window>(ReadAndClose);
        }
Ejemplo n.º 6
0
        public SubjectVM(Department[] departments)
        {
            Departments = departments;

            codeOfSubject = this.Factory.Backing(nameof(CodeOfSubject), 0);
            nameOfSubject = this.Factory.Backing(nameof(NameOfSubject), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(100)));
            department    = this.Factory.Backing(nameof(Department), null, ContainedWithin(Departments));

            saveSubject = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 7
0
        public WindowDepartmentVM(ObservableCollection <Department> classDepartment, ObservableCollection <Faculty> facultities)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassDepartment  = classDepartment;
            this.facultities = facultities;
            index            = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 8
0
        public WindowTeacherVM(ObservableCollection <Teacher> classTeacher, ObservableCollection <Department> departments)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassTeacher     = classTeacher;
            this.departments = departments;
            index            = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 9
0
        public GroupVM(Department[] departments)
        {
            Departments = departments;

            nameOfGroup = this.Factory.Backing(nameof(NameOfGroup), "");
            codeOfGroup = this.Factory.Backing(nameof(CodeOfGroup), 0);
            department  = this.Factory.Backing <Department>(nameof(Department), null);

            saveGroup = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 10
0
        public GroupsAndSubjectsVM(Subject[] subjects)
        {
            Subjects       = subjects;
            subject        = this.Factory.Backing(nameof(Subject), null, ContainedWithin(Subjects));
            lectureHour    = this.Factory.Backing(nameof(LectureHour), 0, Custom <int>(NumberIsPositive, ""));
            exerciseHour   = this.Factory.Backing(nameof(ExerciseHour), 0, Custom <int>(NumberIsPositive, ""));
            laboratoryHour = this.Factory.Backing(nameof(LaboratoryHour), 0, Custom <int>(NumberIsPositive, ""));

            saveGroupsAndSubjects = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 11
0
        public WindowFacultyVM(ObservableCollection <Faculty> classFaculty)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);
            loadCommand   = this.Factory.CommandSync(Load);
            ClassFaculty  = classFaculty;

            index = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 12
0
        public DepartmentVM(Faculty[] facultities)
        {
            Facultities = facultities;

            codeOfDepartment = this.Factory.Backing(nameof(CodeOfDepartment), 0);
            nameOfDepartment = this.Factory.Backing(nameof(NameOfDepartment), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(50)));
            faculty          = this.Factory.Backing(nameof(Faculty), null, ContainedWithin(Facultities));

            saveDepartment = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 13
0
        public WindowSubjectVM(ObservableCollection <Subject> classSubject, ObservableCollection <Department> departments)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassSubject     = classSubject;
            this.departments = departments;
            index            = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 14
0
        public DepartmentVM(Faculty[] facultities)
        {
            Facultities = facultities;

            codeOfDepartment = this.Factory.Backing(nameof(CodeOfDepartment), 0);
            nameOfDepartment = this.Factory.Backing(nameof(NameOfDepartment), "");
            faculty          = this.Factory.Backing <Faculty>(nameof(Faculty), null);

            saveDepartment = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 15
0
        public ConnectVM(ConnectionInfo ci)
        {
            dataBase = this.Factory.Backing(nameof(DataBase), ci.DB);
            loggin   = this.Factory.Backing(nameof(Loggin), ci.Login);
            password = this.Factory.Backing(nameof(Password), ci.Password);

            connect             = this.Factory.CommandSync(Connection);
            this.connectionInfo = ci;
            getDataBaseFile     = this.Factory.CommandSync(SetDataBaseFile);
            saveDataBaseFile    = this.Factory.CommandSync(CreateDataBase);
        }
Ejemplo n.º 16
0
        public ClassroomVM(Department[] departments)
        {
            Departments = departments;
            Specifics   = new string[] { "лекц.", "упр.", "лаб." };

            numberOfClassroom = this.Factory.Backing(nameof(NumberOfClassroom), "", Custom <string>(NumberOfClassroomValidate, ""));
            codeOfClassroom   = this.Factory.Backing(nameof(CodeOfClassroom), 0);
            specific          = this.Factory.Backing(nameof(Specific), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(20)));
            department        = this.Factory.Backing(nameof(Department), null, ContainedWithin(Departments));
            saveClassroom     = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 17
0
        public ClassroomVM(Department[] departments)
        {
            Departments = departments;

            numberOfClassroom = this.Factory.Backing(nameof(NumberOfClassroom), "");
            capacity          = this.Factory.Backing(nameof(Capacity), 0);
            codeOfClassroom   = this.Factory.Backing(nameof(CodeOfClassroom), 0);
            specifics         = this.Factory.Backing(nameof(Specifics), "");
            department        = this.Factory.Backing <Department>(nameof(Department), null);
            saveClassroom     = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 18
0
        public WindowClassroomVM(ObservableCollection <ClassRoom> classClassroom, ObservableCollection <Department> departments)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassClassroom   = classClassroom;
            this.departments = departments;

            index = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 19
0
        public TeacherVM(Department[] departments)
        {
            Departments = departments;

            codeOfTeacher = this.Factory.Backing(nameof(CodeOfTeacher), 0);
            fio           = this.Factory.Backing(nameof(FIO), "");
            post          = this.Factory.Backing(nameof(Post), "");
            department    = this.Factory.Backing <Department>(nameof(Department), null);
            hourOfLoad    = this.Factory.Backing(nameof(HourOfLoad), 0);

            saveTeacher = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 20
0
        public DropItem(object key, Type typekey, PairInfo info)
        {
            Key     = key;
            KeyType = typekey;
            Info    = info;

            state    = this.Factory.Backing(nameof(State), 0);
            n_dIndex = this.Factory.Backing(nameof(N_DIndex), 0);
            item     = this.Factory.Backing(nameof(Item), new DropInformation());
            itemTwo  = this.Factory.Backing(nameof(ItemTwo), new DropInformation());
            isValid  = this.Factory.Backing(nameof(IsValueValid), false);
        }
Ejemplo n.º 21
0
        public CourseVM(Teacher[] teachers, Group[] groups, Subject[] subjects)
        {
            Teachers = teachers;
            Groups   = groups;
            Subjects = subjects;

            teacher = this.Factory.Backing <Teacher>(nameof(Teacher), null);
            group   = this.Factory.Backing <Group>(nameof(Group), null);
            subject = this.Factory.Backing <Subject>(nameof(Subject), null);

            saveCourse = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 22
0
        public SaveScheduleVM(string[] existSchedule)
        {
            ExistSchedule = existSchedule;

            var defaultName = "default" + ExistSchedule.Length;
            var validator   = Custom <string>(p => !ExistSchedule.Contains(p), "Shouldn't be as existing value");

            rewriteExistSchedule = this.Factory.Backing <string>(nameof(RewriteExistScheduleName), null);
            saveWithNewName      = this.Factory.Backing <string>(nameof(SaveWithNewName), defaultName, validator);

            saveSchedule = this.Factory.CommandSyncParam <bool>(SaveAndClose);
        }
Ejemplo n.º 23
0
        public WindowGroupVM(ObservableCollection <Group> classGroup,
                             ObservableCollection <Department> departments)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassGroups      = classGroup;
            this.departments = departments;

            index = this.Factory.Backing(nameof(Index), -1);
        }
        public WindowTeachersAndSubjectsVM(ObservableCollection <Teacher> classTeachers, ObservableCollection <TeachersAndSubjects> teachersAndSubjects, List <Subject> allSubjectsList, List <DayOfWeek> allDayList)
        {
            ClassTeachers          = classTeachers;
            AllSubjectList         = allSubjectsList;
            AllDayList             = allDayList;
            AllTeachersAndSubjects = teachersAndSubjects;
            addCommand             = this.Factory.CommandSync(Add);
            removeCommand          = this.Factory.CommandSync(Remove);
            editCommand            = this.Factory.CommandSync(Edit);

            teacherIndex = this.Factory.Backing(nameof(TeacherIndex), -1);
        }
Ejemplo n.º 25
0
        public ConnectVM(ConnectionInfo ci)
        {
            Terms    = new int[] { 1, 2 };
            dataBase = this.Factory.Backing(nameof(DataBase), ci.DB);
            loggin   = this.Factory.Backing(nameof(Loggin), ci.Login);
            password = this.Factory.Backing(nameof(Password), ci.Password);
            term     = this.Factory.Backing(nameof(Term), 1);

            connect             = this.Factory.CommandSync(Connection);
            this.connectionInfo = ci;
            getDataBaseFile     = this.Factory.CommandSync(SetDataBaseFile);
        }
Ejemplo n.º 26
0
        public GroupVM(Department[] departments)
        {
            Departments = departments;

            Terms = new int[] { 1, 2 };

            nameOfGroup = this.Factory.Backing(nameof(NameOfGroup), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(50)));
            codeOfGroup = this.Factory.Backing(nameof(CodeOfGroup), 0);
            term        = this.Factory.Backing(nameof(Term), 0, ContainedWithin(Terms));
            department  = this.Factory.Backing(nameof(Department), null, ContainedWithin(Departments));

            saveGroup = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 27
0
        public WindowGroupsAndSubjectsVM(ObservableCollection <Group> classGroups, ObservableCollection <GroupsAndSubjects> groupsAndSubjects, ObservableCollection <Subject> classSubjects)
        {
            ClassGroups       = classGroups;
            GroupsAndSubjects = groupsAndSubjects;
            ClassSubjects     = classSubjects;

            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            groupIndex   = this.Factory.Backing(nameof(GroupIndex), -1);
            subjectIndex = this.Factory.Backing(nameof(SubjectIndex), -1);
        }
Ejemplo n.º 28
0
        public WindowCourseVM(ObservableCollection <Course> classCourse, ObservableCollection <Teacher> teachers,
                              ObservableCollection <Group> groups, ObservableCollection <Subject> subjects)
        {
            addCommand    = this.Factory.CommandSync(Add);
            removeCommand = this.Factory.CommandSync(Remove);
            editCommand   = this.Factory.CommandSync(Edit);

            ClassCourse = classCourse;

            this.teachers = teachers;
            this.groups   = groups;
            this.subjects = subjects;
            index         = this.Factory.Backing(nameof(Index), -1);
        }
Ejemplo n.º 29
0
        public SubjectVM(Department[] departments)
        {
            Departments = departments;

            codeOfSubject   = this.Factory.Backing(nameof(CodeOfSubject), 0);
            nameOfSubject   = this.Factory.Backing(nameof(NameOfSubject), "");
            specifics       = this.Factory.Backing(nameof(Specifics), "");
            commonHours     = this.Factory.Backing(nameof(CommonHours), 0);
            lectureHours    = this.Factory.Backing(nameof(LectureHours), 0);
            laboratoryHours = this.Factory.Backing(nameof(LaboratoryHours), 0);
            exerciseHours   = this.Factory.Backing(nameof(ExerciseHours), 0);
            department      = this.Factory.Backing <Department>(nameof(Department), null);

            saveSubject = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }
Ejemplo n.º 30
0
        public TeacherVM(Department[] departments)
        {
            Departments    = departments;
            DepartmentsTwo = departments;

            codeOfTeacher = this.Factory.Backing(nameof(CodeOfTeacher), 0);
            fio           = this.Factory.Backing(nameof(FIO), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(50)));
            post          = this.Factory.Backing(nameof(Post), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(25)));
            postTwo       = this.Factory.Backing(nameof(PostTwo), "");
            mail          = this.Factory.Backing(nameof(Mail), "", NotNullOrWhitespace.Then(HasLengthNotLongerThan(50)));
            isReadLecture = this.Factory.Backing(nameof(IsReadLecture), false);

            department    = this.Factory.Backing(nameof(Department), null, ContainedWithin(Departments));
            departmentTwo = this.Factory.Backing <Department>(nameof(DepartmentTwo), null);

            saveTeacher = this.Factory.CommandSyncParam <Window>(SaveAndClose);
        }