Пример #1
0
        // Clears all the data in this View Model
        private void ResetAll()
        {
            // Reset all of the lists
            AvailableClasses.Clear();
            AvailableParents.Clear();
            AvailableStudents.Clear();
            AvailableCourses.Clear();
            AvailableCoursesMustChoose.Clear();
            AvailableHomeroomClasses.Clear();

            // Reset all properties
            Username  = "";
            FirstName = "";
            LastName  = "";
            Email     = "";
            Phone     = "";
            Birthdate = new DateTime();

            IsNewStudent   = false;
            IsNewTeacher   = false;
            IsNewParent    = false;
            IsNewSecretary = false;

            SelectedHomeroomClass = null;
            SelectedParent        = null;
            SelectedStudent       = null;
            SelectedClass         = null;
            SelectedCourse1       = null;
            SelectedCourse2       = null;
            SelectedCourse3       = null;
            SelectedCourse4       = null;
        }
Пример #2
0
        private async void ExecuteOpen(object param)
        {
            ObservableModelPrediction.Clear();
            AvailableClasses.Clear();
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    IsRunning = true;
                    (var OldImages, var NewImages) = await client.PostOld(fbd.SelectedPath, cts);

                    OldImages.ForEach(delegate(PredictionResponse prs) { AddPrecomputedPrediction(new ModelPrediction(prs.ClassName, prs.Proba, prs.FilePath, Convert.FromBase64String(prs.Image))); });
                    var NewImagesResults = await client.GetNew(NewImages, cts);

                    NewImagesResults.ForEach(delegate(PredictionResult pr) { AddPrediction(pr); });
                    IsRunning = false;
                }
                catch (TaskCanceledException tce)
                {
                    MessageBox.Show("Tasks were cancelled");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Prediction failed!");
                }
            }
        }
Пример #3
0
 public void Clear()
 {
     AvailableClasses.Clear();
     ClassesImages.Clear();
     SelectedClassInfo.Clear();
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AvailableCLasses"));
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CLassesImages"));
 }
Пример #4
0
        public void Initialize(Person connectedPerson)
        {
            // Reset all information
            ConnectedPerson = connectedPerson;
            AvailableUserTypes.Clear();
            AvailableUsers.Clear();
            AvailableClasses.Clear();
            AvailableParents.Clear();
            AvailableStudents.Clear();
            AvailableCourses.Clear();
            AvailableCoursesMustChoose.Clear();
            AvailableHomeroomClasses.Clear();

            if (HasRequiredPermissions)
            {
                _schoolData = new SchoolEntities();

                // Create a list of all the editable user types
                if (!CanEditManagement)
                {
                    AvailableUserTypes.AddRange(new List <string>()
                    {
                        Globals.USER_TYPE_STUDENT, Globals.USER_TYPE_TEACHERS, Globals.USER_TYPE_PARENTS
                    });
                }
                else
                {
                    AvailableUserTypes.AddRange(new List <string>()
                    {
                        Globals.USER_TYPE_STUDENT, Globals.USER_TYPE_TEACHERS, Globals.USER_TYPE_PARENTS,
                        Globals.USER_TYPE_SECRETARIES, Globals.USER_TYPE_PRINCIPAL
                    });
                }
                SelectedUserType = AvailableUserTypes[0];

                // Create a list of all the classes in the school
                _schoolData.Classes.ToList().ForEach(currClass => AvailableClasses.Add(currClass.classID, currClass.className));

                AvailableHomeroomClasses.Add(FIELD_NOT_SET, "לא מוגדר");
                _schoolData.Classes.Where(currClass => currClass.Teachers.Count() == 0).ToList()
                .ForEach(currClass => AvailableHomeroomClasses.Add(currClass.classID, currClass.className));

                // Create a list of all the parents in the school
                AvailableParents.Add(FIELD_NOT_SET, "לא מוגדר");
                _schoolData.Persons.Where(p => p.isParent).ToList()
                .ForEach(parent => AvailableParents.Add(parent.personID, parent.firstName + " " + parent.lastName));

                // Create a list of all the students in the school
                _schoolData.Persons.Where(p => p.isStudent).ToList()
                .ForEach(student => AvailableStudents.Add(student.personID, student.firstName + " " + student.lastName));

                // Create a list of all the courses in the school
                _schoolData.Courses.Where(course => course.isHomeroomTeacherOnly == false).ToList()
                .ForEach(course => AvailableCoursesMustChoose.Add(course.courseID, course.courseName));
                AvailableCourses.Add(FIELD_NOT_SET, "לא מוגדר");
                AvailableCoursesMustChoose.ToList().ForEach(course => AvailableCourses.Add(course.Key, course.Value));
            }
        }
Пример #5
0
 private void ExecuteClear(object param)
 {
     ObservableModelPrediction.Clear();
     AvailableClasses.Clear();
     try
     {
         client.Delete();
     }
     catch (Exception e)
     {
         MessageBox.Show("Clearing DataBase failed!");
     }
 }
 /// <summary>
 /// Assistant method that clears all the ViewModel properties
 /// </summary>
 private void ResetData()
 {
     AvailableSearchChoices.Clear();
     LessonsTableData.Clear();
     AvailableClasses.Clear();
     AvailableCourses.Clear();
     AvailableTeachers.Clear();
     AvailableRooms.Clear();
     SelectedLesson       = null;
     SelectedSearchChoice = NOT_ASSIGNED;
     SelectedTeacher      = NOT_ASSIGNED;
     SelectedClass        = NOT_ASSIGNED;
     LessonFirstDay       = NOT_ASSIGNED;
     LessonSecondDay      = NOT_ASSIGNED;
     LessonThirdDay       = NOT_ASSIGNED;
     LessonFourthDay      = NOT_ASSIGNED;
     LessonFirstHour      = NOT_ASSIGNED;
     LessonSecondHour     = NOT_ASSIGNED;
     LessonThirdHour      = NOT_ASSIGNED;
     LessonFourthHour     = NOT_ASSIGNED;
 }
Пример #7
0
        public void Initialize(Person connectedPerson)
        {
            ConnectedPerson = connectedPerson;

            // Get the list of existing rooms
            RoomsTableData = new ObservableCollection <RoomData>(_schoolData.Rooms.AsEnumerable().Select(room => ModelRoomToRoomData(room)).ToList());

            // Create the basic list of available classes
            AvailableClasses.Clear();

            // Add a 'No class' option, as not all rooms are assigned to a specific class
            AvailableClasses.Add(NO_ASSIGNED_CLASS, "אין כיתה משויכת");

            // Create the list of classes that don't have an homeroom already
            _schoolData.Classes.Where(schoolClass => schoolClass.roomID == null).ToList()
            .ForEach(schoolClass => AvailableClasses.Add(schoolClass.classID, schoolClass.className));

            SelectedClass = NO_ASSIGNED_CLASS;

            // For some reason, after re-initializing this view, the SelectedClass is not updated properly in the view unless called again
            OnPropertyChanged("SelectedClass");
        }