diff options
| author | mo <mo.khan@gmail.com> | 2018-11-04 15:22:16 -0700 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2018-11-04 15:22:16 -0700 |
| commit | 5ee1f55497a4e30322a56f133f897ecde1612967 (patch) | |
| tree | bf544e0879234c3623869627d8786776cb19b8e9 /src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs | |
Diffstat (limited to 'src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs')
| -rw-r--r-- | src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs b/src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs new file mode 100644 index 0000000..ea7c396 --- /dev/null +++ b/src/Notepad/Presentation/Model/Menu/File/Commands/ISaveCommand.cs @@ -0,0 +1,27 @@ +using Notepad.Infrastructure.Core;
+using Notepad.Presentation.Core;
+using Notepad.Presentation.Presenters.Menu.File;
+using Notepad.Tasks;
+
+namespace Notepad.Presentation.Model.Menu.File.Commands {
+ public interface ISaveCommand : ICommand {}
+
+ public class SaveCommand : ISaveCommand {
+ private readonly IApplicationController controller;
+ private readonly IDocumentTasks tasks;
+
+ public SaveCommand(IApplicationController controller, IDocumentTasks tasks) {
+ this.controller = controller;
+ this.tasks = tasks;
+ }
+
+ public void Execute() {
+ if (!tasks.HasAPathToSaveToBeenSpecified()) {
+ controller.Run<ISaveAsPresenter>();
+ }
+ else {
+ tasks.SaveTheActiveDocument();
+ }
+ }
+ }
+}
\ No newline at end of file |
