summaryrefslogtreecommitdiff
path: root/src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2018-11-04 15:22:16 -0700
committermo <mo.khan@gmail.com>2018-11-04 15:22:16 -0700
commit5ee1f55497a4e30322a56f133f897ecde1612967 (patch)
treebf544e0879234c3623869627d8786776cb19b8e9 /src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs
initial commit.HEADmaster
Diffstat (limited to 'src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs')
-rw-r--r--src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs b/src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs
new file mode 100644
index 0000000..b40507d
--- /dev/null
+++ b/src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs
@@ -0,0 +1,29 @@
+using Notepad.Domain.Repositories;
+using Notepad.Infrastructure.Extensions;
+using Notepad.Presentation.Core;
+using Notepad.Presentation.Model.Menu;
+using Notepad.Presentation.Views.Menu;
+
+namespace Notepad.Presentation.Presenters.Menu {
+ public interface IMainMenuPresenter : IPresenter {}
+
+ public class MainMenuPresenter : IMainMenuPresenter {
+ private readonly IMainMenuView mainMenu;
+ private readonly IRepository<ISubMenu> repository;
+ private readonly ISubMenuItemComparer comparer;
+
+ public MainMenuPresenter(IMainMenuView mainMenu,
+ IRepository<ISubMenu> repository,
+ ISubMenuItemComparer comparer) {
+ this.mainMenu = mainMenu;
+ this.repository = repository;
+ this.comparer = comparer;
+ }
+
+ public void Initialize() {
+ foreach (var subMenuToAddToMainMenu in repository.All().SortedUsing(comparer)) {
+ mainMenu.Add(subMenuToAddToMainMenu);
+ }
+ }
+ }
+} \ No newline at end of file