public FileTreeControl()
        {
            InitializeComponent();

            var viewModel = new BaseViewModel(null, false);

            viewModel.Children.Add(new DirectoryViewModel(null, MainWindow.Config.RootDirectory ?? @"C:\"));
            base.DataContext = viewModel;
        }
Esempio n. 2
0
        internal BaseViewModel(BaseViewModel parent, bool lazyLoadChildren)
        {
            _parent = parent;

            _children = new ObservableCollection<BaseViewModel>();

            if (lazyLoadChildren)
                _children.Add(DummyChild);
        }
Esempio n. 3
0
        public SearchProcessor(string searchString, List<string> exclusions, List<string> extensions, BaseViewModel directoryTree, bool isRegex, bool searchFileNames)
        {
            _searchString = searchString;
            _exclusions = exclusions;
            _extensions = extensions;
            _skippedFiles = new List<string>();
            _searchFileNames = searchFileNames;
            _isRegex = isRegex;
            if (isRegex)
                _regex = new Regex(searchString);

            _searchPaths = new List<string>();
            GenerateSearchPaths(directoryTree);
        }
Esempio n. 4
0
 private void GenerateSearchPaths(BaseViewModel root)
 {
     foreach (var node in root.Children)
     {
         // if its checked, everything below it is checked and so we don't care about its children
         if (node.IsChecked == true)
             _searchPaths.Add(node.Path);
         // null = indeterminate, so now we go and check all of its children
         else if (node.IsChecked == null)
             GenerateSearchPaths(node);
     }
 }
Esempio n. 5
0
 private void RefreshBinding_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     var viewModel = new BaseViewModel(null, false);
     viewModel.Children.Add(new DirectoryViewModel(null, MainWindow.Config.RootDirectory ?? @"C:\"));
     FileTree.DataContext = viewModel;
 }