Exemplo n.º 1
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);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }