Esempio n. 1
0
        internal ShellItem(ShellBrowserComponent browser, IntPtr pidl, IntPtr shellFolderPtr)
        {
            this.browser = browser;

            this.shellFolderPtr = shellFolderPtr;
            this.shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder));
            subFiles = new ShellItemCollection(this);
            subFolders = new ShellItemCollection(this);

            pidlRel = new PIDL(pidl, false);

            text = "Desktop";
            path = "Desktop";

            SetAttributesDesktop(this);

            NativeShellAPI.SHFILEINFO info = new NativeShellAPI.SHFILEINFO();
            NativeShellAPI.SHGetFileInfo(pidlRel.Ptr, 0, ref info, NativeShellAPI.cbFileInfo,
                NativeShellAPI.SHGFI.PIDL | NativeShellAPI.SHGFI.TYPENAME | NativeShellAPI.SHGFI.SYSICONINDEX);

            type = info.szTypeName;

            ShellImageList.SetIconIndex(this, info.iIcon, false);
            ShellImageList.SetIconIndex(this, info.iIcon, true);

            sortFlag = 1;
        }
Esempio n. 2
0
        internal ShellItem(ShellBrowserComponent browser, ShellItem parentItem, IntPtr pidl)
        {
            this.browser = browser;

            this.parentItem = parentItem;

            pidlRel = new PIDL(pidl, false);

            SetText(this);
            SetPath(this);
            SetAttributesFile(this);
            SetInfo(this);                        

            sortFlag = MakeSortFlag(this);
        }
Esempio n. 3
0
        public ShellBrowserUpdater(ShellBrowserComponent br)
        {
            this.br = br;
            CreateHandle(new CreateParams());

            NativeShellAPI.SHChangeNotifyEntry entry = new NativeShellAPI.SHChangeNotifyEntry();
            entry.pIdl = br.DesktopItem.PIDLRel.Ptr;
            entry.Recursively = true;

            notifyId = NativeShellAPI.SHChangeNotifyRegister(
                this.Handle,
                NativeShellAPI.SHCNRF.InterruptLevel | NativeShellAPI.SHCNRF.ShellLevel,
                NativeShellAPI.SHCNE.ALLEVENTS | NativeShellAPI.SHCNE.INTERRUPT,
                NativeShellAPI.WM.SH_NOTIFY,
                1,
                new NativeShellAPI.SHChangeNotifyEntry[] { entry });
        }
Esempio n. 4
0
        public ShellBrowserUpdater(ShellBrowserComponent br)
        {
            this.br = br;
            CreateHandle(new CreateParams());

            NativeShellAPI.SHChangeNotifyEntry entry = new NativeShellAPI.SHChangeNotifyEntry();
            entry.pIdl        = br.DesktopItem.PIDLRel.Ptr;
            entry.Recursively = true;

            notifyId = NativeShellAPI.SHChangeNotifyRegister(
                this.Handle,
                NativeShellAPI.SHCNRF.InterruptLevel | NativeShellAPI.SHCNRF.ShellLevel,
                NativeShellAPI.SHCNE.ALLEVENTS | NativeShellAPI.SHCNE.INTERRUPT,
                NativeShellAPI.WM.SH_NOTIFY,
                1,
                new NativeShellAPI.SHChangeNotifyEntry[] { entry });
        }
Esempio n. 5
0
        internal ShellItem(ShellBrowserComponent browser, ShellItem parentItem, IntPtr pidl, IntPtr shellFolderPtr)
        {
            this.browser = browser;

            this.parentItem = parentItem;
            this.shellFolderPtr = shellFolderPtr;
            this.shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder));
            subFiles = new ShellItemCollection(this);
            subFolders = new ShellItemCollection(this);

            pidlRel = new PIDL(pidl, false);

            SetText(this);
            SetPath(this);
            SetAttributesFolder(this);
            SetInfo(this);                       

            sortFlag = MakeSortFlag(this);
        }
Esempio n. 6
0
        /// <summary>
        /// Initialises the base ShellItems, including the Desktop and all it's children and the children of My Computer.
        /// These items are also added to the TreeView and the navigation bar.
        /// </summary>
        private void InitBaseItems()
        {
            if (ShellBrowserComponent == null)
                ShellBrowserComponent = new ShellBrowserComponent();

            desktopNode = new TreeNode(
                ShellBrowserComponent.DesktopItem.Text,
                ShellBrowserComponent.DesktopItem.ImageIndex,
                ShellBrowserComponent.DesktopItem.SelectedImageIndex);
            desktopNode.Tag = ShellBrowserComponent.DesktopItem;
            desktopNode.Name = desktopNode.Text;

            folderView.Nodes.Add(desktopNode);
            navAddressBox.Items.Clear();
            navAddressBox.Items.Add(new BrowserComboItem(ShellBrowserComponent.DesktopItem, 0));

            navAddressBox.CurrentItem = (BrowserComboItem)navAddressBox.Items[0];
            currentDirectoryNode = desktopNode;
            currentDirectory = ShellBrowserComponent.DesktopItem;

            ShellBrowserComponent.DesktopItem.Expand(false, true, IntPtr.Zero);

            foreach (ShellItem desktopChild in ShellBrowserComponent.DesktopItem.SubFolders)
            {
                TreeNode desktopChildNode = new TreeNode(
                    desktopChild.Text,
                    desktopChild.ImageIndex,
                    desktopChild.SelectedImageIndex);
                desktopChildNode.Tag = desktopChild;
                desktopChildNode.Name = desktopChildNode.Text;

                navAddressBox.Items.Add(new BrowserComboItem(desktopChild, 1));

                if (desktopChildNode.Text == ShellBrowserComponent.MyComputerName)
                {
                    myCompNode = desktopChildNode;
                    desktopChild.Expand(false, true, IntPtr.Zero);

                    foreach (ShellItem myCompChild in desktopChild.SubFolders)
                    {
                        TreeNode myCompChildNode = new TreeNode(
                            myCompChild.Text,
                            myCompChild.ImageIndex,
                            myCompChild.SelectedImageIndex);
                        myCompChildNode.Tag = myCompChild;
                        myCompChildNode.Name = myCompChildNode.Text;

                        if (myCompChild.HasSubfolder)
                            myCompChildNode.Nodes.Add(string.Empty);

                        navAddressBox.Items.Add(new BrowserComboItem(myCompChild, 2));
                        desktopChildNode.Nodes.Add(myCompChildNode);
                    }
                }
                else if (desktopChild.HasSubfolder)
                    desktopChildNode.Nodes.Add(string.Empty);

                desktopNode.Nodes.Add(desktopChildNode);
            }
        }