Example #1
0
        /// <summary>
        /// This event handler opens up a new PTMValidation page when a certain
        /// cell in delta mass table is double clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void deltaMassMatrix_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            // Make sure we have an event
            if (e != null)
            {
                // Get the mass, amino acid, and the spectral count of the cell
                string aminoAcid = null;
                int    mass      = Int32.MinValue;
                int    cellValue = Int32.MinValue;
                aminoAcid = deltaMassMatrix.Columns[e.ColumnIndex].Name;
                try { cellValue = Int32.Parse(deltaMassMatrix[e.ColumnIndex, e.RowIndex].Value.ToString()); }
                catch (Exception) { }
                try { mass = Int32.Parse(deltaMassMatrix[0, e.RowIndex].Value.ToString()); }
                catch (Exception) { }
                if (aminoAcid != null && mass != Int32.MinValue && cellValue != Int32.MinValue && cellValue > 0)
                {
                    // Make the tab page name
                    string tabPageText;
                    if (mass > 0)
                    {
                        tabPageText = aminoAcid + "+" + mass;
                    }
                    else
                    {
                        tabPageText = aminoAcid + mass;
                    }

                    string tabPageName = tabPageText + " (" + tabSuffix + ")";

                    // Check to see if already exists, create a new one
                    // iff there isn't a page with this name already
                    if (tabControl.TabPages[tabPageName] != null)
                    {
                        tabControl.SelectTab(tabPageName);
                    }
                    else
                    {
                        Map <string, Protein> prots   = PTMData.dataTrees[mass][aminoAcid];
                        ProteinValidationPane newPane = new ProteinValidationPane(prots, ref secondaryResults);
                        newPane.Dock = DockStyle.Fill;
                        TabPage newPage = new TabPage(tabPageName);
                        newPage.Name       = tabPageName;
                        newPage.Text       = tabPageText;
                        newPage.ImageIndex = imageIndex;
                        newPage.Controls.Add(newPane);
                        tabControl.TabPages.Add(newPage);
                        tabControl.SelectTab(newPage);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// This event handler opens up a new PTMValidation page when a certain
        /// cell in delta mass table is double clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void deltaMassMatrix_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            // Make sure we have an event
            if (e != null)
            {
                // Get the mass, amino acid, and the spectral count of the cell
                string aminoAcid = null;
                int mass = Int32.MinValue;
                int cellValue = Int32.MinValue;
                aminoAcid = deltaMassMatrix.Columns[e.ColumnIndex].Name;
                try { cellValue = Int32.Parse(deltaMassMatrix[e.ColumnIndex, e.RowIndex].Value.ToString()); }
                catch (Exception) { }
                try { mass = Int32.Parse(deltaMassMatrix[0, e.RowIndex].Value.ToString()); }
                catch (Exception) { }
                if (aminoAcid != null && mass != Int32.MinValue && cellValue != Int32.MinValue && cellValue > 0)
                {
                    // Make the tab page name
                    string tabPageText;
                    if (mass > 0)
                        tabPageText = aminoAcid + "+" + mass;
                    else
                        tabPageText = aminoAcid + mass;

                    string tabPageName = tabPageText + " (" + tabSuffix + ")";

                    // Check to see if already exists, create a new one
                    // iff there isn't a page with this name already
                    if (tabControl.TabPages[tabPageName] != null)
                        tabControl.SelectTab(tabPageName);
                    else
                    {
                        Map<string, Protein> prots = PTMData.dataTrees[mass][aminoAcid];
                        ProteinValidationPane newPane = new ProteinValidationPane(prots, ref secondaryResults);
                        newPane.Dock = DockStyle.Fill;
                        TabPage newPage = new TabPage(tabPageName);
                        newPage.Name = tabPageName;
                        newPage.Text = tabPageText;
                        newPage.ImageIndex = imageIndex;
                        newPage.Controls.Add(newPane);
                        tabControl.TabPages.Add(newPage);
                        tabControl.SelectTab(newPage);
                    }
                }
            }
        }