master
1using Notepad.Infrastructure.Extensions;
2using Notepad.Presentation.Core;
3using Notepad.Presentation.Views.Menu.File;
4using Notepad.Tasks;
5
6namespace Notepad.Presentation.Presenters.Menu.File {
7 public interface ISaveAsPresenter : IPresenter {
8 void SaveToFileAt(string pathToSaveDocumentTo);
9 }
10
11 public class SaveAsPresenter : ISaveAsPresenter {
12 private readonly ISaveAsView view;
13 private readonly IDocumentTasks tasks;
14
15 public SaveAsPresenter(ISaveAsView view, IDocumentTasks tasks) {
16 this.view = view;
17 this.tasks = tasks;
18 }
19
20 public void Initialize() {
21 view.AttachTo(this);
22 }
23
24 public void SaveToFileAt(string pathToSaveDocumentTo) {
25 tasks.SaveActiveDocumentTo(pathToSaveDocumentTo.AsAnAbsoluteFilePath());
26 }
27 }
28}