Example #1
0
        private void PopDirectoryItems()
        {
            lstDirectory.Items.Clear();
            imbMoveup.Enabled = false;

            ListOfDirectoryItems ldi = _presenter.DirectoryItems;

            if (ldi != null)
            {
                foreach (DirectoryItem di in ldi.DirectoryItems)
                {
                    if (di.ItemType == DirectoryItemType.DIRECTORY)
                    {
                        lstDirectory.Items.Add(new ListItem(di.FileName));
                    }
                    else
                    {
                        lstDirectory.Items.Add(new ListItem("--> " + di.FileName));
                    }
                }

                if (ldi.FullName.Length > ldi.RootDirLen)
                {
                    imbMoveup.Enabled = true;
                }
            }
        }
Example #2
0
        protected void imbMoveup_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ListOfDirectoryItems di = _presenter.DirectoryItems;
            int    len = di.FullName.LastIndexOf('\\');
            string str = di.FullName.Substring(0, len);

            _presenter.DirectoryItems = GetDirItems(di.RootDirLen, str);
            txtFolderpath.Text        = str.Substring(_presenter.DirectoryItems.RootDirLen);
            PopDirectoryItems();
        }
Example #3
0
        private ListOfDirectoryItems GetDirItems(int rootlen, string lPath)
        {
            ListOfDirectoryItems dirItems = new ListOfDirectoryItems(rootlen, lPath);

            if (Directory.Exists(lPath))
            {
                DirectoryInfo dr = new DirectoryInfo(lPath);

                foreach (DirectoryInfo sdr in dr.GetDirectories())
                {
                    dirItems.Add(new DirectoryItem(sdr.FullName, sdr.Name, DirectoryItemType.DIRECTORY));
                }

                foreach (FileInfo fi in dr.GetFiles("*.aspx"))
                {
                    dirItems.Add(new DirectoryItem(fi.FullName, fi.Name, DirectoryItemType.FILE));
                }
            }
            return(dirItems);
        }