Пример #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Grab the animations
            showStudentsColumn = FindResource("ShowStudents") as Storyboard;
            hideStudentsColumn = FindResource("HideStudents") as Storyboard;
            showSubjectsColumn = FindResource("ShowSubjects") as Storyboard;
            hideSubjectsColumn = FindResource("HideSubjects") as Storyboard;

            //Setup the student list and sort it
            LoadStudents();
            LoadSubjects();

            //Setup the connection to the Arduino
            arduino              = new ArduinoSerialComms(9600);
            arduino.TagReceived += TagReceived;

            //Setup the timer
            arduinoTimer           = new Timer(1000);
            arduinoTimer.Elapsed  += CheckArduinoStatus;
            arduinoTimer.AutoReset = true;
            arduinoTimer.Start();

            //UNDONE: Debug code
            //ShowAdminWindow();
        }
Пример #2
0
        private static readonly Regex _regex = new Regex("[^0-9.-]+"); //regex that matches disallowed text


        public AddStudent(AttendanceDatabase database, ArduinoSerialComms arduino, bool editStudent = false, Student student = null)
        {
            InitializeComponent();
            this.database             = database;
            this.arduino              = arduino;
            this.arduino.TagReceived += TagReceived;
            editMode = editStudent;

            //If we are editing, the setup the window
            if (editMode)
            {
                this.student          = student;
                Title                 = "Edit student";
                txbTitle.Text         = "Edit student";
                txtFirstname.Text     = student.firstname;
                txtLastname.Text      = student.lastname;
                txtOasisID.Text       = student.oasisid.ToString();
                txtFinishYear.Text    = student.finishyear.ToString();
                currentUid            = student.uid;
                btnSaveNext.IsEnabled = false;

                //If we have a uid, then update the textblock
                if (currentUid != 0)
                {
                    txbUID.Text       = $"Tag will be set to {BitConverter.ToString(BitConverter.GetBytes(currentUid))}";
                    txbUID.Foreground = Brushes.PaleGreen;
                }
            }
        }
        public PopupWindow(string message,
                           Brush backgroundColour,
                           float timeout,
                           ArduinoSerialComms arduino = null)
        {
            InitializeComponent();
            this.message          = message;
            this.backgroundColour = backgroundColour;
            this.timeout          = timeout;

            //If we have an arduino to talk to then, setup the event
            if (arduino != null)
            {
                this.arduino         = arduino;
                arduino.TagReceived += TagReceived;
            }
        }