Commit 0c9a943
Changed files (8)
product
Boot
boot
container
registration
Presentation
Model
Navigation
Reporting
Presenters
Views
Winforms
Views
product/Boot/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -1,17 +1,21 @@
using System;
+using System.Collections.Generic;
using System.Reflection;
using Gorilla.Commons.Infrastructure;
using Gorilla.Commons.Infrastructure.Reflection;
using Gorilla.Commons.Utility.Core;
using Gorilla.Commons.Utility.Extensions;
using MoMoney.boot.container.registration.proxy_configuration;
+using MoMoney.DTO;
using MoMoney.Presentation;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Model.Menu.File;
using MoMoney.Presentation.Model.Menu.Help;
using MoMoney.Presentation.Model.Menu.window;
+using MoMoney.Presentation.Presenters;
using MoMoney.Presentation.Presenters.Commands;
using MoMoney.Presentation.Views;
+using MoMoney.Service.Contracts.Application;
namespace MoMoney.boot.container.registration
{
@@ -35,6 +39,7 @@ namespace MoMoney.boot.container.registration
() => new ApplicationController(Lazy.load<IPresenterRegistry>(), Lazy.load<IShell>());
registry.proxy<IApplicationController, SynchronizedConfiguration<IApplicationController>>(target.memorize());
registry.transient(typeof (IRunThe<>), typeof (RunThe<>));
+ registry.transient(typeof (IPresenter), typeof (ReportPresenter<IViewAllBillsReport,IEnumerable<BillInformationDTO>,IGetAllBillsQuery>));
registry.transient<IFileMenu, FileMenu>();
registry.transient<IWindowMenu, WindowMenu>();
registry.transient<IHelpMenu, HelpMenu>();
@@ -44,6 +49,7 @@ namespace MoMoney.boot.container.registration
.where(x => typeof (IPresenter).IsAssignableFrom(x))
.where(x => !x.IsInterface)
.where(x => !x.IsAbstract)
+ .where(x => !x.IsGenericType)
.each(type => registry.transient(typeof (IPresenter), type));
item
@@ -51,6 +57,7 @@ namespace MoMoney.boot.container.registration
.where(x => typeof (IModule).IsAssignableFrom(x))
.where(x => !x.IsInterface)
.where(x => !x.IsAbstract)
+ .where(x => !x.IsGenericType)
.each(type => registry.transient(typeof (IModule), type));
}
}
product/Presentation/Model/Reporting/IBindReportTo.cs
@@ -0,0 +1,8 @@
+using Gorilla.Commons.Utility.Core;
+
+namespace MoMoney.Presentation.Model.reporting
+{
+ public interface IBindReportTo<T, Query> : IReport, IParameterizedCommand<T> where Query : IQuery<T>
+ {
+ }
+}
\ No newline at end of file
product/Presentation/Presenters/AddReportingTaskPane.cs
@@ -1,5 +1,9 @@
+using System.Collections.Generic;
+using MoMoney.DTO;
using MoMoney.Presentation.Presenters.Navigation;
+using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
+using MoMoney.Service.Contracts.Application;
using XPExplorerBar;
namespace MoMoney.Presentation.Presenters
@@ -21,7 +25,7 @@ namespace MoMoney.Presentation.Presenters
Build.task_pane_item()
.named("View All Bills")
.represented_by_image(ApplicationImages.ReadingABill)
- .when_clicked_execute(() => command.run<IReportPresenter>())
+ .when_clicked_execute(() => command.run<IReportPresenter<IViewAllBillsReport, IEnumerable<BillInformationDTO>, IGetAllBillsQuery>>())
)
.build();
}
product/Presentation/Presenters/ReportPresenter.cs
@@ -1,28 +1,32 @@
+using Gorilla.Commons.Infrastructure.Container;
+using Gorilla.Commons.Utility.Core;
using MoMoney.Presentation.Core;
-using MoMoney.Presentation.Views;
+using MoMoney.Presentation.Model.reporting;
using MoMoney.Presentation.Views.reporting;
-using MoMoney.Service.Contracts.Application;
namespace MoMoney.Presentation.Presenters
{
- public interface IReportPresenter : IContentPresenter
+ public interface IReportPresenter<Report, T, Query> : IContentPresenter
+ where Report : IBindReportTo<T, Query>
+ where Query : IQuery<T>
{
}
- public class ReportPresenter : ContentPresenter<IReportViewer>, IReportPresenter
+ public class ReportPresenter<Report, T, Query> : ContentPresenter<IReportViewer>, IReportPresenter<Report, T, Query>
+ where Report : IBindReportTo<T, Query>
+ where Query : IQuery<T>
{
- readonly IViewAllBillsReport report;
- readonly IGetAllBillsQuery query;
+ readonly IDependencyRegistry registry;
- public ReportPresenter(IReportViewer view, IViewAllBillsReport report, IGetAllBillsQuery query) : base(view)
+ public ReportPresenter(IReportViewer view, IDependencyRegistry registry) : base(view)
{
- this.report = report;
- this.query = query;
+ this.registry = registry;
}
public override void run()
{
- report.run(query.fetch());
+ var report = registry.get_a<Report>();
+ report.run(registry.get_a<Query>().fetch());
view.display(report);
}
}
product/Presentation/Views/IViewAllBillsReport.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using MoMoney.DTO;
using MoMoney.Presentation.Model.reporting;
+using MoMoney.Service.Contracts.Application;
namespace MoMoney.Presentation.Views
{
- public interface IViewAllBillsReport : IReport
+ public interface IViewAllBillsReport : IBindReportTo<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>
{
- void run(IEnumerable<BillInformationDTO> bills);
}
}
\ No newline at end of file
product/Presentation/Winforms/Views/ReportViewer.cs
@@ -1,4 +1,3 @@
-using System;
using DataDynamics.ActiveReports;
using Gorilla.Commons.Utility.Extensions;
using MoMoney.Presentation.Model.reporting;
product/Presentation/Presentation.csproj
@@ -106,6 +106,7 @@
<Compile Include="Model\Navigation\INavigationTreeVisitor.cs" />
<Compile Include="Model\Navigation\ITreeBranch.cs" />
<Compile Include="Model\Navigation\ITreeViewToRootNodeMapper.cs" />
+ <Compile Include="Model\Reporting\IBindReportTo.cs" />
<Compile Include="Presenters\CommandFactory.cs" />
<Compile Include="Presenters\CommandPump.cs" />
<Compile Include="Core\ApplicationController.cs" />
@@ -160,7 +161,6 @@
<Compile Include="Model\Navigation\TreeViewToRootNodeMapper.cs" />
<Compile Include="Model\Navigation\TreeBranchSpecs.cs" />
<Compile Include="Model\Navigation\ViewAllBillsBranch.cs" />
- <Compile Include="Model\Navigation\ViewAllBillsReportBranch.cs" />
<Compile Include="Model\Projects\EmptyProject.cs" />
<Compile Include="Model\Projects\FileNotSpecifiedException.cs" />
<Compile Include="Model\Projects\IProject.cs" />