public ThemeEditorWindowContentsViewPresenter(Palette <T> palette, ThemeEditorWindowContentsView view) { _palette = palette; _view = view; var themes = _palette.Themes; themes.ObservableAdd .Subscribe(x => OnThemeAdded(x.Value)) .DisposeWith(_disposables); themes.ObservableRemove .Subscribe(x => OnThemeRemoved(x.Value)) .DisposeWith(_disposables); themes.ObservableClear .Subscribe(x => OnThemeCleared()) .DisposeWith(_disposables); // Set initial values. var sortedThemes = themes.Values.OrderBy(x => _palette.GetThemeOrder(x.Id)); foreach (var theme in sortedThemes) { var index = _palette.GetThemeOrder(theme.Id); AddTreeViewItem(theme, index); } view.TreeView.Reload(); }
public void SetActiveContentView(PaletteType paletteType) { switch (paletteType) { case PaletteType.Color: _activeWindowContentsView = _colorContentsView; break; case PaletteType.Gradient: _activeWindowContentsView = _gradientContentsView; break; case PaletteType.CharacterStyle: _activeWindowContentsView = _characterStyleContentsView; break; case PaletteType.CharacterStyleTMP: _activeWindowContentsView = _characterStyleTMPContentsView; break; default: throw new ArgumentOutOfRangeException(nameof(paletteType), paletteType, null); } _activePaletteType = paletteType; Repaint(); }
public ThemeEditorWindowContentsViewController(Palette <T> palette, EditPaletteStoreService editService, ThemeEditorWindowContentsView 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(_ => AddNewTheme()) .DisposeWith(_disposables); view.RightClickRemoveMenuClickedAsObservable .Subscribe(_ => OnRightClickRemoveMenuClicked()) .DisposeWith(_disposables); }