public PaletteEditorWindowContentsViewPresenter(Palette <T> palette, PaletteEditorWindowContentsView <T> view)
        {
            _palette = palette;
            _view    = view;

            // Observe Entries.
            var entries = _palette.Entries;

            entries.ObservableAdd.Subscribe(x => OnEntryAdded(x.Value)).DisposeWith(_disposables);
            entries.ObservableRemove.Subscribe(x => OnEntryRemoved(x.Value)).DisposeWith(_disposables);
            entries.ObservableClear.Subscribe(x => OnEntryCleared()).DisposeWith(_disposables);

            // Observe Themes.
            _palette.Themes.ObservableAdd
            .Subscribe(x => OnThemesChanged())
            .DisposeWith(_disposables);

            _palette.Themes.ObservableRemove
            .Subscribe(x => OnThemesChanged())
            .DisposeWith(_disposables);

            _palette.Themes.ObservableClear
            .Subscribe(x => OnThemesChanged())
            .DisposeWith(_disposables);

            _palette.Themes.ObservableReplace
            .Subscribe(x => OnThemesChanged())
            .DisposeWith(_disposables);

            _palette.ThemeOrderChangedAsObservable
            .Subscribe(_ => OnThemeOrderChanged())
            .DisposeWith(_disposables);

            _palette.ActiveTheme
            .Subscribe(_ => OnThemeOrderChanged())
            .DisposeWith(_disposables);

            // Set initial values.
            RefreshTreeViewColumns();
            var sortedEntries = entries.Values.OrderBy(x => _palette.GetEntryOrder(x.Id));

            foreach (var entry in sortedEntries)
            {
                var index = _palette.GetEntryOrder(entry.Id);
                AddTreeViewItem(entry, index);
            }

            view.TreeView.Reload();
        }
        public PaletteEditorWindowContentsViewController(Palette <T> palette, EditPaletteStoreService editService,
                                                         PaletteEditorWindowContentsView <T> view)
        {
            _palette     = palette;
            _editService = editService;
            _view        = view;

            var treeView = _view.TreeView;

            treeView.OnItemAddedAsObservable()
            .Subscribe(OnItemAdded)
            .DisposeWith(_disposables);

            treeView.OnItemRemovedAsObservable()
            .Subscribe(OnItemRemoved)
            .DisposeWith(_disposables);

            treeView.OnItemClearedAsObservable()
            .Subscribe(_ => OnItemCleared())
            .DisposeWith(_disposables);

            treeView.ItemIndexChangedAsObservable
            .Subscribe(x => ItemIndexChanged(x.item, x.newIndex))
            .DisposeWith(_disposables);

            view.RightClickCreateMenuClickedAsObservable
            .Subscribe(_ => AddNewEntry())
            .DisposeWith(_disposables);

            view.RightClickRemoveMenuClickedAsObservable
            .Subscribe(_ => OnRightClickRemoveMenuClicked())
            .DisposeWith(_disposables);

            view.RightClickHighlightMenuClickedAsObservable
            .Subscribe(_ => HighlightSelectedEntries())
            .DisposeWith(_disposables);
        }