// Next Trial button action private void NextTrialButton_Click(object sender, EventArgs e) { // Clear notification area content InfoTextBox.Clear(); // There is an upcoming set if (++IdxSet < TestSetPathList.Length) { // Reset image index IdxImg = Const_NrPicPerSet; // Reset Image Display Time array Array.Clear(TestData.ImgDispTime, 0, Const_NrPicPerSet); // Enable Next Picture and Got It buttons btn_NextPicture.Enabled = true; btn_GotIt.Enabled = true; // Disable Next Trial button btn_NextTrial.Enabled = false; // Disable Category and Name input fields txt_Description.Enabled = false; txt_Category.Enabled = false; // Display current picture DisplayImage(IdxSet, IdxImg); // Enable timer TestTime.Start(); } // Last set was reached else { // Disable Test Control box box_TestControls.Enabled = false; // Enable Finish button btn_Finish.Enabled = true; } }
private void ShowTrackInfo() { InfoTextBox.Clear(); string directoryName = Path.GetDirectoryName(_currentTrackPath); string fileName = Path.GetFileName(_currentTrackPath); GetFolderIno(directoryName, fileName); }
// Start button action private void StartButton_Click(object sender, EventArgs e) { // Clear notification area content InfoTextBox.Clear(); // Enable test controls box_TestControls.Enabled = true; // Disable Start button btn_Start.Enabled = false; // Initialize indexes to first picture from first set IdxImg = 20; IdxSet = 0; // Display current picture DisplayImage(IdxSet, IdxImg); }
private void ListListBox_Click(object sender, EventArgs e) { string selected = (string)ListListBox.SelectedItem; int leftParenthesis = selected.IndexOf('('); int rightParenthesis = selected.IndexOf(')'); selected = selected.Substring(leftParenthesis + 1, rightParenthesis - leftParenthesis - 1); Process process = Process.GetProcessById(int.Parse(selected)); InfoGroupBox.Text = process.ProcessName + "进程的详细信息"; InfoTextBox.Clear(); InfoTextBox.Text += "进程映像名:" + process.ProcessName + "\r\n"; InfoTextBox.Text += "进程ID:" + process.Id + "\r\n"; InfoTextBox.Text += "启动线程数:" + process.Threads.Count + "\r\n"; try { InfoTextBox.Text += "CPU占用时间:" + process.TotalProcessorTime + "\r\n"; } catch (Exception) { InfoTextBox.Text += "CPU占用时间:权限不足\r\n"; } try { InfoTextBox.Text += "线程优先级:" + process.PriorityClass + "\r\n"; } catch (Exception) { InfoTextBox.Text += "线程优先级:权限不足\r\n"; } try { InfoTextBox.Text += "启动时间:" + process.StartTime + "\r\n"; } catch (Exception) { InfoTextBox.Text += "启动时间:权限不足\r\n"; } InfoTextBox.Text += "专用内存:" + process.PrivateMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "峰值虚拟内存:" + process.PeakVirtualMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "峰值分页内存:" + process.PeakPagedMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "分页系统内存:" + process.PagedSystemMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "分页内存:" + process.PagedMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "未分页系统内存:" + process.NonpagedSystemMemorySize64 / 1024 + "KB\r\n"; InfoTextBox.Text += "物理内存:" + process.WorkingSet64 / 1024 + "KB\r\n"; InfoTextBox.Text += "虚拟内存:" + process.VirtualMemorySize64 / 1024 + "KB\r\n"; }
// Submit button action private void SubmitButton_Click(object sender, EventArgs e) { string UserIdData; // Clear notification area content InfoTextBox.Clear(); // If all information is complete if (CheckInputFields()) { // Populate information about the test subject TestSubject.Name = txt_Name.Text; TestSubject.Surname = txt_Surname.Text; TestSubject.Gender = cmb_Gender.Text; TestSubject.Age = num_Age.Value.ToString(); TestSubject.Spec = txt_Speciality.Text; TestSubject.Uni = txt_University.Text; TestSubject.Year = cmb_Year.Text; TestSubject.Deg = cmb_Degree.Text; // Calculate unique user ID UserIdData = TestSubject.Name + TestSubject.Surname + DateTime.Now.ToString(); TestSubject.Id = Math.Abs(UserIdData.GetHashCode()).ToString(); // Populate test data TestData.TestSet = cmb_TestSet.Text; TestData.DateTime = DateTime.Now.ToString(); // Get all directories of the test sets TestSetPathList = Directory.GetDirectories(@"Pictures\" + TestData.TestSet + "\\"); // Enable test controls btn_Start.Enabled = true; // Disable Submit button btn_Submit.Enabled = false; // Disable Personal Information, Studies and Test Set group box PersonalInfo.Enabled = false; Studies.Enabled = false; TestSet.Enabled = false; // Create user file PrepareOutputFile(); // Clear notification area InfoTextBox.Clear(); // Display notification InfoTextBox.AppendText(Environment.NewLine + "Please press the Start button to enter the Demo trial."); InfoTextBox.AppendText(Environment.NewLine); } }
private void UpdateInfo() { InfoTextBox.Clear(); var sb = new StringBuilder(); sb.Append(@"{\rtf1\ansi {\colortbl;\red0\green0\blue0;\red255\green0\blue0;\red255\green255\blue0;}"); sb.Append(_lgResponse.Matches.Count == 1 ? @"1 posible problema encontrado...\line\line " : $@"{_lgResponse.Matches.Count} posibles problemas encontrados...\line\line "); foreach (var match in _lgResponse.Matches) { sb.Append($@"\b {match.Message}\b0\line "); sb.Append(@"\i "); var context = match.Context; var temp = context.Text.Insert(context.Offset + context.Length, "\\highlight0 "); temp = temp.Insert(context.Offset, "\\highlight3 "); sb.Append(temp); sb.Append(@"\i0\line "); var suggestions = match.Replacements; if (suggestions.Count > 0) { sb.Append("Sugerencias: "); foreach (var suggestion in suggestions) { sb.Append(suggestion.Value); sb.Append("; "); } } else { sb.Append("No hay sugerencias."); } sb.Append(@"\line\line "); } sb.Append("}"); InfoTextBox.Rtf = sb.ToString(); }
// Submit Solution button action private void SubmitSolutionButton_Click(object sender, EventArgs e) { // If solution fields were filled in if (txt_Category.Text != "" && txt_Description.Text != "") { // Don't do for DEMO set if (IdxSet != 0) { // Get trial time in 100ms TestData.TrialTime = Time.GetTrialTime_100ms(); // Save image index TestData.TrialStep = IdxImg; // Save trial Name and Category TestData.TrialType = txt_Category.Text; TestData.TrialName = txt_Description.Text; // Write trial results to file WriteTrialResultToFile(); } // Clear input fields txt_Category.Clear(); txt_Description.Clear(); // Disable Category and Name input fields txt_Category.Enabled = false; txt_Description.Enabled = false; // Disable Submit button btn_Complete.Enabled = false; // Enable Next Trial button btn_NextTrial.Enabled = true; // Clear notification area InfoTextBox.Clear(); } else { // Clear notification area InfoTextBox.Clear(); // Display notification InfoTextBox.AppendText(Environment.NewLine + "Please fill in both Name and Category fields before you press Submit!"); } }