Exemplo n.º 1
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            if (searchFrm != null)
            {
                try
                {
                    searchFrm.Close();
                }
                catch { }
            }
            ////当前节点
            TreeNodeEx theNode = treeView1.SelectedNode as TreeNodeEx;

            if (theNode == null)
            {
                return;
            }
            if (theNode.ImageIndex == 2 || theNode.ImageIndex == 7)
            {
                this.Cell2.closefile();

                frmCellEdit frm = new frmCellEdit(this, theNode, Mydel);
                frm.ShowDialog();

                showCell(theNode.Name);

                theNode.ImageIndex         = (treeFactory.CheckEFileByFileID(theNode.Name, 1) == true) ? 7 : 2;//判断是否有电子文件
                theNode.SelectedImageIndex = theNode.ImageIndex;

                MyFavorites obj = new MyFavorites();
                obj.Write(theNode.Name, theNode.Text);

                if (treeView1.Nodes.Count > 0)
                {
                    if (treeView1.Nodes[0].Text == "最近著录过的文件")
                    {
                        if (theNode.Parent != null && theNode.Parent.Text == "最近著录过的文件")
                        {
                            treeFactory.CreatemyFavoritesNode((TreeNodeEx)treeView1.Nodes[0]);
                            treeFactory.SelectNodeImage(treeView1, theNode.Name);
                        }
                        else
                        {
                            treeFactory.CreatemyFavoritesNode((TreeNodeEx)treeView1.Nodes[0]);
                        }
                    }
                    if (treeView1.Nodes.Count >= 1 && (!(treeView1.Nodes[1].IsExpanded)))
                    {
                        treeView1.Nodes[1].Expand();
                    }
                }
            }
            else if (theNode.ImageIndex == 4)
            {
                TXMessageBoxExtensions.Info("提示:已组卷的目录不允许编辑! \n 【温馨提示:如想编辑请在文件登记中撤销登记或在组卷目录移除此文件】");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除当前节点
        /// </summary>
        private void DelNode()
        {
            frm2PDFProgressMsg dfmsg = null;

            try
            {
                TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode;
                if (theNode == null)
                {
                    return;
                }
                TreeNodeEx parentNode = (TreeNodeEx)theNode.Parent;
                if (parentNode == null)
                {
                    return;
                }
                if (parentNode.Tag != null && parentNode.Tag.ToString() == "")
                {
                    MyFavorites myFav1 = new MyFavorites();
                    myFav1.Delete(theNode.Name);
                    theNode.Remove();
                    return;
                }

                int DelCount = 0;
                if (theNode.ImageIndex == 1)
                {
                    bool check_flg = false;
                    CheckFileNodeIsArch(theNode, ref check_flg, ref DelCount);
                    if (check_flg)
                    {
                        TXMessageBoxExtensions.Info("提示:已经组卷的文件目录不允许修改!");
                        return;
                    }
                }
                DialogResult ret = TXMessageBoxExtensions.Question("确定删除 [" + GetTrueText(theNode.Text) + "] 及其子节点?");
                if (ret == DialogResult.OK)
                {
                    this.Enabled = false;

                    MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(theNode.Name, Globals.ProjectNO);
                    if (fileMDL != null)
                    {
                        if (int.Parse(fileMDL.fileStatus) > 3)
                        {
                            TXMessageBoxExtensions.Info("该文件已经 登记或组卷,无法进行删除操作!");
                            this.Enabled = true;
                            return;
                        }
                        dfmsg = new frm2PDFProgressMsg();
                        if (theNode.ImageIndex == 1)
                        {
                            dfmsg.progressBar1.Maximum = DelCount;
                            dfmsg.label2.Text          = "正在删除:0/" + DelCount.ToString();
                            dfmsg.Show();
                            Application.DoEvents();
                        }
                        else
                        {
                            dfmsg.progressBar1.Maximum = 2;
                            dfmsg.progressBar1.Value   = 1;
                            dfmsg.label2.Text          = "正在删除:1/1";
                            dfmsg.Show();
                            Application.DoEvents();
                        }

                        DeleteRecycle(theNode.Name, ref dfmsg);
                        theNode.Remove();
                        CheckEnable();
                        tssLabel1.Text = Globals.NormalStatus;
                    }
                    this.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                this.Enabled = true;
                if (dfmsg != null)
                {
                    dfmsg.Dispose();
                    dfmsg.Close();
                }
            }
            finally
            {
                this.Enabled = true;
                if (dfmsg != null)
                {
                    dfmsg.Dispose();
                    dfmsg.Close();
                }
            }
        }