Ejemplo n.º 1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (this.dataGridView1.Rows[e.RowIndex].Cells["ID"].Value == null)
            {
                return;
            }

            int id = (int)this.dataGridView1.Rows[e.RowIndex].Cells["ID"].Value;

            //openMode == 0用于选择
            if (openMode == 0)
            {
                string    name      = this.dataGridView1.Rows[e.RowIndex].Cells["name"].Value.ToString();
                LookupArg lookupArg = new LookupArg(id, name);
                lookupArg.ArgName = conf.CategoryName;

                //File.AppendAllText("e:\\debug.txt", string.Format("double click, thread:{0}\r\n", System.Threading.Thread.CurrentThread.ManagedThreadId));

                this.Close();
                this.invokeLookupCallback(lookupArg);
            }
            else if (openMode == 1)
            {
                MyDockContent form = getItemForm(this, 1, id);
                form.updateNotify -= new UpdateNotify(form_updateNotify);
                form.updateNotify += new UpdateNotify(form_updateNotify);
                form.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void toolStripButton_edit_Click(object sender, EventArgs e)
        {
            List <int> list = this.dataGridView1.getSelectIDs("ID", "check");

            if (list == null || list.Count <= 0)
            {
                MessageBox.Show("请选择编辑" + conf.ItemName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            MyDockContent form = getItemForm(this, 1, list[0]);

            form.updateNotify -= new UpdateNotify(form_updateNotify);
            form.updateNotify += new UpdateNotify(form_updateNotify);
            form.ShowDialog();
        }
Ejemplo n.º 3
0
        private void toolStripButton_add_Click(object sender, EventArgs e)
        {
            int parent;

            if (treeView1.SelectedNode != null)
            {
                parent = int.Parse(treeView1.SelectedNode.Name);
            }

            else
            {
                MessageBox.Show("请选择类别,如无类别请先增加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            MyDockContent form = getItemForm(this, 0, 0);

            //这个地方可能还可以改进
            form.updateNotify -= new UpdateNotify(form_updateNotify);
            form.updateNotify += new UpdateNotify(form_updateNotify);
            form.ShowDialog();
        }