示例#1
0
        //Sub-routine for filtering student list
        private void FilterStudents()
        {
            //if user added the z at the beginning strip it
            var input = searchStudent_TextBox.Text;

            if (input[0] == 'z')
            {
                input = input.Substring(1);
            }

            //if any characters after the leading z is stripped are not a digit then throw an error and return
            if (!input.All(x => char.IsDigit(x)))
            {
                Output_TextBox.Text = "Error: Please enter a valid Z-ID";
                Output_TextBox.AppendText(Environment.NewLine);
                return;
            }

            //Now we actually filter the list
            List <Student>        studentList      = Program.m_students.ToList();
            List <Student>        filteredStudents = studentList.FindAll(x => x.ZId.ToString().StartsWith(input));
            BindingList <Student> bindedStudents   = new BindingList <Student>(filteredStudents);

            if (bindedStudents.Any())
            {
                Student_ListBox.DataSource = bindedStudents;
                Output_TextBox.Clear();
            }
            else
            {
                Student_ListBox.DataSource = Program.m_students;
                Output_TextBox.Text        = "No students match your search criteria.";
                Output_TextBox.AppendText(Environment.NewLine);
            }
        }
示例#2
0
 public override void Core_Update()
 {
     Output_TextBox.Text = "";
     foreach (var access in Accessed)
     {
         if (access.Item1)
         {
             Output_TextBox.Text += "\r\nData successfully written at offset " + access.Item2 +
                                    "\r\nThe written data was : \r\n" + Util.BytesToSpacedHex(access.Item3) + "\r\n";
         }
         else
         {
             Output_TextBox.Text += "\r\noffset : " + access.Item2 +
                                    "\r\ndata: (length: " + access.Item3.Length + " bytes)\r\n" +
                                    Util.BytesToSpacedHex(access.Item3) + "\r\n";
         }
     }
     Output_TextBox.SelectionStart = Output_TextBox.Text.Length;
     Output_TextBox.ScrollToCaret();
 }