Esempio n. 1
0
        private void PSBWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            tabControl.Enabled = true;

            SearchingForm.Hide();
            var           product        = (Product)e.Result;
            string        ProductNumber  = product.ProductNumber;
            List <string> ProceduresList = product.DocumentList;

            PSFilenameTextbox.Text = ProductNumber;
            PSSerialEntryComboBox.Focus();

            if (!ProceduresList.Any())
            {
                Logger.Log($"No process sheets found for {ProductNumber}", rt, true);
                return;
            }

            foreach (var p in ProceduresList)
            {
                var f = new FileInfo(p);
                PSResultsListBox.Items.Add(f);
            }

            PSResultsListBox.SelectedItem = PSResultsListBox.Items[0];
            Logger.Log($"Found process sheet for {ProductNumber}", rt, true);
        }
Esempio n. 2
0
        private void PSSearchButton_Click(object sender, EventArgs e)
        {
            if (PSBWorker.IsBusy)
            {
                return;
            }

            PSFilenameTextbox.Clear();
            PSDateTextbox.Clear();
            PSResultsListBox.Items.Clear();
            Regex rx = new Regex("[^a-zA-Z0-9-]");

            PSSerialEntryComboBox.Text = rx.Replace(PSSerialEntryComboBox.Text, "");
            var Serial = PSSerialEntryComboBox.Text;

            if (Serial.Length < 3 || (Serial.Contains('-') && Serial.Length < 9))
            {
                Logger.Log($"Invalid serial number or product entered.", rt, true);
                return;
            }

            if (!PSSerialEntryComboBox.Items.Contains(PSSerialEntryComboBox.Text))
            {
                PSSerialEntryComboBox.Items.Insert(0, PSSerialEntryComboBox.Text);
            }

            PSSerialEntryComboBox.SelectAll();
            tabControl.Enabled = false;
            SearchingForm.Show();
            PSBWorker.RunWorkerAsync(Serial);
        }
Esempio n. 3
0
        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;
                }
            }
        }