Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellFolderImpl"/> class.
        /// This class must be initialised with a reference to the Shell Namespace Extension
        /// that is being used and the target object (which will be an <see cref="IShellNamespaceFolder" />.
        /// </summary>
        /// <param name="namespaceExtension">The namespace extension.</param>
        /// <param name="proxyFolder">The folder that we are acting as an implementation for.</param>
        public ShellFolderImpl(SharpNamespaceExtension namespaceExtension, IShellNamespaceFolder proxyFolder)
        {
            //  Store the namespace extension and folder.
            this.namespaceExtension = namespaceExtension;
            this.proxyFolder        = proxyFolder;

            //  Create the lazy folder view.
            lazyFolderView = new Lazy <ShellNamespaceFolderView>(proxyFolder.GetView);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellFolderImpl"/> class.
        /// This class must be initialised with a reference to the Shell Namespace Extension
        /// that is being used and the target object (which will be an <see cref="IShellNamespaceFolder" />.
        /// </summary>
        /// <param name="namespaceExtension">The namespace extension.</param>
        /// <param name="proxyFolder">The folder that we are acting as an implementation for.</param>
        public ShellFolderImpl(SharpNamespaceExtension namespaceExtension, IShellNamespaceFolder proxyFolder)
        {
            //  Store the namespace extension and folder.
            this.namespaceExtension = namespaceExtension;
            this.proxyFolder = proxyFolder;

            //  Create the lazy folder view.
            lazyFolderView = new Lazy<ShellNamespaceFolderView>(proxyFolder.GetView);
        }
        public ShellNamespaceFolderIdListEnumerator(IShellNamespaceFolder shellNamespaceFolder, SHCONTF grfFlags, uint index)
        {
            //  todo: The flags should be a type in the sharpshell domain, not the shell.
            //  todo the flags might change how we have to do this.
            //  Store the extension for the folder we're enuerating.
            this.shellNamespaceFolder = shellNamespaceFolder;

            this.currentIndex = index;
            this.flags = grfFlags;
            //  Map the flags.
            //  TODO: more to be done here.
            _shellNamespaceEnumerationFlags = 0;
            if (grfFlags.HasFlag(SHCONTF.SHCONTF_FOLDERS))
                _shellNamespaceEnumerationFlags |= ShellNamespaceEnumerationFlags.Folders;
            if (grfFlags.HasFlag(SHCONTF.SHCONTF_NONFOLDERS))
                _shellNamespaceEnumerationFlags |= ShellNamespaceEnumerationFlags.Items;
        }
Пример #4
0
        private static IShellNamespaceFolder GetChildFolder(IShellNamespaceFolder folder, ShellId itemId)
        {
            //  Get the item that is represented by the shell id.
            var childFolder = folder
                              .GetChildren(ShellNamespaceEnumerationFlags.Folders)
                              .OfType <IShellNamespaceFolder>()
                              .SingleOrDefault(i => i.GetShellId().Equals(itemId));

            //  If we don't find the item, we've got a problem.
            if (childFolder == null)
            {
                //  TODO how will we handle this error?
                var me  = folder.GetDisplayName(DisplayNameContext.Normal);
                var you = itemId.ToString();
                return(null);
            }
            return(childFolder);
        }
        public ShellNamespaceFolderIdListEnumerator(IShellNamespaceFolder shellNamespaceFolder, SHCONTF grfFlags, uint index)
        {
            //  todo: The flags should be a type in the sharpshell domain, not the shell.
            //  todo the flags might change how we have to do this.
            //  Store the extension for the folder we're enuerating.
            this.shellNamespaceFolder = shellNamespaceFolder;

            this.currentIndex = index;
            this.flags        = grfFlags;
            //  Map the flags.
            //  TODO: more to be done here.
            _shellNamespaceEnumerationFlags = 0;
            if (grfFlags.HasFlag(SHCONTF.SHCONTF_FOLDERS))
            {
                _shellNamespaceEnumerationFlags |= ShellNamespaceEnumerationFlags.Folders;
            }
            if (grfFlags.HasFlag(SHCONTF.SHCONTF_NONFOLDERS))
            {
                _shellNamespaceEnumerationFlags |= ShellNamespaceEnumerationFlags.Items;
            }
        }
Пример #6
0
        private static IShellNamespaceFolder GetChildFolder(IShellNamespaceFolder folder, ShellId itemId)
        {
            //  Get the item that is represented by the shell id.
            var childFolder = folder
                .GetChildren(ShellNamespaceEnumerationFlags.Folders)
                .OfType<IShellNamespaceFolder>()
                .SingleOrDefault(i => i.GetShellId().Equals(itemId));

            //  If we don't find the item, we've got a problem.
            if (childFolder == null)
            {
                //  TODO how will we handle this error?
                var me = folder.GetDisplayName(DisplayNameContext.Normal);
                var you = itemId.ToString();
                return null;
            }
            return childFolder;
        }