Commit 1132d03
Changed files (34)
product
client
boot
domain
Accounting
presentation
Core
Presenters
commons
infrastructure
container
infrastructure.thirdparty
autofac
product/client/boot/boot/container/registration/WireUpTheDomainServicesInToThe.cs
@@ -0,0 +1,21 @@
+using Gorilla.Commons.Infrastructure.Reflection;
+using gorilla.commons.infrastructure.thirdparty;
+using MoMoney.Domain.Accounting;
+
+namespace MoMoney.boot.container.registration
+{
+ class WireUpTheDomainServicesInToThe : IStartupCommand
+ {
+ readonly DependencyRegistration registry;
+
+ public WireUpTheDomainServicesInToThe(DependencyRegistration registry)
+ {
+ this.registry = registry;
+ }
+
+ public void run(Assembly item)
+ {
+ registry.transient<ICompanyFactory, CompanyFactory>();
+ }
+ }
+}
\ No newline at end of file
product/client/boot/boot/container/registration/WireUpTheViewsInToThe.cs
@@ -2,11 +2,9 @@ using System.ComponentModel;
using System.Windows.Forms;
using Gorilla.Commons.Infrastructure.Reflection;
using gorilla.commons.infrastructure.thirdparty;
-using gorilla.commons.utility;
using momoney.presentation.views;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Views;
-using View = momoney.presentation.views.View;
namespace MoMoney.boot.container.registration
{
@@ -27,29 +25,30 @@ namespace MoMoney.boot.container.registration
register.singleton<ISynchronizeInvoke>(() => shell);
register.singleton<IRegionManager>(() => shell);
register.singleton(() => shell);
- register.singleton<IAboutApplicationView, AboutTheApplicationView>();
- register.singleton<ISplashScreenView, SplashScreenView>();
- register.singleton<INavigationView, NavigationView>();
- register.singleton<IAddCompanyView, AddCompanyView>();
- register.singleton<IViewAllBills, ViewAllBills>();
- register.singleton<IAddBillPaymentView, AddBillPaymentView>();
- register.singleton<IMainMenuView, MainMenuView>();
- register.singleton<IAddNewIncomeView, AddNewIncomeView>();
- register.singleton<IViewIncomeHistory, ViewAllIncome>();
- register.singleton<INotificationIconView, NotificationIconView>();
- register.singleton<IStatusBarView, StatusBarView>();
- register.singleton<IGettingStartedView, WelcomeScreen>();
- register.singleton<ILogFileView, LogFileView>();
+ register_tab<IAboutApplicationView, AboutTheApplicationView>();
+ register_tab<ISplashScreenView, SplashScreenView>();
+ register_tab<INavigationView, NavigationView>();
+ register_tab<IAddCompanyView, AddCompanyView>();
+ register_tab<IViewAllBills, ViewAllBills>();
+ register_tab<IAddBillPaymentView, AddBillPaymentView>();
+ register_tab<IMainMenuView, MainMenuView>();
+ register_tab<IAddNewIncomeView, AddNewIncomeView>();
+ register_tab<IViewIncomeHistory, ViewAllIncome>();
+ register_tab<INotificationIconView, NotificationIconView>();
+ register_tab<IStatusBarView, StatusBarView>();
+ register_tab<IGettingStartedView, WelcomeScreen>();
+ register_tab<ILogFileView, LogFileView>();
register.transient<ISaveChangesView, SaveChangesView>();
register.transient<ICheckForUpdatesView, CheckForUpdatesView>();
register.transient<IUnhandledErrorView, UnhandledErrorView>();
+ }
-
- item.all_classes_that_implement<View>().each(x =>
- {
- register.singleton(typeof (View), x);
- });
+ void register_tab<Interface, View>() where View : Interface, new() where Interface : momoney.presentation.views.View
+ {
+ var view = new View();
+ register.singleton<Interface>(() => view);
+ register.singleton<momoney.presentation.views.View>(() => view);
}
}
}
\ No newline at end of file
product/client/boot/boot/container/WireUpTheContainer.cs
@@ -1,13 +1,14 @@
using Autofac.Builder;
using Gorilla.Commons.Infrastructure.Container;
using Gorilla.Commons.Infrastructure.Reflection;
+using gorilla.commons.infrastructure.thirdparty;
using gorilla.commons.infrastructure.thirdparty.Autofac;
using gorilla.commons.utility;
using MoMoney.boot.container.registration;
using momoney.database;
+using MoMoney.Domain.Accounting;
using MoMoney.Presentation;
using momoney.service.infrastructure;
-using Assembly = System.Reflection.Assembly;
namespace MoMoney.boot.container
{
@@ -23,12 +24,13 @@ namespace MoMoney.boot.container
.then(new WireUpTheDataAccessComponentsIntoThe(registry))
.then(new WireUpTheInfrastructureInToThe(registry))
.then(new WireUpTheMappersInToThe(registry))
+ .then(new WireUpTheDomainServicesInToThe(registry))
.then(new WireUpTheServicesInToThe(registry))
.then(new WireUpThePresentationModules(registry))
.then(new WireUpTheViewsInToThe(registry))
.then(new WireUpTheReportsInToThe(registry))
.run(new ApplicationAssembly(
- Assembly.GetExecutingAssembly(),
+ System.Reflection.Assembly.GetExecutingAssembly(),
typeof (DatabaseAssembly).Assembly,
typeof (PresentationAssembly).Assembly,
typeof (InfrastructureAssembly).Assembly
@@ -37,4 +39,5 @@ namespace MoMoney.boot.container
Resolve.initialize_with(registry.build());
}
}
+
}
\ No newline at end of file
product/client/boot/Modules/ApplicationShellModule.cs
@@ -1,3 +1,4 @@
+using momoney.modules;
using MoMoney.Presentation;
using momoney.presentation.presenters;
using MoMoney.Presentation.Presenters;
@@ -16,6 +17,10 @@ namespace MoMoney.Modules
public void run()
{
command.run<ApplicationShellPresenter>();
+ command.run<NotificationIconPresenter>();
+ command.run<StatusBarPresenter>();
+ command.run<TaskTrayPresenter>();
+ command.run<MainMenuPresenter>();
}
}
}
\ No newline at end of file
product/client/boot/Modules/MainMenuModule.cs
@@ -1,26 +0,0 @@
-using MoMoney.Presentation;
-using momoney.presentation.model.eventing;
-using MoMoney.Presentation.Presenters;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace MoMoney.Modules
-{
- public class MainMenuModule : IModule, EventSubscriber<NewProjectOpened>
- {
- readonly IRunPresenterCommand command;
-
- public MainMenuModule(IRunPresenterCommand command)
- {
- this.command = command;
- }
-
- public void run()
- {
- }
-
- public void notify(NewProjectOpened message)
- {
- command.run<MainMenuPresenter>();
- }
- }
-}
\ No newline at end of file
product/client/boot/Modules/NotificationIconModule.cs
@@ -1,37 +0,0 @@
-using System.Net.NetworkInformation;
-using MoMoney.Presentation;
-using momoney.presentation.model.eventing;
-using momoney.presentation.views;
-using MoMoney.Presentation.Winforms.Resources;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace momoney.modules
-{
- public class NotificationIconModule : IModule,
- EventSubscriber<ClosingTheApplication>,
- EventSubscriber<NewProjectOpened>
- {
- readonly INotificationIconView view;
-
- public NotificationIconModule(INotificationIconView view)
- {
- this.view = view;
- }
-
- public void run()
- {
- NetworkChange.NetworkAvailabilityChanged += (o, e) => view.display(ApplicationIcons.Application, e.IsAvailable ? "Connected To A Network" : "Disconnected From Network");
- view.display(ApplicationIcons.Application, "mokhan.ca");
- }
-
- public void notify(ClosingTheApplication message)
- {
- view.Dispose();
- }
-
- public void notify(NewProjectOpened message)
- {
- view.opened_new_project();
- }
- }
-}
\ No newline at end of file
product/client/boot/Modules/NotificationIconPresenterSpecs.cs
@@ -1,12 +1,14 @@
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;
+using momoney.presentation.presenters;
using momoney.presentation.views;
+using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
namespace momoney.modules
{
- [Concern(typeof (NotificationIconModule))]
- public abstract class behaves_like_notification_icon_presenter : concerns_for<NotificationIconModule>
+ [Concern(typeof (NotificationIconPresenter))]
+ public abstract class behaves_like_notification_icon_presenter : concerns_for<NotificationIconPresenter>
{
context c = () =>
{
@@ -21,6 +23,12 @@ namespace momoney.modules
it should_ask_the_view_to_display_the_correct_icon_and_text =
() => view.was_told_to(v => v.display(ApplicationIcons.Application, "mokhan.ca"));
- because b = () => sut.run();
+ context c = () =>
+ {
+ shell = an<Shell>();
+ };
+
+ because b = () => sut.present(shell);
+ static Shell shell;
}
}
\ No newline at end of file
product/client/boot/boot.csproj
@@ -142,6 +142,7 @@
<Compile Include="boot\container\registration\proxy_configuration\ServiceLayerConfiguration.cs" />
<Compile Include="boot\container\registration\proxy_configuration\SynchronizedConfiguration.cs" />
<Compile Include="boot\container\registration\proxy_configuration\UnitOfWorkInterceptor.cs" />
+ <Compile Include="boot\container\registration\WireUpTheDomainServicesInToThe.cs" />
<Compile Include="boot\container\registration\WireUpTheInfrastructureInToThe.cs" />
<Compile Include="boot\container\tear_down_the_container.cs" />
<Compile Include="boot\container\registration\WireUpTheDataAccessComponentsIntoThe.cs" />
@@ -155,14 +156,9 @@
<Compile Include="modules\core\ILoadPresentationModulesCommand.cs" />
<Compile Include="modules\DatabaseModule.cs" />
<Compile Include="modules\ApplicationMenuModule.cs" />
- <Compile Include="modules\MainMenuModule.cs" />
<Compile Include="modules\NavigationModule.cs" />
<Compile Include="modules\GettingStartedModule.cs" />
- <Compile Include="modules\NotificationIconModule.cs" />
<Compile Include="modules\NotificationIconPresenterSpecs.cs" />
- <Compile Include="modules\StatusBarModule.cs" />
- <Compile Include="modules\StatusBarPresenterSpecs.cs" />
- <Compile Include="modules\TaskTrayPresenter.cs" />
<Compile Include="modules\TitleBarPresenter.cs" />
<Compile Include="modules\TitleBarPresenterSpecs.cs" />
<Compile Include="modules\ToolbarModule.cs" />
product/client/domain/Accounting/CompanyFactory.cs
@@ -1,26 +1,26 @@
-using gorilla.commons.utility;
-using MoMoney.Domain.repositories;
-
-namespace MoMoney.Domain.Accounting
-{
- public interface ICompanyFactory : Factory<Company> {}
-
- public class CompanyFactory : ICompanyFactory
- {
- readonly ComponentFactory<Company> factory;
- readonly ICompanyRepository companys;
-
- public CompanyFactory(ComponentFactory<Company> factory, ICompanyRepository companys)
- {
- this.factory = factory;
- this.companys = companys;
- }
-
- public Company create()
- {
- var company = factory.create();
- companys.save(company);
- return company;
- }
- }
+using gorilla.commons.utility;
+using MoMoney.Domain.repositories;
+
+namespace MoMoney.Domain.Accounting
+{
+ public interface ICompanyFactory : Factory<Company> {}
+
+ public class CompanyFactory : ICompanyFactory
+ {
+ readonly ComponentFactory<Company> factory;
+ readonly ICompanyRepository companys;
+
+ public CompanyFactory(ComponentFactory<Company> factory, ICompanyRepository companys)
+ {
+ this.factory = factory;
+ this.companys = companys;
+ }
+
+ public Company create()
+ {
+ var company = factory.create();
+ companys.save(company);
+ return company;
+ }
+ }
}
\ No newline at end of file
product/client/presentation/Core/CachedPresenterFactory.cs
@@ -4,10 +4,10 @@ namespace MoMoney.Presentation.Core
{
public class CachedPresenterFactory : PresenterFactory
{
- IPresenterRegistry presenters;
+ Registry<Presenter> presenters;
ViewFactory view_factory;
- public CachedPresenterFactory(IPresenterRegistry presenters, ViewFactory view_factory)
+ public CachedPresenterFactory(Registry<Presenter> presenters, ViewFactory view_factory)
{
this.presenters = presenters;
this.view_factory = view_factory;
@@ -16,9 +16,8 @@ namespace MoMoney.Presentation.Core
public TPresenter create<TPresenter>() where TPresenter : Presenter
{
var presenter = presenters.find_an_implementation_of<Presenter, TPresenter>();
- view_factory
- .create_for<TPresenter>()
- .attach_to(presenter);
+ var view = view_factory.create_for<TPresenter>();
+ view.attach_to(presenter);
return presenter;
}
}
product/client/presentation/Core/ViewRegistry.cs โ product/client/presentation/Core/CachingViewFactory.cs
@@ -17,11 +17,7 @@ namespace MoMoney.Presentation.Core
public View<Presenter> create_for<Presenter>() where Presenter : Core.Presenter
{
- if (views.all().Any(x =>
- {
- //this.log().debug("is {0} a {1} = {2}", x, typeof (View<Presenter>).Name, typeof (View<Presenter>).IsAssignableFrom(x.GetType()));
- return typeof (View<Presenter>).IsAssignableFrom(x.GetType());
- }))
+ if (views.all().Any(x => typeof (View<Presenter>).IsAssignableFrom(x.GetType())))
{
return views.find_an_implementation_of<View, View<Presenter>>();
}
product/client/presentation/Core/IContentPresenter.cs
@@ -1,6 +1,6 @@
-namespace MoMoney.Presentation.Core
-{
- public interface IContentPresenter : Presenter
- {
- }
+namespace MoMoney.Presentation.Core
+{
+ public interface IContentPresenter : Presenter
+ {
+ }
}
\ No newline at end of file
product/client/presentation/Core/Presenter.cs
@@ -1,9 +1,9 @@
-using MoMoney.Presentation.Views;
-
-namespace MoMoney.Presentation.Core
-{
- public interface Presenter
- {
- void present(Shell shell);
- }
+using MoMoney.Presentation.Views;
+
+namespace MoMoney.Presentation.Core
+{
+ public interface Presenter
+ {
+ void present(Shell shell);
+ }
}
\ No newline at end of file
product/client/presentation/Core/PresenterRegistry.cs
@@ -1,33 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using gorilla.commons.utility;
-
-namespace MoMoney.Presentation.Core
-{
- public interface IPresenterRegistry : Registry<Presenter> {}
-
- public class PresenterRegistry : IPresenterRegistry
- {
- readonly Registry<Presenter> presenters;
-
- public PresenterRegistry(Registry<Presenter> presenters)
- {
- this.presenters = presenters;
- }
-
- public IEnumerable<Presenter> all()
- {
- return presenters.all();
- }
-
- public IEnumerator<Presenter> GetEnumerator()
- {
- return all().GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
\ No newline at end of file
product/client/presentation/Core/TabPresenter.cs
@@ -1,5 +1,3 @@
-using System;
-using developwithpassion.bdd.core.extensions;
using momoney.presentation.views;
using MoMoney.Presentation.Views;
@@ -8,7 +6,6 @@ namespace MoMoney.Presentation.Core
public abstract class TabPresenter<Tab> : IContentPresenter where Tab : ITab
{
protected readonly Tab view;
- Guid id = Guid.NewGuid();
protected TabPresenter(Tab view)
{
@@ -22,10 +19,5 @@ namespace MoMoney.Presentation.Core
shell.add(view);
present();
}
-
- public override string ToString()
- {
- return "{0} {1}".format_using(id, GetType().Name);
- }
}
}
\ No newline at end of file
product/client/presentation/Presenters/AddCompanyPresenter.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Gorilla.Commons.Infrastructure.Logging;
using MoMoney.DTO;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Views;
@@ -23,7 +22,6 @@ namespace MoMoney.Presentation.Presenters
public void submit(RegisterNewCompany dto)
{
- this.log().debug("registering a new company: {0}", dto.company_name);
pump.run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto);
pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
}
product/client/presentation/Presenters/GettingStartedPresenter.cs
@@ -1,12 +1,10 @@
-using MoMoney.Presentation.Core;
-using momoney.presentation.views;
-
-namespace momoney.presentation.presenters
-{
- public class GettingStartedPresenter : TabPresenter<IGettingStartedView>
- {
- public GettingStartedPresenter(IGettingStartedView view) : base(view)
- {
- }
- }
+using MoMoney.Presentation.Core;
+using momoney.presentation.views;
+
+namespace momoney.presentation.presenters
+{
+ public class GettingStartedPresenter : TabPresenter<IGettingStartedView>
+ {
+ public GettingStartedPresenter(IGettingStartedView view) : base(view) {}
+ }
}
\ No newline at end of file
product/client/presentation/Presenters/MainMenuPresenter.cs
@@ -1,31 +1,38 @@
-using System.Collections.Generic;
-using gorilla.commons.utility;
-using MoMoney.Presentation.Core;
-using momoney.presentation.presenters;
-using MoMoney.Presentation.Views;
-
-namespace MoMoney.Presentation.Presenters
-{
- public class MainMenuPresenter : TabPresenter<IMainMenuView>
- {
- IRunPresenterCommand command;
-
- public MainMenuPresenter(IMainMenuView view, IRunPresenterCommand command) : base(view)
- {
- this.command = command;
- }
-
- protected override void present()
- {
- all_factories().each(x => view.add(x));
- }
-
- IEnumerable<IActionTaskPaneFactory> all_factories()
- {
- yield return new AddCompanyTaskPane(command);
- yield return new AddIncomeTaskPane(command);
- yield return new AddBillingTaskPane(command);
- yield return new AddReportingTaskPane(command);
- }
- }
+using System.Collections.Generic;
+using gorilla.commons.utility;
+using MoMoney.Presentation.Core;
+using momoney.presentation.model.eventing;
+using momoney.presentation.presenters;
+using MoMoney.Presentation.Views;
+using MoMoney.Service.Infrastructure.Eventing;
+
+namespace MoMoney.Presentation.Presenters
+{
+ public class MainMenuPresenter : TabPresenter<IMainMenuView>, EventSubscriber<NewProjectOpened>
+ {
+ IRunPresenterCommand command;
+
+ public MainMenuPresenter(IMainMenuView view, IRunPresenterCommand command) : base(view)
+ {
+ this.command = command;
+ }
+
+ protected override void present()
+ {
+ all_factories().each(x => view.add(x));
+ }
+
+ IEnumerable<IActionTaskPaneFactory> all_factories()
+ {
+ yield return new AddCompanyTaskPane(command);
+ yield return new AddIncomeTaskPane(command);
+ yield return new AddBillingTaskPane(command);
+ yield return new AddReportingTaskPane(command);
+ }
+
+ public void notify(NewProjectOpened message)
+ {
+ //present();
+ }
+ }
}
\ No newline at end of file
product/client/presentation/Presenters/NotificationIconPresenter.cs
@@ -0,0 +1,51 @@
+using System.Net.NetworkInformation;
+using MoMoney.Presentation.Core;
+using momoney.presentation.model.eventing;
+using MoMoney.Presentation.Model.Menu.File;
+using MoMoney.Presentation.Model.Menu.Help;
+using MoMoney.Presentation.Model.Menu.window;
+using momoney.presentation.views;
+using MoMoney.Presentation.Views;
+using MoMoney.Presentation.Winforms.Resources;
+using MoMoney.Service.Infrastructure.Eventing;
+
+namespace momoney.presentation.presenters
+{
+ public class NotificationIconPresenter : Presenter,
+ EventSubscriber<ClosingTheApplication>,
+ EventSubscriber<NewProjectOpened>
+ {
+ readonly INotificationIconView view;
+
+ public NotificationIconPresenter(INotificationIconView view, IFileMenu file, IWindowMenu window, IHelpMenu help)
+ {
+ this.view = view;
+ file_menu = file;
+ window_menu = window;
+ help_menu = help;
+ }
+
+ public IRegionManager shell { get; set; }
+ public IFileMenu file_menu { get; set; }
+ public IWindowMenu window_menu { get; set; }
+ public IHelpMenu help_menu { get; set; }
+
+ public void present(Shell shell)
+ {
+ this.shell = shell;
+ view.attach_to(this);
+ view.display(ApplicationIcons.Application, "mokhan.ca");
+ NetworkChange.NetworkAvailabilityChanged += (o, e) => view.display(ApplicationIcons.Application, e.IsAvailable ? "Connected To A Network" : "Disconnected From Network");
+ }
+
+ public void notify(ClosingTheApplication message)
+ {
+ view.Dispose();
+ }
+
+ public void notify(NewProjectOpened message)
+ {
+ view.opened_new_project();
+ }
+ }
+}
\ No newline at end of file
product/client/boot/Modules/StatusBarModule.cs โ product/client/presentation/Presenters/StatusBarPresenter.cs
@@ -1,17 +1,18 @@
using System;
using gorilla.commons.utility;
using Gorilla.Commons.Utility;
-using MoMoney.Presentation;
+using MoMoney.Presentation.Core;
using momoney.presentation.model.eventing;
+using momoney.presentation.views;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
using MoMoney.Service.Infrastructure.Eventing;
using MoMoney.Service.Infrastructure.Threading;
-namespace momoney.modules
+namespace momoney.presentation.presenters
{
- public class StatusBarModule :
- IModule,
+ public class StatusBarPresenter :
+ Presenter,
EventSubscriber<SavedChangesEvent>,
EventSubscriber<NewProjectOpened>,
EventSubscriber<ClosingTheApplication>,
@@ -23,14 +24,18 @@ namespace momoney.modules
readonly IStatusBarView view;
readonly ITimer timer;
- public StatusBarModule(IStatusBarView view, ITimer timer)
+ public StatusBarPresenter(IStatusBarView view, ITimer timer)
{
this.view = view;
this.timer = timer;
}
- public void run()
+ public IRegionManager shell { get; set; }
+
+ public void present(Shell shell)
{
+ this.shell = shell;
+ view.attach_to(this);
view.display(ApplicationIcons.blue_circle, "...");
}
product/client/boot/Modules/StatusBarPresenterSpecs.cs โ product/client/presentation/Presenters/StatusBarPresenterSpecs.cs
@@ -4,10 +4,10 @@ using momoney.presentation.model.eventing;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
-namespace momoney.modules
+namespace momoney.presentation.presenters
{
- [Concern(typeof (StatusBarModule))]
- public class when_initializing_the_status_bar : concerns_for<StatusBarModule>
+ [Concern(typeof (StatusBarPresenter))]
+ public class when_initializing_the_status_bar : concerns_for<StatusBarPresenter>
{
it should_display_a_ready_message =
() => view.was_told_to(v => v.display(ApplicationIcons.green_circle, "Ready"));
product/client/boot/Modules/TaskTrayPresenter.cs โ product/client/presentation/Presenters/TaskTrayPresenter.cs
@@ -1,13 +1,14 @@
using gorilla.commons.utility;
-using MoMoney.Presentation;
+using MoMoney.Presentation.Core;
using momoney.presentation.model.eventing;
using momoney.presentation.views;
+using MoMoney.Presentation.Views;
using MoMoney.Service.Infrastructure.Eventing;
namespace momoney.modules
{
public class TaskTrayPresenter :
- IModule,
+ Presenter,
EventSubscriber<SavedChangesEvent>,
EventSubscriber<StartedRunningCommand>,
EventSubscriber<FinishedRunningCommand>,
@@ -20,7 +21,7 @@ namespace momoney.modules
this.view = view;
}
- public void run()
+ public void present(Shell shell)
{
view.display("Welcome!");
view.display("Visit http://mokhan.ca for more information!");
product/client/presentation/Views/INotificationIconView.cs
@@ -1,12 +1,12 @@
-using System;
-using MoMoney.Presentation.Winforms.Resources;
-
-namespace momoney.presentation.views
-{
- public interface INotificationIconView : IDisposable
- {
- void display(ApplicationIcon icon_to_display, string text_to_display);
- void opened_new_project();
- void show_popup_message(string message);
- }
+using momoney.presentation.presenters;
+using MoMoney.Presentation.Winforms.Resources;
+
+namespace momoney.presentation.views
+{
+ public interface INotificationIconView : View<NotificationIconPresenter>
+ {
+ void display(ApplicationIcon icon_to_display, string text_to_display);
+ void opened_new_project();
+ void show_popup_message(string message);
+ }
}
\ No newline at end of file
product/client/presentation/Views/ISplashScreenView.cs
@@ -1,11 +1,11 @@
-namespace momoney.presentation.views
-{
- public interface ISplashScreenView
- {
- void increment_the_opacity();
- double current_opacity();
- void decrement_the_opacity();
- void close_the_screen();
- void display();
- }
+namespace momoney.presentation.views
+{
+ public interface ISplashScreenView : View
+ {
+ void increment_the_opacity();
+ double current_opacity();
+ void decrement_the_opacity();
+ void close_the_screen();
+ void display();
+ }
}
\ No newline at end of file
product/client/presentation/Views/IStatusBarView.cs
@@ -1,11 +1,13 @@
-using MoMoney.Presentation.Winforms.Resources;
-using momoney.service.infrastructure.threading;
-
-namespace MoMoney.Presentation.Views
-{
- public interface IStatusBarView : ITimerClient
- {
- void display(HybridIcon icon_to_display, string text_to_display);
- void reset_progress_bar();
- }
+using momoney.presentation.presenters;
+using momoney.presentation.views;
+using MoMoney.Presentation.Winforms.Resources;
+using momoney.service.infrastructure.threading;
+
+namespace MoMoney.Presentation.Views
+{
+ public interface IStatusBarView : ITimerClient, View<StatusBarPresenter>
+ {
+ void display(HybridIcon icon_to_display, string text_to_display);
+ void reset_progress_bar();
+ }
}
\ No newline at end of file
product/client/presentation/Winforms/Views/AddCompanyView.cs
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
-using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.utility;
using MoMoney.DTO;
using MoMoney.Presentation.Presenters;
@@ -16,15 +15,13 @@ namespace MoMoney.Presentation.Winforms.Views
{
public partial class AddCompanyView : ApplicationDockedWindow, IAddCompanyView
{
- ControlAction<EventArgs> submit_button;// = x => {};
+ ControlAction<EventArgs> submit_button = x => {};
readonly RegisterNewCompany dto;
- Guid id = Guid.NewGuid();
public AddCompanyView()
{
InitializeComponent();
- titled("Add A Company")
- .icon(ApplicationIcons.AddCompany);
+ titled("Add A Company").icon(ApplicationIcons.AddCompany);
dto = new RegisterNewCompany();
companiesListView.View = View.LargeIcon;
@@ -33,29 +30,20 @@ namespace MoMoney.Presentation.Winforms.Views
companiesListView.Columns.Add("Name");
ux_company_name.bind_to(dto, x => x.company_name);
- ux_submit_button.Click += (x, y) =>
- {
- this.submit_button(y);
- };
+ ux_submit_button.Click += (x, y) => submit_button(y);
ux_cancel_button.Click += (x, y) => Close();
}
public void attach_to(AddCompanyPresenter presenter)
{
- this.log().debug("attaching add company presenter");
- this.submit_button = x =>
+ submit_button = x =>
{
- this.log().debug("clicked on submit button");
presenter.submit(dto);
};
}
public void run(IEnumerable<CompanyDTO> companies)
{
- companies.each(x =>
- {
- this.log().debug("{0}", x.name);
- });
companiesListView.Items.Clear();
companiesListView.Items.AddRange(companies.Select(x => new ListViewItem(x.name, 0)).ToArray());
}
product/client/presentation/Winforms/Views/NotificationIconView.cs
@@ -1,76 +1,102 @@
-using System.Windows.Forms;
-using gorilla.commons.utility;
-using MoMoney.Presentation.Model.Menu;
-using MoMoney.Presentation.Model.Menu.File;
-using MoMoney.Presentation.Model.Menu.Help;
-using MoMoney.Presentation.Model.Menu.window;
-using momoney.presentation.views;
-using MoMoney.Presentation.Winforms.Resources;
-using MenuItem=System.Windows.Forms.MenuItem;
-
-namespace MoMoney.Presentation.Winforms.Views
-{
- public class NotificationIconView : INotificationIconView
- {
- readonly IFileMenu file_menu;
- readonly IWindowMenu window_menu;
- readonly IHelpMenu help_menu;
- readonly IRegionManager shell;
-
- public NotificationIconView(IFileMenu file_menu, IWindowMenu window_menu, IHelpMenu help_menu, IRegionManager shell)
- {
- this.file_menu = file_menu;
- this.shell = shell;
- this.window_menu = window_menu;
- this.help_menu = help_menu;
- Application.ApplicationExit += (sender, e) => Dispose();
- }
-
- public void display(ApplicationIcon icon_to_display, string text_to_display)
- {
- shell.region<NotifyIcon>(x =>
- {
- x.Icon = icon_to_display;
- x.Text = text_to_display;
- x.ContextMenu = new ContextMenu
- {
- MenuItems =
- {
- map_from(file_menu),
- map_from(window_menu),
- map_from(help_menu)
- }
- };
- });
- }
-
- public void opened_new_project()
- {
- show_popup_message("If you need any help check out mokhan.ca");
- }
-
- public void show_popup_message(string message)
- {
- shell.region<NotifyIcon>(x => x.ShowBalloonTip(100, message, message, ToolTipIcon.Info));
- }
-
- MenuItem map_from(ISubMenu item)
- {
- var menu_item = new MenuItem(item.name);
- item.all_menu_items().each(x => menu_item.MenuItems.Add(x.build_menu_item()));
- return menu_item;
- }
-
- public void Dispose()
- {
- shell.region<NotifyIcon>(x =>
- {
- if (x != null)
- {
- x.Visible = false;
- x.Dispose();
- }
- });
- }
- }
+using System;
+using System.Windows.Forms;
+using gorilla.commons.utility;
+using MoMoney.Presentation.Model.Menu;
+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.views;
+using MoMoney.Presentation.Winforms.Resources;
+using MenuItem = System.Windows.Forms.MenuItem;
+
+namespace MoMoney.Presentation.Winforms.Views
+{
+ public class NotificationIconView : INotificationIconView
+ {
+ IFileMenu file_menu;
+ IWindowMenu window_menu;
+ IHelpMenu help_menu;
+ IRegionManager shell;
+
+ public NotificationIconView()
+ {
+ Application.ApplicationExit += (sender, e) => Dispose();
+ }
+
+ public void attach_to(NotificationIconPresenter presenter)
+ {
+ this.shell = presenter.shell;
+ this.file_menu = presenter.file_menu;
+ this.window_menu = presenter.window_menu;
+ this.help_menu = presenter.help_menu;
+ }
+
+ public void display(ApplicationIcon icon_to_display, string text_to_display)
+ {
+ shell.region<NotifyIcon>(x =>
+ {
+ x.Icon = icon_to_display;
+ x.Text = text_to_display;
+ x.ContextMenu = new ContextMenu
+ {
+ MenuItems =
+ {
+ map_from(file_menu),
+ map_from(window_menu),
+ map_from(help_menu)
+ }
+ };
+ });
+ }
+
+ public void opened_new_project()
+ {
+ show_popup_message("If you need any help check out mokhan.ca");
+ }
+
+ public void show_popup_message(string message)
+ {
+ shell.region<NotifyIcon>(x => x.ShowBalloonTip(100, message, message, ToolTipIcon.Info));
+ }
+
+ MenuItem map_from(ISubMenu item)
+ {
+ var menu_item = new MenuItem(item.name);
+ item.all_menu_items().each(x => menu_item.MenuItems.Add(x.build_menu_item()));
+ return menu_item;
+ }
+
+ public void Dispose()
+ {
+ shell.region<NotifyIcon>(x =>
+ {
+ if (x != null)
+ {
+ x.Visible = false;
+ x.Dispose();
+ }
+ });
+ }
+
+ public IAsyncResult BeginInvoke(Delegate method, object[] args)
+ {
+ throw new NotImplementedException();
+ }
+
+ public object EndInvoke(IAsyncResult result)
+ {
+ throw new NotImplementedException();
+ }
+
+ public object Invoke(Delegate method, object[] args)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool InvokeRequired
+ {
+ get { throw new NotImplementedException(); }
+ }
+ }
}
\ No newline at end of file
product/client/presentation/Winforms/Views/StatusBarView.cs
@@ -1,4 +1,6 @@
+using System;
using System.Windows.Forms;
+using momoney.presentation.presenters;
using momoney.presentation.views;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
@@ -7,30 +9,58 @@ namespace MoMoney.Presentation.Winforms.Views
{
public class StatusBarView : IStatusBarView
{
- readonly IRegionManager shell;
+ IRegionManager shell;
- public StatusBarView(IRegionManager shell)
+ public void attach_to(StatusBarPresenter presenter)
{
- this.shell = shell;
+ shell = presenter.shell;
}
public void display(HybridIcon icon_to_display, string text_to_display)
{
shell.region<ToolStripStatusLabel>(x =>
- {
- x.Text = text_to_display;
- x.Image = icon_to_display;
- });
+ {
+ x.Text = text_to_display;
+ x.Image = icon_to_display;
+ });
}
public void reset_progress_bar()
{
- shell.region<ToolStripProgressBar>(x => { x.ProgressBar.Value = 0; });
+ shell.region<ToolStripProgressBar>(x =>
+ {
+ x.ProgressBar.Value = 0;
+ });
}
public void notify()
{
- shell.region<ToolStripProgressBar>(x => { x.Increment(10); });
+ shell.region<ToolStripProgressBar>(x =>
+ {
+ x.Increment(10);
+ });
}
+
+ public IAsyncResult BeginInvoke(Delegate method, object[] args)
+ {
+ throw new NotImplementedException();
+ }
+
+ public object EndInvoke(IAsyncResult result)
+ {
+ throw new NotImplementedException();
+ }
+
+ public object Invoke(Delegate method, object[] args)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool InvokeRequired
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public void Dispose() {}
}
}
\ No newline at end of file
product/client/presentation/Presentation.csproj
@@ -119,7 +119,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="core\CachedPresenterFactory.cs" />
- <Compile Include="core\ViewRegistry.cs" />
+ <Compile Include="core\CachingViewFactory.cs" />
<Compile Include="core\DialogPresenter.cs" />
<Compile Include="core\PresenterFactory.cs" />
<Compile Include="core\ViewFactory.cs" />
@@ -133,6 +133,9 @@
<Compile Include="model\reporting\IBindReportTo.cs" />
<Compile Include="PresentationAssembly.cs" />
<Compile Include="presenters\CommandFactory.cs" />
+ <Compile Include="presenters\NotificationIconPresenter.cs" />
+ <Compile Include="presenters\StatusBarPresenter.cs" />
+ <Compile Include="presenters\StatusBarPresenterSpecs.cs" />
<Compile Include="presenters\SynchronizedCommandFactory.cs" />
<Compile Include="presenters\CommandPump.cs" />
<Compile Include="core\ApplicationController.cs" />
@@ -141,7 +144,6 @@
<Compile Include="core\TabPresenter.cs" />
<Compile Include="core\IContentPresenter.cs" />
<Compile Include="core\Presenter.cs" />
- <Compile Include="core\PresenterRegistry.cs" />
<Compile Include="IModule.cs" />
<Compile Include="model\filesystem\folder.cs" />
<Compile Include="model\menu\create.cs" />
@@ -201,6 +203,7 @@
<Compile Include="presenters\AddCompanyPresenterSpecs.cs" />
<Compile Include="presenters\AddBillPaymentPresenter.cs" />
<Compile Include="presenters\IRunPresenterCommand.cs" />
+ <Compile Include="presenters\TaskTrayPresenter.cs" />
<Compile Include="presenters\UnhandledErrorPresenter.cs" />
<Compile Include="presenters\ViewAllBillsPresenter.cs" />
<Compile Include="presenters\RestartCommand.cs" />
product/commons/infrastructure/container/Resolve.cs
@@ -1,31 +1,31 @@
-using System;
-
-namespace Gorilla.Commons.Infrastructure.Container
-{
- static public class Resolve
- {
- static DependencyRegistry underlying_registry;
-
- static public void initialize_with(DependencyRegistry registry)
- {
- underlying_registry = registry;
- }
-
- static public DependencyToResolve the<DependencyToResolve>()
- {
- try
- {
- return underlying_registry.get_a<DependencyToResolve>();
- }
- catch (Exception e)
- {
- throw new DependencyResolutionException<DependencyToResolve>(e);
- }
- }
-
- static public bool is_initialized()
- {
- return underlying_registry != null;
- }
- }
+using System;
+
+namespace Gorilla.Commons.Infrastructure.Container
+{
+ static public class Resolve
+ {
+ static DependencyRegistry underlying_registry;
+
+ static public void initialize_with(DependencyRegistry registry)
+ {
+ underlying_registry = registry;
+ }
+
+ static public DependencyToResolve the<DependencyToResolve>()
+ {
+ try
+ {
+ return underlying_registry.get_a<DependencyToResolve>();
+ }
+ catch (Exception e)
+ {
+ throw new DependencyResolutionException<DependencyToResolve>(e);
+ }
+ }
+
+ static public bool is_initialized()
+ {
+ return underlying_registry != null;
+ }
+ }
}
\ No newline at end of file
product/commons/infrastructure.thirdparty/autofac/AutofacDependencyRegistry.cs
@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-using Autofac;
-using Gorilla.Commons.Infrastructure.Container;
-
-namespace gorilla.commons.infrastructure.thirdparty.autofac
-{
- internal class AutofacDependencyRegistry : DependencyRegistry
- {
- readonly Func<IContainer> container;
-
- public AutofacDependencyRegistry(Func<IContainer> container)
- {
- this.container = container;
- }
-
- public Interface get_a<Interface>()
- {
- return container().Resolve<Interface>();
- }
-
- public IEnumerable<Interface> get_all<Interface>()
- {
- return container().Resolve<IEnumerable<Interface>>();
- }
- }
+using System;
+using System.Collections.Generic;
+using Autofac;
+using Gorilla.Commons.Infrastructure.Container;
+
+namespace gorilla.commons.infrastructure.thirdparty.autofac
+{
+ internal class AutofacDependencyRegistry : DependencyRegistry
+ {
+ readonly Func<IContainer> container;
+
+ public AutofacDependencyRegistry(Func<IContainer> container)
+ {
+ this.container = container;
+ }
+
+ public Interface get_a<Interface>()
+ {
+ return container().Resolve<Interface>();
+ }
+
+ public IEnumerable<Interface> get_all<Interface>()
+ {
+ return container().Resolve<IEnumerable<Interface>>();
+ }
+ }
}
\ No newline at end of file
product/commons/utility/NumericConversions.cs
@@ -1,22 +1,22 @@
-using System;
-
-namespace gorilla.commons.utility
-{
- public static class NumericConversions
- {
- public static int to_int<T>(this T item) where T : IConvertible
- {
- return Convert.ChangeType(item, typeof (int)).downcast_to<int>();
- }
-
- public static long to_long<T>(this T item) where T : IConvertible
- {
- return Convert.ChangeType(item, typeof (long)).downcast_to<long>();
- }
-
- public static double to_double<T>(this T item) where T : IConvertible
- {
- return Convert.ChangeType(item, typeof (double)).downcast_to<double>();
- }
- }
+using System;
+
+namespace gorilla.commons.utility
+{
+ public static class NumericConversions
+ {
+ public static int to_int<T>(this T item) where T : IConvertible
+ {
+ return Convert.ChangeType(item, typeof (int)).downcast_to<int>();
+ }
+
+ public static long to_long<T>(this T item) where T : IConvertible
+ {
+ return Convert.ChangeType(item, typeof (long)).downcast_to<long>();
+ }
+
+ public static double to_double<T>(this T item) where T : IConvertible
+ {
+ return Convert.ChangeType(item, typeof (double)).downcast_to<double>();
+ }
+ }
}
\ No newline at end of file
product/commons/utility/TypeExtensions.cs
@@ -1,40 +1,40 @@
-using System;
-using System.Linq;
-using System.Reflection;
-
-namespace gorilla.commons.utility
-{
- public static class TypeExtensions
- {
- public static Type last_interface(this Type type)
- {
- return type.GetInterfaces()[type.GetInterfaces().Length - 1];
- }
-
- public static Type first_interface(this Type type)
- {
- return type.GetInterfaces()[0];
- }
-
- public static bool is_a_generic_type(this Type type)
- {
- //return type.IsGenericType;
- return type.IsGenericTypeDefinition;
- }
-
- public static object default_value(this Type type)
- {
- return (type.IsValueType ? Activator.CreateInstance(type) : null);
- }
-
- public static Attribute get_attribute<Attribute>(this ICustomAttributeProvider provider)
- where Attribute : System.Attribute
- {
- return
- provider
- .GetCustomAttributes(typeof (Attribute), false)
- .Select(x => x.downcast_to<Attribute>())
- .First();
- }
- }
+using System;
+using System.Linq;
+using System.Reflection;
+
+namespace gorilla.commons.utility
+{
+ public static class TypeExtensions
+ {
+ public static Type last_interface(this Type type)
+ {
+ return type.GetInterfaces()[type.GetInterfaces().Length - 1];
+ }
+
+ public static Type first_interface(this Type type)
+ {
+ return type.GetInterfaces()[0];
+ }
+
+ public static bool is_a_generic_type(this Type type)
+ {
+ //return type.IsGenericType;
+ return type.IsGenericTypeDefinition;
+ }
+
+ public static object default_value(this Type type)
+ {
+ return (type.IsValueType ? Activator.CreateInstance(type) : null);
+ }
+
+ public static Attribute get_attribute<Attribute>(this ICustomAttributeProvider provider)
+ where Attribute : System.Attribute
+ {
+ return
+ provider
+ .GetCustomAttributes(typeof (Attribute), false)
+ .Select(x => x.downcast_to<Attribute>())
+ .First();
+ }
+ }
}
\ No newline at end of file