Example #1
0
        public void SetTree(TreeDirectory root, TreeListBoxMode mode)
        {
            BeginUpdate();
            ShowTreeLines =
                mode != TreeListBoxMode.ShowPlainFileList &&
                mode != TreeListBoxMode.ShowDirectoryContent;
            ShowRootTreeLines = mode != TreeListBoxMode.ShowDirectoryTree;
            if (_binding != null)
            {
                _binding.Dispose();
                _binding    = null;
                _repository = null;
            }
            if (root != null)
            {
                switch (mode)
                {
                case TreeListBoxMode.ShowFullTree:
                    _binding = new TreeBinding(Items, root, false);
                    break;

                case TreeListBoxMode.ShowPlainFileList:
                    _binding = new TreeBinding(Items, root, true);
                    break;

                case TreeListBoxMode.ShowDirectoryContent:
                    _binding = new TreeBinding(Items, root, false, true);
                    break;

                case TreeListBoxMode.ShowDirectoryTree:
                    _binding = new TreeDirectoriesBinding(Items, root, true);
                    break;

                default:
                    throw new ArgumentException("Invalid mode.", "mode");
                }
                _repository = root.Repository;
            }
            EndUpdate();
        }
Example #2
0
 public void SetTree(TreeDirectory root, TreeListBoxMode mode)
 {
     BeginUpdate();
     ShowTreeLines =
         mode != TreeListBoxMode.ShowPlainFileList &&
         mode != TreeListBoxMode.ShowDirectoryContent;
     ShowRootTreeLines = mode != TreeListBoxMode.ShowDirectoryTree;
     if(_binding != null)
     {
         _binding.Dispose();
         _binding = null;
         _repository = null;
     }
     if(root != null)
     {
         switch(mode)
         {
             case TreeListBoxMode.ShowFullTree:
                 _binding = new TreeBinding(Items, root, false);
                 break;
             case TreeListBoxMode.ShowPlainFileList:
                 _binding = new TreeBinding(Items, root, true);
                 break;
             case TreeListBoxMode.ShowDirectoryContent:
                 _binding = new TreeBinding(Items, root, false, true);
                 break;
             case TreeListBoxMode.ShowDirectoryTree:
                 _binding = new TreeDirectoriesBinding(Items, root, true);
                 break;
             default:
                 throw new ArgumentException("Invalid mode.", "mode");
         }
         _repository = root.Repository;
     }
     EndUpdate();
 }