// 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; } }
} // treeView1_AfterSelect private void fileView_MouseClick(object sender, MouseEventArgs e) { if (fileView.SelectedItems.Count == 0) { return; } currentFile = currentPath + "\\" + fileView.SelectedItems[0].Text; string ext = Path.GetExtension(currentFile).ToLower(); if (Directory.Exists(currentFile) || new FileInfo(currentFile).Length == 0) { return; } if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp") || (ext == ".gif")) { InfoPictureBox.Image = new Bitmap(currentFile); InfoPictureBox.Show(); InfoTextBox.Hide(); } else if (ext == ".txt") { InfoTextBox.Text = File.ReadAllLines(currentFile).First(); InfoTextBox.Show(); InfoPictureBox.Hide(); } else { InfoPictureBox.Hide(); InfoTextBox.Hide(); } } // fileView_MouseClick
// Verifies that all input fields were filled in private bool CheckInputFields() { bool PersonalInfoComplete = true; bool StudiesInfoComplete = true; bool TestSetChoosen = true; // Check personal information are filled in if (txt_Name.Text == "" || txt_Surname.Text == "" || cmb_Gender.Text == "" || num_Age.Value == 0) { PersonalInfoComplete = false; // Display notification InfoTextBox.AppendText(Environment.NewLine + "Please fill in all Personal information fields."); InfoTextBox.AppendText(Environment.NewLine); } // Check if information about studies are filled in if (txt_Speciality.Text == "" || cmb_Year.Text == "") { StudiesInfoComplete = false; // Display notification InfoTextBox.AppendText(Environment.NewLine + "Please fill in information about your studies:"); InfoTextBox.AppendText(Environment.NewLine + " - University and Degree are optional"); InfoTextBox.AppendText(Environment.NewLine); } // Check if test set was chosen if (cmb_TestSet.Text == "") { TestSetChoosen = false; // Display notification InfoTextBox.AppendText(Environment.NewLine + "Please chose a test set indicated by the instructor."); InfoTextBox.AppendText(Environment.NewLine); } return(PersonalInfoComplete && StudiesInfoComplete && TestSetChoosen); }
bool IsCut = false; // if cutting file public MainForm() { InitializeComponent(); InfoTextBox.Hide(); fileView.AllowDrop = true; fileView.View = View.Details; fileView.SmallImageList = new ImageList(); fileView.LargeImageList = new ImageList(); fileView.Columns.Add("Name", 150, HorizontalAlignment.Left); fileView.Columns.Add("Creation Date", 100, HorizontalAlignment.Center); fileView.Columns.Add("Size", 120, HorizontalAlignment.Center); imglist.Images.Add(Bitmap.FromFile("CLSDFOLD.ICO")); imglist.Images.Add(Bitmap.FromFile("OPENFOLD.ICO")); imglist.Images.Add(Bitmap.FromFile("Drive01.ico")); treeView1.ImageList = imglist; string[] drives = Directory.GetLogicalDrives(); foreach (string drive in drives) { TreeNode node = new TreeNode(drive, 2, 2); treeView1.Nodes.Add(node); FillByDirectories(node); } // foreach }
/// <summary> /// Acessing data on different Threads /// </summary> private void UpdateUI(string message) { Dispatcher.Invoke(() => { InfoTextBox.AppendText(message + Environment.NewLine); InfoTextBox.ScrollToEnd(); }); }
private void ShowTrackInfo() { InfoTextBox.Clear(); string directoryName = Path.GetDirectoryName(_currentTrackPath); string fileName = Path.GetFileName(_currentTrackPath); GetFolderIno(directoryName, fileName); }
private void UpdateUI(string message) { Func <int> del = delegate() { InfoTextBox.AppendText(message + Environment.NewLine); return(0); }; Invoke(del); }
private void start() { StartButton.Enabled = false; InfoProgressBar.Value = CountPositionNumberInt; InfoTextBox.AppendText("当前破解次数:" + (CountPositionNumberInt + 1) + "\n"); InfoTextBox.AppendText("当前破解账号:" + UserListBox.Items[UserPositionNumberInt].ToString() + "\n"); InfoTextBox.AppendText("当前尝试密码:" + PassListBox.Items[PassPositionNumberInt].ToString() + "\n"); Http.Post(LinkString) .Form(new { USERNAME = UserListBox.Items[UserPositionNumberInt].ToString(), PASSWORD = PassListBox.Items[PassPositionNumberInt].ToString() }) .OnSuccess(result => { if (result.Contains("<head id")) { InfoTextBox.AppendText("当前破解状态:Success\n"); SuccessListBox.Items.Add(UserListBox.Items[UserPositionNumberInt].ToString() + " | " + PassListBox.Items[PassPositionNumberInt].ToString()); } else { InfoTextBox.AppendText("当前破解状态:Failure\n"); } if (UserPositionNumberInt == (UserNumberInt - 1)) { if (PassPositionNumberInt == (PassNumberInt - 1)) { InfoProgressBar.Value = CountNumberInt; InfoTextBox.AppendText("破解已完成!"); StartButton.Enabled = true; return; } } if (PassPositionNumberInt == (PassNumberInt - 1)) { UserPositionNumberInt++; PassPositionNumberInt = 0; } else { PassPositionNumberInt++; } if (CountPositionNumberInt != (CountNumberInt - 1)) { CountPositionNumberInt++; start(); } }) .OnFail(result => { InfoTextBox.AppendText("当前破解状态:Network Failure,Try retry\n"); start(); }) .Go(); }
private void txtUserName_Validating(object sender, CancelEventArgs e) { InfoTextBox txt = (InfoTextBox)sender; if (this.canAcceptUserName(txt.Text)) { this.errorProvider.Clear(); #region 自动填写登录信息 // 如果设置文件中当前用户的状态为记住密码 var dic = CommandLine.Console.AccountDictionary; CommandLine.Console._accounts._account account = null; if (dic.ContainsKey(txt.Text)) { account = dic[txt.Text]; } if (txt == this.loginInfo_txtUserName) { if (account != null) { this.txtUserPwd.Text = account.userpwd; this.cbRememberMe.Checked = account.rememberme; this.cbAutoLogin.Checked = account.autologin; } } else if (txt == this.logoutInfo_txtUserName) { if (account != null && account.autologin) { this.logoutInfo_cbCancelAutoLogin.Enabled = true; } else { this.logoutInfo_cbCancelAutoLogin.Enabled = false; this.logoutInfo_cbCancelAutoLogin.Checked = false; } } #endregion } else { if (string.IsNullOrEmpty(txt.Text)) { this.errorProvider.SetError(txt, "请输入您的用户名。"); } else { this.errorProvider.SetError(txt, "请输入您的11位手机号码。"); } } }
public void GetMessage(string message) { if (InfoTextBox.InvokeRequired) { InfoTextBox.BeginInvoke(new MethodInvoker(() => { InfoTextBox.AppendText(message + "\r\n"); })); } else { InfoTextBox.AppendText(message + "\r\n"); } }
// 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 Info_btn_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] phonesInfo = phones.PrintInfo(); for (int i = 0; i < phonesInfo.Length; i++) { InfoTextBox.AppendText(phonesInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void NameStarButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] name = SpaceObjects.PrintNameStars(); for (int i = 0; i < name.Length; i++) { InfoTextBox.AppendText(name[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void PlanetsInfoButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] planetsInfo = SpaceObjects.PrintInfoPlanets(); for (int i = 0; i < planetsInfo.Length; i++) { InfoTextBox.AppendText(planetsInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void About_Form_Load(object sender, EventArgs e) { AboutTextBox.Text = "Copyright 2020 Autodesk, Inc. All rights reserved. " + "\r\n\r\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" + "\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," + "\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" + "\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" + "\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," + "\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + "\r\n\r\nAutodesk" + "\r\nCustomer Services Organisation" + "\r\nFarnborough" + "\r\nFernando Pavon" + "\r\[email protected]" + "\r\nVersion 0.0.0.1" + "\r\n1 July 2020"; #if (Revit2018) revitVersion = "Revit Version 2018"; #elif (Revit2019) revitVersion = "Revit Version 2019"; #elif (Revit2020) revitVersion = "Revit Version 2020"; #endif InfoTextBox.AppendText("\u2022Revit Version: " + Utils.k_revitVersion); InfoTextBox.AppendText("\r\n\r\n\u2022Revit Language: " + Utils.k_revitLanguage); InfoTextBox.AppendText("\r\n\r\n\u2022System Country: " + Utils.k_systemCountry); InfoTextBox.AppendText("\r\n\r\n\u2022System Language: " + Utils.k_systemLanguage); //VersionsTextBox.AppendText("\u2022" + revitVersion); string strGeo = string.Empty; foreach (AssemblyVersion assembly in Utils.s_assemblies) { if (assembly.Geography != "") { strGeo = assembly.Geography; } else { strGeo = ""; } string line = "\u2022" + assembly.AssemblyName + " Version: " + assembly.CurrentVersion + " " + strGeo + "\r\n\r\n"; VersionsTextBox.AppendText(line); } }
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"; }
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 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); } }
// 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!"); } }
public MainWindow() { InitializeComponent(); Updater.ProgressChanged += ((sender, args) => { Dispatcher.Invoke(() => { var idle = args.Status is UpdaterStatus.Ready or UpdaterStatus.Complete; UpdateButton.IsEnabled = idle; CancelButton.IsEnabled = !idle; if (Updater.IsCancelled && !idle) { return; } DownloadStatus.Text = args.Status.ToString(); var progress = args.Progress; PercentText.Text = progress >= 0 ? $"{Math.Round(progress * 100, 2)}%" : null; ProgressBar.IsIndeterminate = progress < 0; ProgressBar.Value = Math.Max(0, progress); }); }); Updater.InfoSent += ((sender, s) => { Dispatcher.Invoke(() => { InfoTextBox.AppendText(s); InfoTextBox.AppendText("\n"); }); }); Updater.ErrorOccurred += Updater_ErrorOccurred; }
private void AppendToInfoBox(int i, string header, string data) { InfoTextBox.AppendText($"\n{i} {header} : {data}"); }