public NotepadPresenter(INotepadView view, IRepository <File> repository) { _view = view; _repository = repository; CurrentFile = new File(); _view.SaveFile += SaveFile; _view.OpenFile += OpenFile; _view.NewFile += NewFile; _view.ApplicationStop += Dispose; _view.FormatChanged += ApplyHighlights; }
private async Task <string> OpenFile() { string result = null; var openFilePresenter = new OpenFilePresenter(new OpenFileForm(), new FileRepository()); openFilePresenter.Run(); if (!String.IsNullOrEmpty(openFilePresenter.ChosenFile)) { CurrentFile = await _repository.GetFileByNameAsync(openFilePresenter.ChosenFile); result = Compression.ExtractToString(CurrentFile.Data); } return(result); }
private void NewFile() { CurrentFile = new File(); }