예제 #1
0
        /// <summary>Initialises a new instance of the <see cref="ShellContextMenu"/> class.</summary>
        /// <param name="items">The items to which the context menu should refer.</param>
        public ShellContextMenu(ShellItem[] items)
        {
            var         pidls  = new IntPtr[items.Length];
            ShellFolder parent = null;

            for (var n = 0; n < items.Length; ++n)
            {
                pidls[n] = ILFindLastID((IntPtr)items[n].PIDL);

                if (parent is null)
                {
                    if (items[n] == ShellFolder.Desktop)
                    {
                        parent = ShellFolder.Desktop;
                    }
                    else
                    {
                        parent = items[n].Parent;
                    }
                }
                else
                {
                    if (items[n].Parent != parent)
                    {
                        throw new Exception("All shell items must have the same parent");
                    }
                }
            }

            ComInterface    = parent.IShellFolder.GetUIObjectOf <IContextMenu>(HWND.NULL, pidls);
            m_ComInterface2 = ComInterface as IContextMenu2;
            m_ComInterface3 = ComInterface as IContextMenu3;
            m_MessageWindow = new MessageWindow(this);
        }
예제 #2
0
 /// <summary>Initializes a new instance of the <see cref="ShellDataTable"/> class with the items from a shell folder.</summary>
 /// <param name="folder">The folder whose items are to be retrieved.</param>
 /// <param name="filter">The filter to determine which child items of the folder are enumerated.</param>
 public ShellDataTable(ShellFolder folder, FolderItemFilter filter = FolderItemFilter.Folders | FolderItemFilter.NonFolders) : base(folder.ParsingName)
 {
     itemFilter          = filter;
     BuildColumns(parent = folder);
 }
예제 #3
0
파일: ShellView.cs 프로젝트: thexur/Vanara
 /// <summary>Initializes a new instance of the <see cref="NavigatedEventArgs"/> class.</summary>
 /// <param name="folder">The folder.</param>
 public NavigatedEventArgs(ShellFolder folder) => NewLocation = folder;
예제 #4
0
 /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
 /// <param name="libraryName">Name of the library.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
 public ShellLibrary(string libraryName, ShellFolder parent, bool overwrite = false)
 {
     lib  = new IShellLibrary();
     name = libraryName;
     lib.Save(parent.iShellItem, libraryName, overwrite ? LIBRARYSAVEFLAGS.LSF_OVERRIDEEXISTING : LIBRARYSAVEFLAGS.LSF_FAILIFTHERE);
 }
예제 #5
0
 /// <summary>Initializes a new instance of the <see cref="ShellLink"/> class, which acts as a wrapper for a .lnk file.</summary>
 /// <param name="linkFile">The shortcut file (.lnk) to load.</param>
 /// <param name="window">
 /// The window that the Shell will use as the parent for a dialog box. The Shell displays the dialog box if it needs to prompt the user for more
 /// information while resolving a Shell link.
 /// </param>
 /// <param name="resolveFlags">The resolve flags.</param>
 /// <param name="timeOut">The time out.</param>
 /// <exception cref="System.ArgumentNullException">linkFile</exception>
 public ShellLink(string linkFile, LinkResolution resolveFlags = LinkResolution.NoUI, IWin32Window window = null, TimeSpan timeOut = default) : base(linkFile)
 {
     LoadAndResolve(linkFile, (SLR_FLAGS)resolveFlags, ShellFolder.IWin2Ptr(window), (ushort)timeOut.TotalMilliseconds);
 }