Ejemplo n.º 1
0
        // async test1
        public void test1()
        {
            //IEnumerable<int> GenerateWithYield()
            //{
            //    var i = 0;
            //    while (i < 5)
            //    {
            //        yield return ++i;
            //        yield return i + 2;
            //    }
            //}

            //foreach (var number in GenerateWithYield())
            //    Console.WriteLine(number);
            var subdirs = DirInfo.GetDirectories();

            IEnumerable <int> GenerateWithYield()
            {
                yield return(1);
            }

            foreach (var dir in subdirs)
            {
                FolderSelector child = new FolderSelector(dir.FullName);
                myParents[child.DirInfo.FullName] = this;
                Children.Add(child);
            }
        }
Ejemplo n.º 2
0
        void autoCheck(FolderSelector fs, bool?b)
        {
            fs.IsChecked = b;

            for (int i = 0; i < fs.Children.Count; i++)
            {
                autoCheck(fs.Children[i], b);
            }
        }
Ejemplo n.º 3
0
        // async test
        public void test()
        {
            var subdirs = DirInfo.GetDirectories();

            foreach (var dir in subdirs)
            {
                FolderSelector child = new FolderSelector(dir.FullName);
                myParents[child.DirInfo.FullName] = this;
                Children.Add(child);
            }
        }
Ejemplo n.º 4
0
        //public ObservableCollection<EmptyFolderSelectorVM> FolderSelectorVMs = new ObservableCollection<EmptyFolderSelectorVM>();

        public EmptyFolderSelectorVM()
        {
            FolderSelectors = new ObservableCollection <FolderSelector>();
            folderSelector  = new FolderSelector(FolderPath);
            FolderSelectors.Add(folderSelector);

            onDefault    = new RelayCommand(CheckDefault);
            OnCheckAll   = new RelayCommand(CheckAll);
            OnUnCheckAll = new RelayCommand(UnCheckAll);
            OnRemove     = new RelayCommand(RemoveSelectedFolders);

            // init state
            UnCheckAll();
        }
Ejemplo n.º 5
0
        bool checkEmptyFoldersOnly(FolderSelector fs)
        {
            bool containsFile = fs.DirInfo.GetFiles().Length > 0;

            if (fs.Children.Count != 0)
            {
                // DFS
                //containsFile |= fs.DirInfo.GetFiles().Length > 0;
                for (int i = 0; i < fs.Children.Count; ++i)
                {
                    var c = fs.Children[i];
                    containsFile |= checkEmptyFoldersOnly(c);
                }
            }
            fs.IsChecked = !containsFile;
            return(containsFile);
        }