private void SetupContentsView(PaletteStore store, PaletteEditorWindow view)
        {
            _colorContentsViewController?.Dispose();
            _gradientContentsViewController?.Dispose();
            _characterStyleContentsViewController?.Dispose();
            _characterStyleTMPContentsViewController?.Dispose();
            _emptyViewController?.Dispose();

            _editService = new EditPaletteStoreService(store, new GenerateNameEnumsFileService(store));

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

            _activeContentsViewController = GetPerTypeController(_guiState.ActivePaletteType.Value);
        }
        private void SetupEmptyView(PaletteEditorWindow view)
        {
            _colorContentsViewController?.Dispose();
            _gradientContentsViewController?.Dispose();
            _characterStyleContentsViewController?.Dispose();
            _characterStyleTMPContentsViewController?.Dispose();
            _emptyViewController?.Dispose();

            _emptyViewController = new PaletteEditorWindowEmptyViewController(view.EmptyView);
        }
        private void SetupEmptyView(PaletteEditorWindow view)
        {
            _colorContentsViewPresenter?.Dispose();
            _gradientContentsViewPresenter?.Dispose();
            _characterStyleContentsViewPresenter?.Dispose();
            _characterStyleTMPContentsViewPresenter?.Dispose();
            _emptyViewPresenter?.Dispose();

            _emptyViewPresenter = new PaletteEditorEmptyViewPresenter(view.EmptyView);

            view.SetMode(PaletteEditorWindow.Mode.Empty);
        }
        public PaletteEditorWindowController(PaletteStoreRepository storeRepository, UPaletteEditorGUIState guiState,
                                             PaletteEditorWindow 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);
        }
        private void SetupContentsView(PaletteStore store, PaletteEditorWindow view)
        {
            _colorContentsViewPresenter?.Dispose();
            _gradientContentsViewPresenter?.Dispose();
            _characterStyleContentsViewPresenter?.Dispose();
            _characterStyleTMPContentsViewPresenter?.Dispose();
            _emptyViewPresenter?.Dispose();

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

            view.SetMode(PaletteEditorWindow.Mode.Contents);
        }
        public PaletteEditorWindowPresenter(PaletteStoreRepository storeRepository, UPaletteEditorGUIState guiState,
                                            PaletteEditorWindow 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);
        }