Пример #1
0
        private ListViewItem StartItemToListItem(StartItem startItem, bool setIcon)
        {
            ListViewItem listItem;

            string[] validPaths = startItem.GetValidPaths();
            string path = (validPaths.Length >= 1) ? validPaths[0] : "";

            if (startItem.Type == StartItemType.File)
            {
                listItem = new ListViewItem(new string[] { Path.GetFileNameWithoutExtension(startItem.Name), startItem.Location.ToString(), startItem.Application });
            }
            else
            {
                listItem = new ListViewItem(new string[] { Path.GetFileNameWithoutExtension(startItem.Name), startItem.Location.ToString(), startItem.Application });
            }

            listItem.SubItems[1].ForeColor = SystemColors.GrayText;
            listItem.SubItems[2].ForeColor = SystemColors.GrayText;

            listItem.Tag = startItem;
            listItem.Name = startItem.Name;

            if (setIcon)
            {
                listItem.ImageIndex = largeListIconList.IconIndex(path, true, ShellIconStateConstants.ShellIconStateNormal);
            }
            else
            {
                lock (iconInfoLock)
                {
                    iconInfo.Add(listItem, path);
                }
            }

            return listItem;
        }
Пример #2
0
 private void LocateOnDisk(StartItem item)
 {
     string[] validPaths = item.GetValidPaths();
     for (int i = 0; i < validPaths.Length; i++)
     {
         LocateOnDisk(validPaths[i]);
     }
 }