public void Initialize(FileExplorerViewModel fileExplorerViewModel)
        {
            _fileExplorerViewModel = fileExplorerViewModel;

            Entries   = new EntriesHelper <DirectoryViewModel>();
            Selection = new TreeRootSelector <DirectoryViewModel, FileExplorerEntry>(Entries)
            {
                Comparers = new[]
                { _fileExplorerPathComparer = new FileExplorerPathComparer(fileExplorerViewModel.FileSystem) }
            };

            Selection.AsRoot().SelectionChanged += OnSelectionChanged;
            _fileExplorerViewModel.PathChanged += FileExplorerViewModelOnPathChanged;
        }
Exemple #2
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 #3
0
        public BreadcrumbViewModel(IEventAggregator events)
        {
            _events = events;

            if (events != null)
            {
                events.Subscribe(this);
            }

            Entries = new EntriesHelper <IBreadcrumbItemViewModel>();
            var selection = new TreeRootSelector <IBreadcrumbItemViewModel, IEntryModel>(Entries)
            {
                Comparers = new[] { PathComparer.LocalDefault }
            };

            selection.SelectionChanged += (o, e) =>
            {
                BroadcastDirectoryChanged(EntryViewModel.FromEntryModel(selection.SelectedValue));
            };
            Selection = selection;
            Commands  = new BreadcrumbCommandManager(this, events);
        }