private void SetupEmptyView(ThemeEditorWindow view)
        {
            _colorContentsViewController?.Dispose();
            _gradientContentsViewController?.Dispose();
            _characterStyleContentsViewController?.Dispose();
            _characterStyleTMPContentsViewController?.Dispose();
            _emptyViewController?.Dispose();

            _emptyViewController = new ThemeEditorWindowEmptyViewController(view.EmptyView);
        }
Beispiel #2
0
        private void SetupEmptyView(ThemeEditorWindow view)
        {
            _colorContentsViewPresenter?.Dispose();
            _gradientContentsViewPresenter?.Dispose();
            _characterStyleContentsViewPresenter?.Dispose();
            _characterStyleTMPContentsViewPresenter?.Dispose();
            _emptyViewPresenter?.Dispose();

            _emptyViewPresenter = new ThemeEditorEmptyViewPresenter(view.EmptyView);

            view.SetMode(ThemeEditorWindow.Mode.Empty);
        }
        public ThemeEditorWindowController(PaletteStoreRepository storeRepository, UPaletteEditorGUIState guiState,
                                           ThemeEditorWindow view)
        {
            _guiState = guiState;

            view.UndoShortcutExecutedAsObservable
            .Subscribe(_ => OnUndoCommandExecuted())
            .DisposeWith(_disposables);

            view.RedoShortcutExecutedAsObservable
            .Subscribe(_ => OnRedoCommandExecuted())
            .DisposeWith(_disposables);

            view.RemoveShortcutExecutedAsObservable
            .Subscribe(_ => _activeContentsViewController.OnRemoveShortcutExecuted())
            .DisposeWith(_disposables);

            view.SelectedPaletteTypeChangedAsObservable
            .Subscribe(OnActivePaletteTypeChanged)
            .DisposeWith(_disposables);

            view.CreateButtonClickedAsObservable
            .Subscribe(_ => OnCreateButtonClicked())
            .DisposeWith(_disposables);

            view.LostFocusAsObservable
            .Subscribe(_ => OnLostFocus())
            .DisposeWith(_disposables);

            guiState.ActivePaletteType
            .Subscribe(x => _activeContentsViewController = GetPerTypeController(x))
            .DisposeWith(_disposables);

            storeRepository.Store.Subscribe(x =>
            {
                if (x == null)
                {
                    SetupEmptyView(view);
                }
                else
                {
                    SetupContentsView(x, view);
                }
            }).DisposeWith(_disposables);
        }
Beispiel #4
0
        private void SetupContentsView(PaletteStore store, ThemeEditorWindow view)
        {
            _colorContentsViewPresenter?.Dispose();
            _gradientContentsViewPresenter?.Dispose();
            _characterStyleContentsViewPresenter?.Dispose();
            _characterStyleTMPContentsViewPresenter?.Dispose();
            _emptyViewPresenter?.Dispose();

            _colorContentsViewPresenter =
                new ThemeEditorWindowContentsViewPresenter <Color>(store.ColorPalette, view.ColorContentsView);
            _gradientContentsViewPresenter =
                new ThemeEditorWindowContentsViewPresenter <Gradient>(store.GradientPalette,
                                                                      view.GradientContentsView);
            _characterStyleContentsViewPresenter =
                new ThemeEditorWindowContentsViewPresenter <CharacterStyle>(store.CharacterStylePalette,
                                                                            view.CharacterStyleContentsView);
            _characterStyleTMPContentsViewPresenter =
                new ThemeEditorWindowContentsViewPresenter <CharacterStyleTMP>(store.CharacterStyleTMPPalette,
                                                                               view.CharacterStyleTMPContentsView);

            view.SetMode(ThemeEditorWindow.Mode.Contents);
        }
Beispiel #5
0
        public ThemeEditorWindowPresenter(PaletteStoreRepository storeRepository, UPaletteEditorGUIState guiState,
                                          ThemeEditorWindow view)
        {
            _guiState = guiState;

            _guiState.ActivePaletteType
            .Subscribe(view.SetActiveContentView)
            .DisposeWith(_disposables);

            view.SetActiveContentView(_guiState.ActivePaletteType.Value);

            storeRepository.Store.Subscribe(x =>
            {
                if (x == null)
                {
                    SetupEmptyView(view);
                }
                else
                {
                    SetupContentsView(x, view);
                }
            }).DisposeWith(_disposables);
        }
        private void SetupContentsView(PaletteStore store, ThemeEditorWindow view)
        {
            _colorContentsViewController?.Dispose();
            _gradientContentsViewController?.Dispose();
            _characterStyleContentsViewController?.Dispose();
            _characterStyleTMPContentsViewController?.Dispose();
            _emptyViewController?.Dispose();

            _editService = new EditPaletteStoreService(store, new GenerateNameEnumsFileService(store));
            _colorContentsViewController =
                new ThemeEditorWindowContentsViewController <Color>(store.ColorPalette, _editService,
                                                                    view.ColorContentsView);
            _gradientContentsViewController =
                new ThemeEditorWindowContentsViewController <Gradient>(store.GradientPalette, _editService,
                                                                       view.GradientContentsView);
            _characterStyleContentsViewController =
                new ThemeEditorWindowContentsViewController <CharacterStyle>(store.CharacterStylePalette, _editService,
                                                                             view.CharacterStyleContentsView);
            _characterStyleTMPContentsViewController =
                new ThemeEditorWindowContentsViewController <CharacterStyleTMP>(store.CharacterStyleTMPPalette,
                                                                                _editService, view.CharacterStyleTMPContentsView);

            _activeContentsViewController = GetPerTypeController(_guiState.ActivePaletteType.Value);
        }