diff options
Diffstat (limited to 'src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs')
| -rw-r--r-- | src/Notepad/Presentation/Presenters/Menu/IMainMenuPresenter.cs | 29 |
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 |
