Click here to Skip to main content
Click here to Skip to main content

Ebook Shelf

By , 2 Apr 2011
 
EbookShelf_1.0.6.png

Introduction

EbookShelf acts like the resource manager. It scans the directories that can be edited via config.ini to generate dynamic treeview. When the tree node is clicked, it also scans the files under such directory to generate dynamic listview. The files could be dragged from the listview then dropped to the treeview. The directory could be dragged / dropped in the treeview section. The file could be renamed and deleted, also the directory could be renamed, deleted and sub-directory created. The listview is in the smallicon view, so it needs to fix the small icons overlap issue via fired largeicon view first, then smallicon view.

Using the Code

Dynamically generated directories treeView:

  1. Declare Thread handler objTreeViewInitThread:
    Thread objTreeViewInitThread = null; 
  2. Create thread handler with callback function pointer m_treeViewInitProc:
    objTreeViewInitThread = new Thread(MainForm.m_treeViewInitProc);
    objTreeViewInitThread.IsBackground = true;
    objTreeViewInitThread.Start(this);
    objTreeViewInitThread.Join(); 
  3. Recursively travel directories tree:
    private void m_ListDirectory(TreeNode Parent, DirectoryInfo dir)
    {
        if (!dir.Exists) return;
        DirectoryInfo[] ChildDirectory;
        TreeNode node = new TreeNode();
        node.Name = dir.FullName;   // Directory full path
        node.Text = dir.Name;       // Directory folder name
        if (null == Parent)
        {
            treeView.Nodes.Add(node);
        }
        else
        {
             Parent.Nodes.Add(node);
        }
        ChildDirectory = dir.GetDirectories();
        foreach (DirectoryInfo dirInfo in ChildDirectory)
        {
             m_ListDirectory(node, dirInfo);
        }
    } 

Points of Interest

Thanks to IniParser, IconListManager, SHFileOperation to delete files and directories to trash developed by CodeProject members, I could do the stuff so quickly ^_^.

History

  • 1.0.6
    • Function:
      • Edit config.ini to set Directory
      • Support create, edit, delete and drag / drop category
      • Support edit, delete and drag / drop file
      • Support order by type and name
    • BUG:
      • It cannot refresh directories treeview or files listview when edited out of the application
      • Dragging / dropping categories, the target dropped node does not highlight
      • Click order by name first then click order by type, it failed to order by type

License

This article, along with any associated source code and files, is licensed under The MIT License

About the Author

Xiang Zhai
Marketing Linux Deepin
China China
Member
An individual human existence should be like a river - small at first, narrowly contained within its banks, and rushing passionately past boulders and over waterfalls. Gradually the river grows wider, the banks recede, the waters flow more quietly, and in the end, without any visible break, they become merged in the sea, and painlessly lose their individual being.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 4 Pinmemberweituo862 Jun '11 - 14:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 2 Apr 2011
Article Copyright 2010 by Xiang Zhai
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid