public Mark_Attendance_Form()
        {
            InitializeComponent();
            loadcourses  = new Linked_List <Course>();
            student_list = new Linked_List <Student>();

            string serializationFile = "course_file.bin";

            using (Stream stream = File.Open(serializationFile, FileMode.Open))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                loadcourses = (Linked_List <Course>)bformatter.Deserialize(stream);
            }
            for (ListNode <Course> temp = loadcourses.getHead(); temp != null; temp = temp.next)
            {
                courseBox.Items.Add(temp.val.get_String());
            }

            courseBox.Text = "Subject";
            idLabel.Text   = "";


            string studentfile = "student_file.bin";

            using (Stream stream = File.Open(studentfile, FileMode.Open))
            {
                var bformatter = new BinaryFormatter();

                student_list = (Linked_List <Student>)bformatter.Deserialize(stream);
            }

            face = new HaarCascade("haarcascade_frontalface_default.xml");
            //eye = new HaarCascade("haarcascade_eye.xml");
            try
            {
                //Load of previus trainned faces and labels for each image
                string   Labelsinfo = File.ReadAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt");
                string[] Labels     = Labelsinfo.Split('%');
                NumLabels = Convert.ToInt16(Labels[0]);
                ContTrain = NumLabels;
                string LoadFaces;

                for (int tf = 1; tf < NumLabels + 1; tf++)
                {
                    LoadFaces = "face" + tf + ".bmp";
                    trainingImages.Add(new Image <Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                    labels.Add(Labels[tf]);
                }
            }
            catch
            {
                MessageBox.Show("Nothing in binary database, please add at least a face(Simply train the prototype with the Add Face Button).", "Triained faces load", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #2
0
        public Course_form()
        {
            InitializeComponent();
            courses     = new Linked_List <Course>();
            loadcourses = new Linked_List <Course>();

            string serializationFile = "course_file.bin";

            using (Stream stream = File.Open(serializationFile, FileMode.Open))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                courses = (Linked_List <Course>)bformatter.Deserialize(stream);
            }
            //deserialize
            //string serializationFile = "course_file.bin";
            //using (Stream stream = File.Open(serializationFile, FileMode.Open))
            //{
            //    var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            //    loadcourses = (List<Course>)bformatter.Deserialize(stream);
            //}
        }
        public Form1()
        {
            InitializeComponent();
            delCourseBox.Hide();
            button1.Hide();
            button2.Hide();
            delStudentBox.Hide();
            string studentfile = "student_file.bin";

            using (Stream stream = File.Open(studentfile, FileMode.Open))
            {
                var bformatter = new BinaryFormatter();

                student_list = (Linked_List <Student>)bformatter.Deserialize(stream);
            }
            string serializationFile = "course_file.bin";

            using (Stream stream = File.Open(serializationFile, FileMode.Open))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                courses = (Linked_List <Course>)bformatter.Deserialize(stream);
            }
        }
예제 #4
0
 public Student(string name, string rollno)
 {
     this.name      = name;
     this.rollno    = rollno;
     studentcourses = new Linked_List <Course>();
 }
        public student_form()
        {
            InitializeComponent();
            loadcourses  = new Linked_List <Course>();
            student_list = new Linked_List <Student>();

            string serializationFile = "course_file.bin";

            using (Stream stream = File.Open(serializationFile, FileMode.Open))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                loadcourses = (Linked_List <Course>)bformatter.Deserialize(stream);
            }
            for (ListNode <Course> item_c = loadcourses.getHead(); item_c != null; item_c = item_c.next)
            {
                courseListBox.Items.Add(item_c.val.get_String());
            }

            string studentfile = "student_file.bin";

            using (Stream stream = File.Open(studentfile, FileMode.Open))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                student_list = (Linked_List <Student>)bformatter.Deserialize(stream);
            }
            //foreach(var item in student_list)
            //{
            //    for(int j=0;j<courseListBox.Items.Count;j++)
            //    {
            //        courseListBox.SetItemChecked(j, false);
            //    }
            //    nameBox.Text = item.get_name();
            //    rollnoBox.Text = item.get_rollno();
            //    foreach(var i in item.studentcourses)
            //    {
            //        for(int ind=0;ind<courseListBox.Items.Count;ind++)
            //        {
            //            if(courseListBox.Items[ind].ToString().Equals(i.get_String()))
            //            {
            //                courseListBox.SetItemChecked(ind, true);
            //            }
            //        }
            //    }
            //    MessageBox.Show("done");
            //}


            face = new HaarCascade("haarcascade_frontalface_default.xml");
            //eye = new HaarCascade("haarcascade_eye.xml");
            try
            {
                //Load of previus trainned faces and labels for each image
                string   Labelsinfo = File.ReadAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt");
                string[] Labels     = Labelsinfo.Split('%');
                NumLabels = Convert.ToInt16(Labels[0]);
                ContTrain = NumLabels;
                string LoadFaces;

                for (int tf = 1; tf < NumLabels + 1; tf++)
                {
                    LoadFaces = "face" + tf + ".bmp";
                    trainingImages.Add(new Image <Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                    labels.Add(Labels[tf]);
                }
            }
            catch
            {
                MessageBox.Show("Nothing in binary database, please add at least a face(Simply train the prototype with the Add Face Button).", "Triained faces load", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }