Пример #1
0
        /// <summary>
        /// The receiver event from the arduino
        /// </summary>
        /// <param name="uid">The UID received</param>
        void TagReceived(uint uid)
        {
            Student student = database.FindStudentByUID(uid);

            //Run on the main thread since this is an async and its causing me a bloody headache with random catches...
            Dispatcher.BeginInvoke(new Action(() =>
            {
                Login(student);
            }));
        }
Пример #2
0
        void TagReceived(uint uid)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                Student student = database.FindStudentByUID(uid);

                //Depending on the result, we either store the info or clear it
                if (student != null)
                {
                    txbUID.Text       = $"Tag is already associated with {student.ToString()}";
                    currentUid        = 0;
                    txbUID.Foreground = Brushes.OrangeRed;
                }
                else
                {
                    currentUid        = uid;
                    txbUID.Text       = $"Tag will be set to {BitConverter.ToString(BitConverter.GetBytes(currentUid))}";
                    txbUID.Foreground = Brushes.PaleGreen;
                }
            }));
        }