Exemple #1
0
        public RegistryTreeViewModel(RegistryCommand registryCommand)
        {
            Entries   = new EntriesHelper <SubKeyNodeViewModel>();
            Selection = new TreeRootSelector <SubKeyNodeViewModel, AdvancedRegistrySubKey>(Entries)
            {
                Comparers = new[] { new RegistryPathComparer() }
            };

            var hiveEntries = new List <RegistryHive>
            {
                RegistryHive.ClassesRoot,
                RegistryHive.CurrentUser,
                RegistryHive.LocalMachine,
                RegistryHive.Users,
                RegistryHive.CurrentConfig
            };

            Entries.SetEntries(UpdateMode.Replace,
                               hiveEntries.ToDictionary(x => x, y => y.ToReadableString()).Select(
                                   x =>
                                   new SubKeyNodeViewModel(this,
                                                           new AdvancedRegistrySubKey
            {
                IsEmpty      = false,
                Name         = x.Value,
                Path         = x.Value,
                RegistryHive = x.Key,
                RelativePath = ""
            }, null, registryCommand)).ToArray());
        }
        public TreeViewModel()
        {
            //Submodel is TreeNodeViewModel,
            Entries = new EntriesHelper <TreeNodeViewModel>();
            //Value is based on string
            Selection = new TreeRootSelector <TreeNodeViewModel, string>(Entries)
            {
                Comparers = new[] { this }
            };

            Entries.SetEntries(UpdateMode.Update, new TreeNodeViewModel("", "Root", this, null));
        }
Exemple #3
0
        public RegistryTreeViewModel(ITargetedRestClient restClient, IShellStatusBar statusBar)
        {
            _restClient = restClient;
            _statusBar  = statusBar;
            Entries     = new EntriesHelper <RegistryKeyViewModel>();
            Selection   = new TreeRootSelector <RegistryKeyViewModel, IntegratedRegistryKey>(Entries)
            {
                Comparers = new[] { new RegistryPathComparer() }
            };

            Entries.SetEntries(new[]
            {
                RegistryHive.ClassesRoot, RegistryHive.CurrentUser, RegistryHive.LocalMachine, RegistryHive.Users, RegistryHive.CurrentUser
            }.Select(CreateHiveViewModel));
        }
Exemple #4
0
        public DirectoryViewModel(DirectoryTreeViewModel rootViewModel, DirectoryViewModel parentViewModel,
                                  DirectoryEntry directoryEntry, IFileSystem fileSystem, IUiTools uiTools) : this(directoryEntry, fileSystem,
                                                                                                                  uiTools, true)
        {
            _rootViewModel = rootViewModel;
            Parent         = parentViewModel;

            Entries   = new EntriesHelper <DirectoryViewModel>(LoadEntriesAsync);
            Selection = new TreeSelector <DirectoryViewModel, FileExplorerEntry>(Source, this,
                                                                                 parentViewModel?.Selection ?? rootViewModel.Selection, Entries);

            if (!directoryEntry.HasSubFolder)
            {
                Entries.SetEntries(ImmutableList <DirectoryViewModel> .Empty);
            }
        }
Exemple #5
0
        public SubKeyNodeViewModel(RegistryTreeViewModel rootTreeViewModel, AdvancedRegistrySubKey currentEntry,
                                   SubKeyNodeViewModel parentViewModel, RegistryCommand registryCommand)
        {
            _rootTreeViewModel = rootTreeViewModel;
            _registryCommand   = registryCommand;
            Parent             = parentViewModel;
            Value          = currentEntry;
            IsRegistryHive = string.IsNullOrEmpty(Value.RelativePath);

            Entries   = new EntriesHelper <SubKeyNodeViewModel>(LoadSubEntries);
            Selection = new TreeSelector <SubKeyNodeViewModel, AdvancedRegistrySubKey>(Value, this,
                                                                                       parentViewModel == null ? rootTreeViewModel.Selection : parentViewModel.Selection, Entries);

            if (Value.IsEmpty)
            {
                Entries.SetEntries(UpdateMode.Update);
            }
        }
Exemple #6
0
        public DirectoryNodeViewModel(DirectoryTreeViewModel rootTreeViewModel, PackedDirectoryEntry currentEntry,
                                      DirectoryNodeViewModel parentModel, IFileSystem fileSystem, Func <IWindowService> getWindow) : this(currentEntry, fileSystem)
        {
            _rootModel = rootTreeViewModel;
            _getWindow = getWindow;

            Parent    = parentModel;
            Entries   = new EntriesHelper <DirectoryNodeViewModel>(LoadEntriesTask);
            Selection = new TreeSelector <DirectoryNodeViewModel, IFileExplorerEntry>(Value, this,
                                                                                      parentModel == null ? rootTreeViewModel.Selection : parentModel.Selection, Entries);

            _isNodeViewModel = true;

            if (!Value.HasSubFolder)
            {
                Entries.SetEntries(UpdateMode.Update);
            }
        }
        public RegistryKeyViewModel(RegistryTreeViewModel rootTreeViewModel, IntegratedRegistryKey registryKey, ITargetedRestClient restClient,
                                    IShellStatusBar statusBar, RegistryKeyViewModel parentViewModel)
        {
            RegistryKey        = registryKey;
            _rootTreeViewModel = rootTreeViewModel;
            _restClient        = restClient;
            _statusBar         = statusBar;
            Parent             = parentViewModel;

            Entries   = new EntriesHelper <RegistryKeyViewModel>(LoadSubKeys);
            Selection = new TreeSelector <RegistryKeyViewModel, IntegratedRegistryKey>(registryKey, this,
                                                                                       parentViewModel == null ? rootTreeViewModel.Selection : parentViewModel.Selection, Entries);

            if (!registryKey.HasSubKeys)
            {
                Entries.SetEntries(Enumerable.Empty <RegistryKeyViewModel>());
            }
        }