Exemplo n.º 1
0
        private async void OnEditButtonClick(GridRowMouseEventArgs e)
        {
            var product = e.DataItem as Product;

            if (product == null)
            {
                return;
            }
            product.Description = $"Product with ID = {product.ProductId} editing . . .";
            EditorItem          = product;
            await EditDialog.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 编辑节点,只改变节点Name字段
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tmpDialog = new EditDialog();
            DataRow[] rows;
            //树节点的富文本框添加现在选中节点的名字
            try
            {
                uint id = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                tmpDialog.RichTextBox.Text = tmpTree.SelectedNode.Text; //回填现在的节点名字

                if (tmpDialog.Show() == DialogResult.OK)
                {
                    tmpTree.SelectedNode.Text = tmpDialog.NodeName; //改变节点的名字
                }

                switch (flag)
                {
                case 0: break;

                case 1:
                    rows = m_DesignDataTable.Select("Id='" + id + "'");
                    rows[0].BeginEdit();
                    rows[0]["Name"]          = tmpTree.SelectedNode.Text;
                    dataGridView[2, 0].Value = tmpTree.SelectedNode.Text;    //界面上视图的改变
                    //rows[0]["DesignContent"] = richTextBox.Rtf; //先编辑内容,然后点击编辑节点,跟习惯的顺序不一致
                    rows[0].EndEdit();
                    break;

                case 2:
                    rows = m_TestDataTable.Select("Id='" + id + "'");
                    rows[0].BeginEdit();
                    rows[0]["Name"] = tmpTree.SelectedNode.Text;
                    // vGridControl.SetCellValue(vGridControl.Rows["Name"], 0, tmpTree.SelectedNode.Text);//界面上视图的改变
                    //判断一下是否为空
                    //rows[0]["TestIdentify"] = vGridControl.GetCellValue(TestIdentify, 0).ToString();
                    //rows[0]["TestPriority"] = testPrio_index;
                    //rows[0]["TraceRelationships"] = vGridControl.GetCellValue(TraceRelationships, 0).ToString();
                    //rows[0]["TestContent"] = vGridControl.GetCellValue(TestContent, 0).ToString();
                    //rows[0]["TestReqResolve"] = vGridControl.GetCellValue(TestReqResolve, 0).ToString();
                    //rows[0]["AdequacyRequirements"] = vGridControl.GetCellValue(AdequacyRequirements, 0).ToString();
                    //rows[0]["TerminalCondition"] = vGridControl.GetCellValue(TerminalCondition, 0).ToString();
                    rows[0].EndEdit();
                    break;
                }
            }
            catch
            {
                MessageBox.Show("请选择节点");
            }
        }
Exemplo n.º 3
0
        public void bringDialogs(int identifier)
        {
            //legend
            //1 - Resource dialog
            //2 = Edit dialog
            //3 - DeleteD dialog

            switch (identifier)
            {
            case 1: resourceDialog.Show(SupportFragmentManager.BeginTransaction(), "resource dialog");
                break;

            case 2: editDialog.Show(SupportFragmentManager.BeginTransaction(), "edit dialog");
                break;

            case 3: deleteDialog.Show(SupportFragmentManager.BeginTransaction(), "delete dialog");
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 添加子节点,并自动对PID,ID编号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 动态添加控件(控件放在窗体中)
            // ftmp = new EditForm();
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();
            DataRow  dr; //行数据


            switch (flag)
            {
            case 0: break;

            case 1:
                dr = m_DesignDataTable.NewRow();
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;

            case 2:
                dr = m_TestDataTable.NewRow();
                // ftmp.Flag = true;
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text = tmpDialog.NodeName;

                        dr["PId"]                  = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr["TestType"]             = tmpTree.SelectedNode.Text;
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;

            case 3:
                break;

            case 4:
                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加根节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addRoot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tmpDialog = new EditDialog(); //动态添加编辑控件(控件放在窗体中)
            TreeNode tmpNode = new TreeNode();
            UInt16   count;               //Id=1的节点个数
            DataRow  dr;                  //行数据

            DataRow[] rows;               //多个行数据

            switch (flag)
            {
            case 0: break;

            case 1:
                dr    = m_DesignDataTable.NewRow();
                rows  = m_DesignDataTable.Select("Id='1'");
                count = (UInt16)rows.Count <DataRow>();
                //判断ID=1是否存在,定义开始的节点ID为1,ID和PID同时为0,树节点递归显示不出,无限循环
                if (count == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = 0;
                        dr["Id"]            = 1;
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = 0;
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                break;

            case 2:
                dr    = m_TestDataTable.NewRow();
                rows  = m_TestDataTable.Select("Id='1'");
                count = (UInt16)rows.Count <DataRow>();

                if (count == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text               = tmpDialog.NodeName;
                        dr["PId"]                  = 0;
                        dr["Id"]                   = 1;
                        dr["TestType"]             = "";
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    // DataRow dr1 = m_TestDataTable.NewRow();
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text               = tmpDialog.NodeName;
                        dr["PId"]                  = 0;
                        dr["TestType"]             = "";
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                break;

            case 3:
                break;

            case 4:
                break;

            default:
                break;
            }
        }