Example #1
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            // If not clicking on a result node, then don't do anything special
            var resultNode = e.Node as TestResultTreeNode;

            if (resultNode == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                // If the result is already selected in the tree
                // but not in the model.selection context, then force
                // it to be selected
                if (resultNode == treeView1.SelectedNode && model.selection.current.SelectedEntity != resultNode.result)
                {
                    model.selection.Update(this, SelectedResultnode.result);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                PopupMenu.ShowContextMenu(contextMenuStrip1, resultNode.result);
            }
        }
Example #2
0
 private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if ((e.Button == MouseButtons.Left && e.ColumnIndex == 2) || e.Button == MouseButtons.Right)
     {
         int             index = e.RowIndex;
         DataGridViewRow row   = dataGridView1.Rows[index];
         row.Selected = true;
         string            label  = row.Cells[0].Value.ToString();
         ChessResultEntity result = resultmap[label];
         PopupMenu.ShowContextMenu(contextMenuStrip1, result);
     }
 }
Example #3
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            XTreeNode node = (XTreeNode)e.Node;

            if (e.Button == MouseButtons.Left)
            {
                // If the entity is already selected in the tree
                // but not in the model.selection context, then force
                // it to be selected
                if (node == treeView1.SelectedNode && model.selection.current.SelectedEntity != node.DataEntity)
                {
                    model.selection.Update(this, node.DataEntity);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                PopupMenu.ShowContextMenu(contextMenuStrip1, node.DataEntity);
            }
        }
Example #4
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            // If clicking the header row, than we won't have a data row.
            if (e.RowIndex == -1)
            {
                return;
            }

            DataGridViewRow row    = dataGridView1.Rows[e.RowIndex];
            int             taskID = (int)row.Cells[0].Value;
            TaskRunEntity   run    = model.runs[taskID];

            //DataGridViewCell cell = row.Cells[e.ColumnIndex];

            if (e.Button == MouseButtons.Left)
            {
                // If the entity is already highlighted
                // but not in the model.selection context, then force
                // it to be selected
                if (row.Selected && model.selection.current.SelectedEntity != run)
                {
                    suppress_selection_notify = true;
                    try
                    {
                        model.selection.Update(this, run);
                    }
                    finally
                    {
                        suppress_selection_notify = false;
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                PopupMenu.ShowContextMenu(contextMenuStrip1, run);
            }
        }