Beispiel #1
0
        public static List <ToolStripItem> CreateRecentFilesItems()
        {
            List <ToolStripItem> list  = new List <ToolStripItem>();
            List <string>        list2 = new List <string>();

            if (QTUtility.ExecutedPathsList.Count > 0)
            {
                for (int i = QTUtility.ExecutedPathsList.Count - 1; i >= 0; i--)
                {
                    string path = QTUtility.ExecutedPathsList[i];
                    if (path.StartsWith(@"\\") || File.Exists(path))
                    {
                        bool      flag;
                        QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path), out flag), MenuGenre.RecentFile);
                        item.Path = item.ToolTipText = path;
                        item.SetImageReservationKey(path, Path.GetExtension(path));
                        list.Add(item);
                    }
                    else
                    {
                        list2.Add(path);
                    }
                }
            }
            foreach (string str2 in list2)
            {
                QTUtility.ExecutedPathsList.Remove(str2);
            }
            return(list);
        }
Beispiel #2
0
        // todo: check vs quizo's
        public static List <ToolStripItem> CreateRecentFilesItems()
        {
            List <ToolStripItem> ret      = new List <ToolStripItem>();
            List <string>        toRemove = new List <string>();

            if (StaticReg.ExecutedPathsList.Count > 0)
            {
                foreach (string path in StaticReg.ExecutedPathsList.Reverse())
                {
                    if (QTUtility2.IsNetworkPath(path) || File.Exists(path))
                    {
                        QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path)), MenuGenre.RecentFile);
                        item.Path = item.ToolTipText = path;
                        item.SetImageReservationKey(path, Path.GetExtension(path));
                        ret.Add(item);
                    }
                    else
                    {
                        toRemove.Add(path);
                    }
                }
            }
            foreach (string str in toRemove)
            {
                StaticReg.ExecutedPathsList.Remove(str);
            }
            return(ret);
        }
Beispiel #3
0
        // TODO: this is absent from Quizo's sources.  Figure out why.
        private static void AddChildrenOnOpening(DirectoryMenuItem parentItem)
        {
            bool          fTruncated;
            DirectoryInfo info      = new DirectoryInfo(parentItem.Path);
            EventPack     eventPack = parentItem.EventPack;

            foreach (DirectoryInfo info2 in info.GetDirectories()
                     .Where(info2 => (info2.Attributes & FileAttributes.Hidden) == 0))
            {
                string text = QTUtility2.MakeNameEllipsis(info2.Name, out fTruncated);
                DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
                reorderable.MessageParent     = eventPack.MessageParentHandle;
                reorderable.ItemRightClicked += eventPack.ItemRightClickEventHandler;
                reorderable.ImageList         = QTUtility.ImageListGlobal;
                DirectoryMenuItem item = new DirectoryMenuItem(text);
                item.SetImageReservationKey(info2.FullName, null);
                item.Path         = info2.FullName;
                item.EventPack    = eventPack;
                item.ModifiedDate = info2.LastWriteTime;
                if (fTruncated)
                {
                    item.ToolTipText = info2.Name;
                }
                item.DropDown           = reorderable;
                item.DoubleClickEnabled = true;
                item.DropDownItems.Add(new ToolStripMenuItem());
                item.DropDownItemClicked += realDirectory_DropDownItemClicked;
                item.DropDownOpening     += realDirectory_DropDownOpening;
                item.DoubleClick         += eventPack.DirDoubleClickEventHandler;
                parentItem.DropDownItems.Add(item);
            }
            foreach (FileInfo info3 in info.GetFiles()
                     .Where(info3 => (info3.Attributes & FileAttributes.Hidden) == 0))
            {
                string fileNameWithoutExtension;
                string ext = info3.Extension.ToLower();
                switch (ext)
                {
                case ".lnk":
                case ".url":
                    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(info3.Name);
                    break;

                default:
                    fileNameWithoutExtension = info3.Name;
                    break;
                }
                string    str4  = fileNameWithoutExtension;
                QMenuItem item2 = new QMenuItem(QTUtility2.MakeNameEllipsis(fileNameWithoutExtension, out fTruncated), MenuTarget.File, MenuGenre.Application);
                item2.Path = info3.FullName;
                item2.SetImageReservationKey(info3.FullName, ext);
                item2.MouseMove += qmi_File_MouseMove;
                if (fTruncated)
                {
                    item2.ToolTipText = str4;
                }
                parentItem.DropDownItems.Add(item2);
            }
        }