예제 #1
0
        private TreeNode_ GetRootParent(TreeNode node)
        {
            TreeNode_ parent = (TreeNode_)node;

            while (parent.Parent != null)
            {
                parent = (TreeNode_)parent.Parent;
            }
            return(parent);
        }
예제 #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DeleteConfirmForm d = new DeleteConfirmForm();

            switch (TV_item.SelectedNode.ImageIndex)
            {
            case 0:    //disk
                break;

            case 1:    //folder
                TreeNode_ parent_node = GetRootParent(TV_item.SelectedNode);
                if (parent_node.ImageIndex == 0)
                {
                    d.TB.Text = TV_item.SelectedNode.FullPath;                                 //disk
                }
                else
                {
                    d.TB.Text = ((CloudType)parent_node.ImageIndex).ToString() + ":" + TV_item.SelectedNode.FullPath;
                }
                d.ShowDialog(this);
                if (d.Delete)
                {
                    DeleteItems deleteitems = new DeleteItems()
                    {
                        PernamentDelete = d.CB_pernament.Checked
                    };
                    deleteitems.Items.Add(((TreeNode_)TV_item.SelectedNode).ExplorerNode as ItemNode);
                    Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.DeletePath(deleteitems);
                }
                break;

            default:    //cloud
                d.TB.Text = ((CloudType)TV_item.SelectedNode.ImageIndex).ToString() + ":" + TV_item.SelectedNode.Text;
                d.CB_pernament.Enabled = false;
                d.ShowDialog(this);
                if (d.Delete)
                {
                    TV_item.Nodes.Remove(TV_item.SelectedNode);
                    Setting_UI.reflection_eventtocore.AccountsAndCloud.DeleteAccountCloud(TV_item.SelectedNode.Text, (CloudType)TV_item.SelectedNode.ImageIndex);
                }
                break;
            }
        }
예제 #3
0
        private void OpenPath(bool explandTV, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                if (e.Button == MouseButtons.Right)
                {
                    TV_item.SelectedNode = e.Node;
                }
                return;
            }
            TreeNode_ TN = e.Node as TreeNode_;

            if (TN == null)
            {
                return;
            }
            list_UCLVitem[tabControl1.SelectedIndex].managerhistory_itemnodes.Root = TN.ExplorerNode.GetRoot;
            list_UCLVitem[tabControl1.SelectedIndex].managerhistory_itemnodes.Next(TN.ExplorerNode);
            list_UCLVitem[tabControl1.SelectedIndex].ExplorerCurrentNode(explandTV, true, TN);
        }
예제 #4
0
        public void SetData_GetList_AddItemTo_LVnTV_(ExplorerListItem load)
        {
            if (load.addToTV && load.TV_node != null)//add folder to tree view
            {
                ((TreeNode)load.TV_node).Nodes.Clear();
                foreach (ItemNode c in load.node.Childs)
                {
                    if (c.Info.Size > 0)
                    {
                        continue;
                    }
                    TreeNode_ child = new TreeNode_(c);
                    ((TreeNode_)load.TV_node).Nodes.Add(child);
                }
                if (load.explandTV)
                {
                    ((TreeNode)load.TV_node).Expand();
                }
            }
            // Add LV tab index
            if (load.indexLV_tab != -1)
            {
                List <ItemLV> ListItem_LV = new List <ItemLV>();
                DateTime      temp        = new DateTime(0);
                foreach (ItemNode c in load.node.Childs)
                {
                    if (c.Info.Size > 0)
                    {
                        continue;
                    }
                    string datetime = "";
                    if (c.Info.DateMod != temp)
                    {
                        try { datetime = c.Info.DateMod.ToString(TimeFormat); } catch { }
                    }

                    ListItem_LV.Add(new ItemLV()
                    {
                        str = new string[] { c.Info.Name, "Folder", string.Empty, datetime, c.Info.MimeType, c.Info.ID }, icon = icon_folder
                    });
                }
                foreach (ItemNode c in load.node.Childs)
                {
                    if (c.Info.Size < 1)
                    {
                        continue;
                    }
                    string extension = c.GetExtension();
                    ListItem_LV.Add(new ItemLV()
                    {
                        str  = new string[] { c.Info.Name, "File", c.Info.Size.ToString(), c.Info.DateMod.ToString(TimeFormat), c.Info.MimeType, c.Info.ID },
                        icon = c.GetRoot.RootType.Type == CloudType.LocalDisk ?
                               IconReader.GetFileIcon(c.GetFullPathString(), IconReader.IconSize.Small, false) : //some large file make slow.
                               IconReader.GetFileIcon("." + extension, IconReader.IconSize.Small, false)
                    });
                }
                list_UCLVitem[load.indexLV_tab].AddListViewItem(ListItem_LV);
            }

            //set tab text name
            tabControl1.TabPages[load.indexLV_tab].Text = load.node.Info.Name;

            //set tooltip tab
            tabControl1.TabPages[load.indexLV_tab].ToolTipText = load.node.GetFullPathString();

            //set PathNode
            list_UCLVitem[load.indexLV_tab].pathUC1.Node = load.node;

            //OldPathLV inpath = new OldPathLV();
            //inpath.ID = list.id_folder;
            //inpath.Path = loaditemthread.path.TrimEnd(new char[] { '\\', '/' });
            ////set old Path TextBox
            //list_UCLVitem[loaditemthread.indexLV_tab].oldpathlv.Add(inpath);
        }