Exemple #1
0
        private async void LoadSubDirectoriesAsync()
        {
            if (!_isExpanded || !CanAccessDirectory())
            {
                return;
            }

            SubDirectories.Clear();
            var directoryInfos = _directoryInfo.GetDirectories();
            var directories    = new List <DirectoryViewModel>();

            foreach (var directoryInfo in directoryInfos)
            {
                await Task.Run(() => directories.Add(new DirectoryViewModel(directoryInfo.FullName)));

                if (directories.Count != DIRECTORIES_PACK_LENGTH)
                {
                    continue;
                }
                foreach (var directory in directories)
                {
                    SubDirectories.Add(directory);
                }
                directories.Clear();
            }
            foreach (var directory in directories)
            {
                SubDirectories.Add(directory);
            }
        }
Exemple #2
0
        public DirInfo(FileInfo fileobj, DirInfo parent, bool isFilterActive)
            : this()
        {
            Parent  = parent;
            Name    = fileobj.Name;
            Path    = fileobj.FullName;
            Root    = parent.Root;
            DirType = ObjectType.File;
            Size    = Helpers.GetFormattedFileSize(fileobj.Length); //(fileobj.Length / 1024).ToString() + " KB";
            Ext     = fileobj.Extension + " File";
            SubDirectories.Clear();
            SetImage();
            if (FileManager.Configuration.Options.FileBrowserOptions.ShowHasExternalSubtitles || isFilterActive)
            {
                SetHasSubtitles(isFilterActive);
            }

            if (FileManager.Configuration.Options.FileBrowserOptions.ShowHasMovieInfo || isFilterActive)
            {
                SetHasMovieInfo(isFilterActive);
            }

            if (FileManager.Configuration.Options.FileBrowserOptions.ShowHasMoviesheet || isFilterActive)
            {
                SetHasMoviesheet(isFilterActive);
            }

            if (FileManager.Configuration.Options.FileBrowserOptions.ShowHasMoviesheetMetadata)
            {
                SetHasMoviesheetMetadata(isFilterActive);
            }
        }
Exemple #3
0
        public override void Dispose()
        {
            base.Dispose();

            SubDirectories?.Clear();
            SubDirectories = null;
            Files?.Clear();
            Files = null;
        }
Exemple #4
0
 public void Clean()
 {
     foreach (Directory dir in SubDirectories)
     {
         dir.Clean();
     }
     SubDirectories.Clear();
     Files.Clear();
 }
Exemple #5
0
        public void UpdateSubDirectories()
        {
            SubDirectories.Clear();
            string absolutePath = ProjectDefinitions.GetAbsolutePath(Path);

            var subDirectories = Directory.GetDirectories(absolutePath);

            foreach (string subDirectory in subDirectories)
            {
                SubDirectories.Add(new CDirectoryEntry(ProjectDefinitions.GetRelativePath(subDirectory), m_viewModel, this));
            }
        }
Exemple #6
0
        private void GetSubDirectories(string directory)
        {
            if (string.IsNullOrWhiteSpace(directory) || directory.Length < 3)
            {
                if (SubDirectories != null)
                {
                    SubDirectories.Clear();
                }
                return;
            }

            Thread thread = new Thread(GetSubDirectoriesAsync);

            thread.Start(directory);
        }
Exemple #7
0
 public void LoadDirectories(IEnumerable <DirInfo> children)
 {
     if (!IsLoaded)
     {
         SubDirectories.Clear();
         foreach (DirInfo _child in children)
         {
             _child.Parent = this;
             //_child.SetIsChecked(_child.IsChecked2, this.IsChecked2, true, false);
             SubDirectories.Add(_child);
         }
         //SubDirectories = children.ToList<DirInfo>();
     }
     IsLoaded = true;
 }
        public override void OnSelected()
        {
            base.OnSelected();
            if (HasSubDirectories && SubDirectories.Count == 1 && SubDirectories[0].Equals(dummyNode))
            {
                HasSubDirectories = EmbeddedDirectoryModel.EmbeddedDirectoryEntry.HasSubFolder;
                if (!HasSubDirectories)
                {
                    SubDirectories.Clear();
                }
            }

            //Fixed DirectoryTree Collapse unrelated directory (1)
            //SelectedDirectory now changed from here instead of DirectoryTree.xaml.cs
            (RootModel as DirectoryTreeViewModel).SelectedDirectoryModel = this;
        }
        protected override void FetchData(bool refresh)
        {
            base.FetchData(refresh);

            if (bgWorker_loadSub == null)
            {
                return;
            }

            if (!IsLoaded)
            {
                refresh = true; //Not loaded before, force refresh.
                SubDirectories.Clear();
            }

            if (refresh)
            {
                bgWorker_loadSub.RunBackgroundTask();
            }
        }