Beispiel #1
0
        /// <summary>
        /// Create a simple search folder. Once the appropriate parameters are set,
        /// the search folder can be enumerated to get the search results.
        /// </summary>
        /// <param name="searchCondition">Specific condition on which to perform the search (property and expected value)</param>
        /// <param name="searchScopePath">List of folders/paths to perform the search on. These locations need to be indexed by the system.</param>
        public ShellSearchFolder(SearchCondition searchCondition, params ShellItem[] searchScopePath)
        {
            NativeSearchFolderItemFactory = (ISearchFolderItemFactory) new SearchFolderItemFactoryCoClass();
            this.SearchCondition          = searchCondition;

            if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null)
            {
                this.SearchScopePaths = searchScopePath.Select(cont => cont.ParsingName);
            }
            ComInterface = this.m_SearchComInterface;
        }
        /// <summary>
        /// Create a simple search folder. Once the appropriate parameters are set,
        /// the search folder can be enumerated to get the search results.
        /// </summary>
        /// <param name="searchCondition">Specific condition on which to perform the search (property and expected value)</param>
        /// <param name="searchScopePath">List of folders/paths to perform the search on. These locations need to be indexed by the system.</param>
        public ShellSearchFolder(SearchCondition searchCondition, params ShellItem[] searchScopePath)
        {
            NativeSearchFolderItemFactory = (ISearchFolderItemFactory)new SearchFolderItemFactoryCoClass();
            this.SearchCondition = searchCondition;

            if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null)
            {
                this.SearchScopePaths = searchScopePath.Select(cont => cont.ParsingName);
            }
            ComInterface = this.m_SearchComInterface;
        }
Beispiel #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // File dialog drag and drop feature requires OLE
            var pSearchFolderItemFactory = new ISearchFolderItemFactory();
            var psiaScope = CreateScope();

            pSearchFolderItemFactory.SetScope(psiaScope);
            // Sets the display name of the search
            pSearchFolderItemFactory.SetDisplayName("Sample Query");
            var pCondition = GetCondition();

            // Sets the condition for pSearchFolderItemFactory
            pSearchFolderItemFactory.SetCondition(pCondition);
            // This retrieves an IShellItem of the search.  It is a virtual child of the desktop.
            var pShellItemSearch = pSearchFolderItemFactory.GetShellItem <IShellItem>();

            OpenCommonFileDialogTo(pShellItemSearch);
        }