private void TPBWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { tabControl.Enabled = true; SearchingForm.Hide(); var product = (Product)e.Result; string ProductNumber = product.ProductNumber; List <string> ProceduresList = product.DocumentList; TPFilenameTextbox.Text = ProductNumber; TPSerialEntryComboBox.Focus(); if (!ProceduresList.Any()) { Logger.Log($"No procedures found for {ProductNumber}", rt, true); return; } foreach (var p in ProceduresList) { var f = new FileInfo(p); TPResultsListBox.Items.Add(f); } TPResultsListBox.SelectedItem = TPResultsListBox.Items[0]; Logger.Log($"Found procedures for {ProductNumber}", rt, true); }
private void TPSearchButton_Click(object sender, EventArgs e) { if (TPBWorker.IsBusy) { return; } TPFilenameTextbox.Clear(); TPDateTextbox.Clear(); TPResultsListBox.Items.Clear(); Regex rx = new Regex("[^a-zA-Z0-9-]"); TPSerialEntryComboBox.Text = rx.Replace(TPSerialEntryComboBox.Text, ""); var Serial = TPSerialEntryComboBox.Text; if (Serial.Length < 3 || (Serial.Contains('-') && Serial.Length < 9)) { Logger.Log($"Invalid serial number or product entered.", rt, true); return; } if (!TPSerialEntryComboBox.Items.Contains(TPSerialEntryComboBox.Text)) { TPSerialEntryComboBox.Items.Insert(0, TPSerialEntryComboBox.Text); } TPSerialEntryComboBox.SelectAll(); tabControl.Enabled = false; SearchingForm.Show(); TPBWorker.RunWorkerAsync(Serial); }
private void Main_Load(object sender, EventArgs e) { //set default config values if paths are null or empty (config file didn't load) if (string.IsNullOrEmpty(VAULT_PATH)) { VAULT_PATH = @"\\pandora\vault"; } if (string.IsNullOrEmpty(IID_DATABASE_PATH)) { IID_DATABASE_PATH = @"\\ares\shared\Operations\Test Engineering\Test Softwares\ProcedureSearch\ProductCodesMaster.mdb"; } if (string.IsNullOrEmpty(LOGFILE_PATH)) { LOGFILE_PATH = @"\\ares\shared\Operations\Test Engineering\Test Softwares\ProcedureSearch\log.txt"; } SearchingForm.Hide(); Logger.Log("Program loaded, ready to search.", rt, true); TPSerialEntryComboBox.Select(); }
private void Main_KeyPress(object sender, KeyPressEventArgs e) { if (!tabControl.Enabled) { return; } if (tabControl.SelectedTab.Text == "Test Procedures") { if (e.KeyChar == '[') { e.KeyChar = (char)Keys.None; e.Handled = true; } if (TPSerialEntryComboBox.Focused && e.KeyChar == (char)Keys.Enter) { TPSearchButton.PerformClick(); e.Handled = true; return; } if (!TPSerialEntryComboBox.Focused && e.KeyChar != (char)Keys.Enter) { TPSerialEntryComboBox.Focus(); TPSerialEntryComboBox.Text = e.KeyChar.ToString(); TPSerialEntryComboBox.SelectionStart = TPSerialEntryComboBox.Text.Length; e.Handled = true; return; } if (e.KeyChar == ']') { e.KeyChar = (char)Keys.None; TPSearchButton.PerformClick(); return; } } if (tabControl.SelectedTab.Text == "Process Sheets") { if (e.KeyChar == '[') { e.KeyChar = (char)Keys.None; e.Handled = true; } if (PSSerialEntryComboBox.Focused && e.KeyChar == (char)Keys.Enter) { PSSearchButton.PerformClick(); e.Handled = true; return; } if (!PSSerialEntryComboBox.Focused && e.KeyChar != (char)Keys.Enter) { PSSerialEntryComboBox.Focus(); PSSerialEntryComboBox.Text = e.KeyChar.ToString(); PSSerialEntryComboBox.SelectionStart = PSSerialEntryComboBox.Text.Length; e.Handled = true; return; } if (e.KeyChar == ']') { e.KeyChar = (char)Keys.None; PSSearchButton.PerformClick(); return; } } }