From 5ee1f55497a4e30322a56f133f897ecde1612967 Mon Sep 17 00:00:00 2001 From: mo Date: Sun, 4 Nov 2018 15:22:16 -0700 Subject: initial commit. --- .../Presentation/Model/Menu/File/FileMenu.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/Notepad/Presentation/Model/Menu/File/FileMenu.cs (limited to 'src/Notepad/Presentation/Model/Menu/File/FileMenu.cs') diff --git a/src/Notepad/Presentation/Model/Menu/File/FileMenu.cs b/src/Notepad/Presentation/Model/Menu/File/FileMenu.cs new file mode 100644 index 0000000..98b5a47 --- /dev/null +++ b/src/Notepad/Presentation/Model/Menu/File/FileMenu.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Notepad.Domain.Repositories; +using Notepad.Infrastructure.Extensions; + +namespace Notepad.Presentation.Model.Menu.File { + public class FileMenu : ISubMenu { + private readonly IRepository repository; + private readonly IMenuItemComparer menuItemComparer; + + public FileMenu(IRepository repository, IMenuItemComparer menuItemComparer) { + this.repository = repository; + this.menuItemComparer = menuItemComparer; + } + + public IEnumerable AllMenuItems() { + return repository + .All() + .ThatSatisfy(menuItem => menuItem.BelongsTo(this)) + .SortedUsing(menuItemComparer); + } + + public string Name() { + return MenuNames.File; + } + } +} \ No newline at end of file -- cgit v1.2.3