Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
 private void NewFile()
 {
     CurrentFile = new File();
 }