BatchFdrOptimizer.frmMain.frmMain_KeyPress C# (CSharp) Метод

frmMain_KeyPress() приватный Метод

private frmMain_KeyPress ( object sender, KeyPressEventArgs e ) : void
sender object
e System.Windows.Forms.KeyPressEventArgs
Результат void
        private void frmMain_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(!txtRawFolder.Focused && !txtOutputFolder.Focused)
            {
                int index1 = -1;
                int index2 = -1;
                switch(e.KeyChar)
                {
                    case 'i':
                        index1 = lstAllModifications.FindString("iTRAQ 4-plex on n-term peptide");
                        index2 = lstAllModifications.FindString("iTRAQ 4-plex on K");
                        e.Handled = true;
                        break;
                    case 'I':
                        index1 = lstAllModifications.FindString("iTRAQ 8-plex on n-term peptide");
                        index2 = lstAllModifications.FindString("iTRAQ 8-plex on K");
                        e.Handled = true;
                        break;
                    case 't':
                        index1 = lstAllModifications.FindString("TMT duplex on n-term peptide");
                        index2 = lstAllModifications.FindString("TMT duplex on K");
                        e.Handled = true;
                        break;
                    case 'T':
                        index1 = lstAllModifications.FindString("TMT 6-plex on n-term peptide");
                        index2 = lstAllModifications.FindString("TMT 6-plex on K");
                        e.Handled = true;
                        break;
                }
                if(index1 >= 0)
                {
                    lstSelectedFixedModifications.Items.Add(lstAllModifications.Items[index1]);
                    lstAllModifications.Items.RemoveAt(index1);
                }
                if(index2 >= 0)
                {
                    lstSelectedFixedModifications.Items.Add(lstAllModifications.Items[index2]);
                    lstAllModifications.Items.RemoveAt(index2);
                }
            }
        }