예제 #1
0
        public override ObservableCollection <INavigationTreeItem> GetMyChildren()
        {
            ObservableCollection <INavigationTreeItem> childrenList = new ObservableCollection <INavigationTreeItem>();

            INavigationTreeItem item;

            string fn = GetFolderPath(SpecialFolder.UserProfile);

            fn = fn + "\\Links";

            try
            {
                DirectoryInfo dirInfo = new DirectoryInfo(fn);
                if (!dirInfo.Exists)
                {
                    return(childrenList);
                }

                string fileResolvedShortCut = "";

                foreach (FileInfo finfo in dirInfo.GetFiles())
                {
                    if (finfo.Name.ToUpper().EndsWith(".LNK"))
                    {
                        fileResolvedShortCut = FolderUtil.ResolveShortCut(finfo.FullName);
                        if (!String.IsNullOrEmpty(fileResolvedShortCut))
                        {
                            FileInfo fileInfo = new FileInfo(fileResolvedShortCut);

                            item = new NavigationFileItem();
                            item.FriendlyName = fileInfo.Name != string.Empty ? fileInfo.Name : fileInfo.ToString();
                            item.FullPathName = fileInfo.FullName;

                            childrenList.Add(item);
                        }
                    }
                }
            }


            catch { }

            return(childrenList);
        }