public CtlEditorShortcut(GroupEditor groupEditor, Shortcut shortcut)
        {
            InitializeComponent();
            GroupEditor = groupEditor;
            Shortcut    = shortcut;

            string imageExtension = Path.GetExtension(Shortcut.FilePath).ToLower();

            // Checks if the shortcut actually exists; if not then display an error image
            if (File.Exists(Shortcut.FilePath))
            {
                if (imageExtension == ".lnk")
                {
                    LblShortcut.Content = HandleExtensionName(Shortcut.FilePath);
                    ImgShortcut.Source  = GroupEditor.HandleSpecialImageExtensions(Shortcut.FilePath, imageExtension);
                }
                else
                {
                    LblShortcut.Content = Path.GetFileNameWithoutExtension(Shortcut.FilePath);
                    ImgShortcut.Source  = new BitmapImage(new Uri($@"{Paths.GroupsPath}\{Name}\GroupImage.png"));
                }
            }
            else if (Directory.Exists(Shortcut.FilePath))
            {
                LblShortcut.Content = Path.GetFileName(Shortcut.FilePath);
                ImgShortcut.Source  = HandleFolder.GetFolderImage(Shortcut.FilePath);
            }
            else
            {
                ImgShortcut.Source = Paths.GetResource("Error");
            }
        }
Example #2
0
 private void PreOrderTraverse(HandleFolder folderHandler, FolderNode currentNode)
 {
     folderHandler(currentNode);
     foreach (FolderNode folder in currentNode.Folders)
     {
         PreOrderTraverse(folderHandler, folder);
     }
 }
Example #3
0
        public bool Traverse(TraverseType typeOfTraversal, HandleFolder folderHandler)
        {
            bool traverseResult = false;
            if (Ready)
            {
                switch (typeOfTraversal)
                {
                    case TraverseType.PreOrder:

                        PreOrderTraverse(folderHandler, root);
                        traverseResult = true;
                        break;

                    case TraverseType.PostOrder:

                        PostOrderTraverse(folderHandler, root);
                        traverseResult = true;
                        break;
                }
            }
            return traverseResult;
        }