private void DeleteFiles(bool fShiftKey)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, false);
                if (lstPaths.Count == 0)
                {
                    foreach (ToolStripItem item in this.DisplayedItems)
                    {
                        if (item.Selected)
                        {
                            QMenuItem item2 = item as QMenuItem;
                            if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                            {
                                lstPaths.Add(item2.Path);
                            }
                            break;
                        }
                    }
                }
                ShellMethods.DeleteFile(lstPaths, fShiftKey, this.hwndDialogParent);
                if (!QTUtility.IsVista)
                {
                    root.Close(ToolStripDropDownCloseReason.ItemClicked);
                }
            }
        }
        private void PasteFiles()
        {
            string path = null;

            if (fKeyTargetIsThis)
            {
                path = Path;
            }
            else
            {
                foreach (QMenuItem item in from ToolStripItem item in DisplayedItems
                         where item.Selected select item as QMenuItem)
                {
                    if (item != null)
                    {
                        if (item is SubDirTipForm.ToolStripMenuItemEx)
                        {
                            bool flag2;
                            if (PathIsExecutable(item.Path, out flag2) && !flag2)
                            {
                                StringCollection fileDropList = Clipboard.GetFileDropList();
                                if ((fileDropList != null) && (fileDropList.Count > 0))
                                {
                                    string            str2 = "\"" + fileDropList.StringJoin("\" \"") + "\"";
                                    MenuItemArguments mia  = new MenuItemArguments(item.Path, MenuTarget.File, MenuGenre.Application);
                                    mia.Argument = str2;
                                    AppLauncher.Execute(mia, fIsRootMenu ? Handle : IntPtr.Zero);
                                }
                                return;
                            }
                        }
                        else if (Directory.Exists(item.TargetPath))
                        {
                            path = item.TargetPath;
                        }
                    }
                    break;
                }
            }
            if (!string.IsNullOrEmpty(path))
            {
                ShellMethods.PasteFile(path, hwndDialogParent);
                if (QTUtility.IsXP)
                {
                    DropDownMenuDropTarget root = GetRoot(this);
                    if (root != null)
                    {
                        root.Close(ToolStripDropDownCloseReason.ItemClicked);
                    }
                }
            }
        }
Пример #3
0
        private void PasteFiles()
        {
            string pathTarget = fKeyTargetIsThis
                    ? Path
                    : (from ToolStripItem item in DisplayedItems
                       where item.Selected && item is QMenuItem
                       select((QMenuItem)item).Path).FirstOrDefault();

            if (pathTarget == null)
            {
                return;
            }
            ShellMethods.PasteFile(pathTarget, hwndDialogParent);
            if (!QTUtility.IsXP)
            {
                return;
            }
            DropDownMenuDropTarget ddmdtRoot = GetRoot(this);

            if (ddmdtRoot != null)
            {
                ddmdtRoot.Close(ToolStripDropDownCloseReason.ItemClicked);
            }
        }
        private void PasteFiles()
        {
            string path = null;

            if (this.fKeyTargetIsThis)
            {
                path = base.Path;
            }
            else
            {
                foreach (ToolStripItem item in this.DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if (item2 != null)
                    {
                        if (item2 is SubDirTipForm.ToolStripMenuItemEx)
                        {
                            bool flag2;
                            if (PathIsExecutable(item2.Path, out flag2) && !flag2)
                            {
                                StringCollection fileDropList = Clipboard.GetFileDropList();
                                if ((fileDropList != null) && (fileDropList.Count > 0))
                                {
                                    string str2 = string.Empty;
                                    foreach (string str3 in fileDropList)
                                    {
                                        str2 = str2 + "\"" + str3 + "\" ";
                                    }
                                    str2 = str2.Trim();
                                    if (str2.Length > 0)
                                    {
                                        MenuItemArguments mia = new MenuItemArguments(item2.Path, MenuTarget.File, MenuGenre.Application);
                                        mia.Argument = str2;
                                        AppLauncher.Execute(mia, this.fIsRootMenu ? base.Handle : IntPtr.Zero);
                                    }
                                }
                                return;
                            }
                        }
                        else if (Directory.Exists(item2.TargetPath))
                        {
                            path = item2.TargetPath;
                        }
                    }
                    break;
                }
            }
            if (!string.IsNullOrEmpty(path))
            {
                ShellMethods.PasteFile(path, this.hwndDialogParent);
                if (!QTUtility.IsVista)
                {
                    DropDownMenuDropTarget root = GetRoot(this);
                    if (root != null)
                    {
                        root.Close(ToolStripDropDownCloseReason.ItemClicked);
                    }
                }
            }
        }