public MainFormPresenter( IMainForm view, ILogger <MainFormPresenter> logger, IEventService eventService, NotesListPresenter notesListPresenter, INotesListView notesListView, NotePresenter notePresenter, INoteView noteView) : base(view) { _logger = logger; _eventService = eventService; _notesListPresenter = notesListPresenter; _notesListView = notesListView; _notePresenter = notePresenter; _noteView = noteView; View.Load += OnLoad; eventService.Subscribe <NoteCreatedEvent>(e => { View.SetNoteViewVisibility(true); }); eventService.Subscribe <SelectedNoteChangedEvent>(e => { View.SetNoteViewVisibility(e.SelectedNote is not null); }); }
public NotePresenter(INoteView view, INoteRepository repository) { _view = view; _view.Presenter = this; _repository = repository; LoadNotes(); }
public NoteController(INoteView view, NoteModel model) { _view = view; _model = model; UpdateViewFromModel(); _model.ContentChanged += OnModelContentChanged; }
public void SetNoteView(INoteView noteView) { _guiContext.Invoke(() => { _noteView = noteView; _noteView.This.Dock = DockStyle.Fill; BodyPanel.Controls.Clear(); BodyPanel.Controls.Add(_noteView.This); }); }
public NotePresenter( ILogger <NotePresenter> logger, INoteView view, IEventService eventService, IRepository <Note> noteRepository, IGuiContext guiContext) { _logger = logger; _view = view; _eventService = eventService; _noteRepository = noteRepository; _guiContext = guiContext; _view.SaveNoteClicked += OnSaveNoteClicked; _view.DeleteNoteClicked += OnDeleteNoteClicked; _eventService.Subscribe <NoteCreatedEvent>(e => { _currentNote = new Note(); _logger.LogInformation(nameof(NoteCreatedEvent)); _view.SetNote(_currentNote); _saved = false; _view.SaveButtonEnabled = true; _view.DeleteButtonEnabled = false; }); _eventService.Subscribe <SelectedNoteChangedEvent>(e => { _currentNote = e.SelectedNote; _logger.LogInformation(nameof(SelectedNoteChangedEvent)); if (_currentNote is not null) { _logger.LogWarning("current not is not null"); _view.SetNote(_currentNote); _saved = true; _view.SaveButtonEnabled = false; _view.DeleteButtonEnabled = true; } }); }