Commit 62a4b92
Changed files (84)
product
Boot
boot
Modules
database
Domain
Accounting
Core
Repositories
Presentation
Model
Menu
Presenters
Winforms
Service
service.infrastructure
product/Boot/boot/container/registration/mapping/Mappers.cs
@@ -6,8 +6,8 @@ namespace MoMoney.boot.container.registration.mapping
{
public class Mappers
{
- static public Mapper<IBill, BillInformationDTO> bill_mapper =
- new Map<IBill, BillInformationDTO>()
+ static public Mapper<Bill, BillInformationDTO> bill_mapper =
+ new Map<Bill, BillInformationDTO>()
.initialize_mapping_using(() => new BillInformationDTO())
.map(x => x.company_to_pay.name, y => y.company_name)
.map(x => x.the_amount_owed.ToString(), y => y.the_amount_owed)
product/Boot/boot/container/registration/wire_up_the_mappers_in_to_the.cs
@@ -18,16 +18,18 @@ namespace MoMoney.boot.container.registration
public void run()
{
registry.transient(typeof (Mapper<,>), typeof (AnonymousMapper<,>));
- registry.singleton<Converter<IBill, BillInformationDTO>>(
- () => x => new BillInformationDTO
- {
- company_name = x.company_to_pay.name,
- the_amount_owed = x.the_amount_owed.ToString(),
- due_date = x.due_date.to_date_time(),
- });
- registry.singleton<Converter<ICompany, CompanyDTO>>(() => x => new CompanyDTO {id = x.id, name = x.name});
+ //registry.singleton(()=> Mappers.bill_mapper);
+ registry.singleton<Converter<Bill, BillInformationDTO>>(
+ () => x =>
+ new BillInformationDTO
+ {
+ company_name = x.company_to_pay.name,
+ the_amount_owed = x.the_amount_owed.ToString(),
+ due_date = x.due_date.to_date_time(),
+ });
+ registry.singleton<Converter<Company, CompanyDTO>>(() => x => new CompanyDTO {id = x.id, name = x.name});
- registry.singleton<Converter<IIncome, IncomeInformationDTO>>(
+ registry.singleton<Converter<Income, IncomeInformationDTO>>(
() => x => new IncomeInformationDTO
{
amount = x.amount_tendered.to_string(),
product/Boot/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -11,6 +11,7 @@ using MoMoney.Presentation.Model.Menu.Help;
using MoMoney.Presentation.Model.Menu.window;
using momoney.presentation.presenters;
using MoMoney.Presentation.Views;
+using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.boot.container.registration
{
@@ -31,7 +32,7 @@ namespace MoMoney.boot.container.registration
public void run(Assembly item)
{
Func<IApplicationController> target =
- () => new ApplicationController(Lazy.load<IShell>(), Lazy.load<PresenterFactory>());
+ () => new ApplicationController(Lazy.load<IShell>(), Lazy.load<PresenterFactory>(), Lazy.load<IEventAggregator>());
registry.proxy<IApplicationController, SynchronizedConfiguration<IApplicationController>>(target.memorize());
registry.transient(typeof (IRunThe<>), typeof (RunThe<>));
registry.transient<IFileMenu, FileMenu>();
product/Boot/boot/container/registration/wire_up_the_services_in_to_the.cs
@@ -29,14 +29,14 @@ namespace MoMoney.boot.container.registration
{
registry.proxy<IGetAllCompanysQuery, ServiceLayerConfiguration<IGetAllCompanysQuery>>(
() =>
- new GetAllCompanysQuery(Lazy.load<ICompanyRepository>(), Lazy.load<Mapper<ICompany, CompanyDTO>>()));
+ new GetAllCompanysQuery(Lazy.load<ICompanyRepository>(), Lazy.load<Mapper<Company, CompanyDTO>>()));
registry.proxy<IGetAllBillsQuery, ServiceLayerConfiguration<IGetAllBillsQuery>>(
() =>
- new GetAllBillsQuery(Lazy.load<IBillRepository>(), Lazy.load<Mapper<IBill, BillInformationDTO>>()));
+ new GetAllBillsQuery(Lazy.load<IBillRepository>(), Lazy.load<Mapper<Bill, BillInformationDTO>>()));
registry.proxy<IGetAllIncomeQuery, ServiceLayerConfiguration<IGetAllIncomeQuery>>(
() =>
new GetAllIncomeQuery(Lazy.load<IIncomeRepository>(),
- Lazy.load<Mapper<IIncome, IncomeInformationDTO>>()));
+ Lazy.load<Mapper<Income, IncomeInformationDTO>>()));
registry.proxy<IGetTheCurrentCustomerQuery, ServiceLayerConfiguration<IGetTheCurrentCustomerQuery>>(
() => new GetTheCurrentCustomerQuery(Lazy.load<IAccountHolderRepository>()));
}
product/Boot/boot/container/registration/wire_up_the_views_in_to_the.cs
@@ -24,7 +24,6 @@ namespace MoMoney.boot.container.registration
register.singleton<IWin32Window>(() => shell);
register.singleton<ISynchronizeInvoke>(() => shell);
register.singleton<IRegionManager>(() => shell);
- //register.proxy<IShell, SynchronizedConfiguration<IShell>>(() => shell);
register.singleton(() => shell);
register.transient<IAboutApplicationView, AboutTheApplicationView>();
register.transient<ISplashScreenView, SplashScreenView>();
product/Boot/boot/container/ComponentExclusionSpecification.cs
@@ -1,6 +1,11 @@
using System;
+using System.Windows.Forms;
+using Gorilla.Commons.Infrastructure.Container;
using gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration;
using gorilla.commons.utility;
+using MoMoney.Domain.Core;
+using MoMoney.Presentation;
+using MoMoney.Presentation.Core;
namespace MoMoney.boot.container
{
@@ -9,11 +14,13 @@ namespace MoMoney.boot.container
public bool is_satisfied_by(Type type)
{
return type.has_no_interfaces()
- .or(type.subclasses_form())
- .or(type.is_an_implementation_of_dependency_registry())
- .or(type.is_an_entity())
+ .or(type.is_a<Form>())
+ .or(type.is_a<DependencyRegistry>())
+ .or(type.is_a<Entity>())
.or(type.is_an_interface())
.or(type.is_abstract())
+ .or(type.is_a<IPresenter>())
+ .or(type.is_a<IModule>())
.is_satisfied_by(type);
}
}
product/Boot/boot/container/type_extensions.cs
@@ -1,8 +1,5 @@
using System;
-using System.Windows.Forms;
-using Gorilla.Commons.Infrastructure.Container;
using gorilla.commons.utility;
-using MoMoney.Domain.Core;
namespace MoMoney.boot.container
{
@@ -13,19 +10,9 @@ namespace MoMoney.boot.container
return new PredicateSpecification<Type>(x => x.GetInterfaces().Length == 0);
}
- static public Specification<Type> subclasses_form(this Type item)
+ static public Specification<Type> is_a<T>(this Type item)
{
- return new PredicateSpecification<Type>(x => typeof (Form).IsAssignableFrom(x));
- }
-
- static public Specification<Type> is_an_implementation_of_dependency_registry(this Type item)
- {
- return new PredicateSpecification<Type>(x => typeof (DependencyRegistry).IsAssignableFrom(x));
- }
-
- static public Specification<Type> is_an_entity(this Type item)
- {
- return new PredicateSpecification<Type>(x => typeof (Entity).IsAssignableFrom(x));
+ return new PredicateSpecification<Type>(x => typeof (T).IsAssignableFrom(x));
}
static public Specification<Type> is_an_interface(this Type item)
product/Boot/Modules/Core/LoadPresentationModulesCommand.cs
@@ -1,23 +1,31 @@
+using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.utility;
using MoMoney.Presentation;
-using MoMoney.Service.Infrastructure.Threading;
+using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Modules.Core
{
public class LoadPresentationModulesCommand : ILoadPresentationModulesCommand
{
- readonly Registry<IModule> registry;
- readonly CommandProcessor processor;
+ Registry<IModule> registry;
+ IEventAggregator broker;
- public LoadPresentationModulesCommand(Registry<IModule> registry, CommandProcessor processor)
+ public LoadPresentationModulesCommand(Registry<IModule> registry, IEventAggregator broker)
{
this.registry = registry;
- this.processor = processor;
+ this.broker = broker;
}
public void run()
{
- registry.all().each(x => processor.add(x));
+ registry
+ .all()
+ .each(x =>
+ {
+ this.log().debug("loading... {0}", x);
+ broker.subscribe(x);
+ x.run();
+ });
}
}
}
\ No newline at end of file
product/Boot/Modules/Core/LoadPresentationModulesCommandSpecs.cs
@@ -2,28 +2,28 @@ using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;
using gorilla.commons.utility;
using MoMoney.Presentation;
-using MoMoney.Service.Infrastructure.Threading;
namespace MoMoney.Modules.Core
{
- [Concern(typeof (LoadPresentationModulesCommand))]
- public class when_loading_the_application_shell :
- concerns_for<ILoadPresentationModulesCommand, LoadPresentationModulesCommand>
+ public class LoadPresentationModulesCommandSpecs
{
- it should_initialize_all_the_presentation_modules = () => processor.was_told_to(x => x.add(module));
-
- context c = () =>
+ [Concern(typeof (LoadPresentationModulesCommand))]
+ public class when_loading_the_application_shell :
+ concerns_for<ILoadPresentationModulesCommand, LoadPresentationModulesCommand>
{
- registry = the_dependency<Registry<IModule>>();
- processor = the_dependency<CommandProcessor>();
- module = an<IModule>();
- when_the(registry).is_told_to(r => r.all()).it_will_return(module);
- };
+ it should_initialize_all_the_presentation_modules = () => module.was_told_to(x => x.run());
+
+ context c = () =>
+ {
+ registry = the_dependency<Registry<IModule>>();
+ module = an<IModule>();
+ when_the(registry).is_told_to(r => r.all()).it_will_return(module);
+ };
- because b = () => sut.run();
+ because b = () => sut.run();
- static Registry<IModule> registry;
- static IModule module;
- static CommandProcessor processor;
+ static Registry<IModule> registry;
+ static IModule module;
+ }
}
}
\ No newline at end of file
product/Boot/Modules/ApplicationMenuModule.cs
@@ -1,3 +1,4 @@
+using MoMoney.Presentation;
using momoney.presentation.model.eventing;
using MoMoney.Presentation.Model.Menu;
using momoney.presentation.presenters;
@@ -6,7 +7,12 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Modules
{
- public class ApplicationMenuModule : IApplicationMenuModule
+ public class ApplicationMenuModule :
+ IModule,
+ IEventSubscriber<NewProjectOpened>,
+ IEventSubscriber<ClosingProjectEvent>,
+ IEventSubscriber<SavedChangesEvent>,
+ IEventSubscriber<UnsavedChangesEvent>
{
readonly IEventAggregator broker;
readonly IRunPresenterCommand command;
@@ -19,7 +25,6 @@ namespace MoMoney.Modules
public void run()
{
- broker.subscribe(this);
command.run<ApplicationMenuPresenter>();
}
product/Boot/Modules/GettingStartedModule.cs
@@ -6,37 +6,31 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Modules
{
- public interface IGettingStartedModule : IModule,
- IEventSubscriber<NewProjectOpened>,
- IEventSubscriber<ClosingProjectEvent>
+ public class GettingStartedModule :
+ IModule,
+ IEventSubscriber<NewProjectOpened>,
+ IEventSubscriber<ClosingProjectEvent>
{
- }
-
- public class GettingStartedModule : IGettingStartedModule
- {
- readonly IEventAggregator broker;
- readonly IRunPresenterCommand command;
+ IRunPresenterCommand command;
- public GettingStartedModule(IEventAggregator broker, IRunPresenterCommand command)
+ public GettingStartedModule(IRunPresenterCommand command)
{
- this.broker = broker;
this.command = command;
}
public void run()
{
- broker.subscribe(this);
command.run<GettingStartedPresenter>();
}
public void notify(NewProjectOpened message)
{
- command.run<GettingStartedPresenter>();
+ run();
}
public void notify(ClosingProjectEvent message)
{
- command.run<GettingStartedPresenter>();
+ run();
}
}
}
\ No newline at end of file
product/Boot/Modules/GettingStartedModuleSpecs.cs
@@ -1,31 +0,0 @@
-using developwithpassion.bdd.contexts;
-using Gorilla.Commons.Testing;
-using MoMoney.Presentation.Presenters;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace MoMoney.Modules
-{
- public class GettingStartedModuleSpecs
- {
- public class behaves_like_the_getting_started_module :
- concerns_for<IGettingStartedModule, GettingStartedModule>
- {
- context c = () =>
- {
- broker = the_dependency<IEventAggregator>();
- command = the_dependency<IRunPresenterCommand>();
- };
-
- static protected IEventAggregator broker;
- static protected IRunPresenterCommand command;
- }
-
- public class when_initializing_the_getting_started_module : behaves_like_the_getting_started_module
- {
- it should_start_listening_for_when_a_new_project_is_started =
- () => broker.was_told_to(x => x.subscribe((GettingStartedModule) sut));
-
- because b = () => sut.run();
- }
- }
-}
\ No newline at end of file
product/Boot/Modules/IApplicationMenuModule.cs
@@ -1,14 +0,0 @@
-using MoMoney.Presentation;
-using momoney.presentation.model.eventing;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace MoMoney.Modules
-{
- public interface IApplicationMenuModule : IModule,
- IEventSubscriber<NewProjectOpened>,
- IEventSubscriber<ClosingProjectEvent>,
- IEventSubscriber<SavedChangesEvent>,
- IEventSubscriber<UnsavedChangesEvent>
- {
- }
-}
\ No newline at end of file
product/Boot/Modules/IMainMenuModule.cs
@@ -1,10 +0,0 @@
-using MoMoney.Presentation;
-using momoney.presentation.model.eventing;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace MoMoney.Modules
-{
- public interface IMainMenuModule : IModule, IEventSubscriber<NewProjectOpened>
- {
- }
-}
\ No newline at end of file
product/Boot/Modules/IToolbarModule.cs
@@ -1,14 +0,0 @@
-using MoMoney.Presentation;
-using momoney.presentation.model.eventing;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace MoMoney.Modules
-{
- public interface IToolbarModule : IModule,
- IEventSubscriber<NewProjectOpened>,
- IEventSubscriber<ClosingProjectEvent>,
- IEventSubscriber<SavedChangesEvent>,
- IEventSubscriber<UnsavedChangesEvent>
- {
- }
-}
\ No newline at end of file
product/Boot/Modules/MainMenuModule.cs
@@ -1,23 +1,21 @@
+using MoMoney.Presentation;
using momoney.presentation.model.eventing;
using MoMoney.Presentation.Presenters;
using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Modules
{
- public class MainMenuModule : IMainMenuModule
+ public class MainMenuModule : IModule, IEventSubscriber<NewProjectOpened>
{
- readonly IEventAggregator broker;
readonly IRunPresenterCommand command;
- public MainMenuModule(IEventAggregator broker, IRunPresenterCommand command)
+ public MainMenuModule(IRunPresenterCommand command)
{
- this.broker = broker;
this.command = command;
}
public void run()
{
- broker.subscribe_to(this);
}
public void notify(NewProjectOpened message)
product/Boot/Modules/ToolbarModule.cs
@@ -1,3 +1,4 @@
+using MoMoney.Presentation;
using momoney.presentation.model.eventing;
using MoMoney.Presentation.Model.Menu;
using momoney.presentation.presenters;
@@ -6,7 +7,12 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Modules
{
- public class ToolbarModule : IToolbarModule
+ public class ToolbarModule :
+ IModule,
+ IEventSubscriber<NewProjectOpened>,
+ IEventSubscriber<ClosingProjectEvent>,
+ IEventSubscriber<SavedChangesEvent>,
+ IEventSubscriber<UnsavedChangesEvent>
{
readonly IEventAggregator broker;
readonly IRunPresenterCommand command;
@@ -19,28 +25,32 @@ namespace MoMoney.Modules
public void run()
{
- broker.subscribe(this);
command.run<ToolBarPresenter>();
}
public void notify(NewProjectOpened message)
+ {
+ refresh_toolbar();
+ }
+
+ void refresh_toolbar()
{
broker.publish<IToolbarButton>(x => x.refresh());
}
public void notify(ClosingProjectEvent message)
{
- broker.publish<IToolbarButton>(x => x.refresh());
+ refresh_toolbar();
}
public void notify(SavedChangesEvent message)
{
- broker.publish<IToolbarButton>(x => x.refresh());
+ refresh_toolbar();
}
public void notify(UnsavedChangesEvent message)
{
- broker.publish<IToolbarButton>(x => x.refresh());
+ refresh_toolbar();
}
}
}
\ No newline at end of file
product/Boot/Boot.csproj
@@ -166,15 +166,10 @@
<Compile Include="modules\core\ILoadPresentationModulesCommand.cs" />
<Compile Include="modules\DatabaseModule.cs" />
<Compile Include="modules\ApplicationMenuModule.cs" />
- <Compile Include="modules\IApplicationMenuModule.cs" />
<Compile Include="modules\IDatabaseModule.cs" />
- <Compile Include="modules\IMainMenuModule.cs" />
- <Compile Include="modules\INavigationModule.cs" />
- <Compile Include="modules\IToolbarModule.cs" />
<Compile Include="modules\MainMenuModule.cs" />
<Compile Include="modules\NavigationModule.cs" />
<Compile Include="modules\GettingStartedModule.cs" />
- <Compile Include="modules\GettingStartedModuleSpecs.cs" />
<Compile Include="modules\ToolbarModule.cs" />
<Compile Include="modules\core\LoadPresentationModulesCommandSpecs.cs" />
<Compile Include="boot\hookup.cs" />
product/database/repositories/AccountHolderRepository.cs
@@ -14,12 +14,12 @@ namespace momoney.database.repositories
this.session = session;
}
- public IEnumerable<IAccountHolder> all()
+ public IEnumerable<AccountHolder> all()
{
- return session.all<IAccountHolder>();
+ return session.all<AccountHolder>();
}
- public void save(IAccountHolder account_holder)
+ public void save(AccountHolder account_holder)
{
session.save(account_holder);
}
product/database/repositories/BillRepository.cs
@@ -14,9 +14,9 @@ namespace momoney.database.repositories
this.session = session;
}
- public IEnumerable<IBill> all()
+ public IEnumerable<Bill> all()
{
- return session.all<IBill>();
+ return session.all<Bill>();
}
}
}
\ No newline at end of file
product/database/repositories/CompanyRepository.cs
@@ -17,22 +17,22 @@ namespace momoney.database.repositories
this.session = session;
}
- public IEnumerable<ICompany> all()
+ public IEnumerable<Company> all()
{
- return session.all<ICompany>();
+ return session.all<Company>();
}
- public ICompany find_company_named(string name)
+ public Company find_company_named(string name)
{
return all().SingleOrDefault(x => x.name.is_equal_to_ignoring_case(name));
}
- public ICompany find_company_by(Guid id)
+ public Company find_company_by(Guid id)
{
return all().SingleOrDefault(x => x.id.Equals(id));
}
- public void save(ICompany company)
+ public void save(Company company)
{
session.save(company);
}
product/database/repositories/IncomeRepository.cs
@@ -14,9 +14,9 @@ namespace momoney.database.repositories
this.session = session;
}
- public IEnumerable<IIncome> all()
+ public IEnumerable<Income> all()
{
- return session.all<IIncome>();
+ return session.all<Income>();
}
}
}
\ No newline at end of file
product/Domain/Accounting/AccountHolder.cs
@@ -7,32 +7,18 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.accounting
{
- public interface IAccountHolder : Entity
- {
- void receive(IBill bill);
- void receive(IIncome income);
- IEnumerable<IBill> collect_all_the_unpaid_bills();
- Money calculate_income_for(Year year);
- }
-
[Serializable]
- public class AccountHolder : GenericEntity<IAccountHolder>, IAccountHolder
+ public class AccountHolder : GenericEntity<AccountHolder>
{
- IList<IBill> all_bills { get; set; }
- IList<IIncome> income_collected { get; set; }
-
- public AccountHolder()
- {
- all_bills = new List<IBill>();
- income_collected = new List<IIncome>();
- }
+ IList<Bill> all_bills = new List<Bill>();
+ IList<Income> income_collected = new List<Income>();
- public void receive(IBill bill)
+ public void receive(Bill bill)
{
all_bills.Add(bill);
}
- public IEnumerable<IBill> collect_all_the_unpaid_bills()
+ public IEnumerable<Bill> collect_all_the_unpaid_bills()
{
return all_bills.where(bill => bill.is_not_paid());
}
@@ -42,7 +28,7 @@ namespace MoMoney.Domain.accounting
return income_collected.in_the(year);
}
- public void receive(IIncome income)
+ public void receive(Income income)
{
income_collected.Add(income);
}
product/Domain/Accounting/AccountHolderSpecs.cs
@@ -5,17 +5,18 @@ using Gorilla.Commons.Testing;
using Gorilla.Commons.Utility;
using MoMoney.Domain.Accounting;
using MoMoney.Domain.Core;
+using Rhino.Mocks;
namespace MoMoney.Domain.accounting
{
public class AccountHolderSpecs
{
[Concern(typeof (AccountHolder))]
- public abstract class behaves_like_an_account_holder : concerns_for<IAccountHolder, AccountHolder>
+ public abstract class concern : concerns_for<AccountHolder>
{
}
- public class when_a_customer_is_checking_for_any_bills_that_have_not_been_paid : behaves_like_an_account_holder
+ public class when_a_customer_is_checking_for_any_bills_that_have_not_been_paid : concern
{
it should_return_all_the_unpaid_bills = () =>
{
@@ -25,9 +26,9 @@ namespace MoMoney.Domain.accounting
context c = () =>
{
- first_unpaid_bill = an<IBill>();
- second_unpaid_bill = an<IBill>();
- paid_bill = an<IBill>();
+ first_unpaid_bill = an<Bill>();
+ second_unpaid_bill = an<Bill>();
+ paid_bill = an<Bill>();
first_unpaid_bill.is_told_to(x => x.is_paid_for()).it_will_return(false);
second_unpaid_bill.is_told_to(x => x.is_paid_for()).it_will_return(false);
@@ -42,20 +43,20 @@ namespace MoMoney.Domain.accounting
result = sut.collect_all_the_unpaid_bills();
};
- static IEnumerable<IBill> result;
- static IBill first_unpaid_bill;
- static IBill second_unpaid_bill;
- static IBill paid_bill;
+ static IEnumerable<Bill> result;
+ static Bill first_unpaid_bill;
+ static Bill second_unpaid_bill;
+ static Bill paid_bill;
}
[Concern(typeof (AccountHolder))]
- public class when_an_account_holder_is_calculating_their_income_for_a_year : behaves_like_an_account_holder
+ public class when_an_account_holder_is_calculating_their_income_for_a_year : concern
{
context c = () =>
{
- income_for_january_2007 = an<IIncome>();
- income_for_february_2007 = an<IIncome>();
- income_for_february_2008 = an<IIncome>();
+ income_for_january_2007 = MockRepository.GenerateMock<Income>();
+ income_for_february_2007 = MockRepository.GenerateMock<Income>();
+ income_for_february_2008 = MockRepository.GenerateMock<Income>();
income_for_january_2007.is_told_to(x => x.date_of_issue).it_will_return<Date>(new DateTime(2007, 01, 01));
income_for_january_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
@@ -78,9 +79,9 @@ namespace MoMoney.Domain.accounting
it should_return_the_correct_amount = () => result.should_be_equal_to(2000.as_money());
static Money result;
- static IIncome income_for_january_2007;
- static IIncome income_for_february_2007;
- static IIncome income_for_february_2008;
+ static Income income_for_january_2007;
+ static Income income_for_february_2007;
+ static Income income_for_february_2008;
}
}
}
\ No newline at end of file
product/Domain/Accounting/AnnualIncomeVisitor.cs
@@ -4,7 +4,7 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
- public class AnnualIncomeVisitor : ValueReturningVisitor<Money, IIncome>
+ public class AnnualIncomeVisitor : ValueReturningVisitor<Money, Income>
{
readonly Year year;
@@ -14,7 +14,7 @@ namespace MoMoney.Domain.Accounting
reset();
}
- public void visit(IIncome x)
+ public void visit(Income x)
{
if (x.date_of_issue.is_in(year)) value = value.add(x.amount_tendered);
}
product/Domain/Accounting/Bill.cs
@@ -1,77 +1,43 @@
using System;
using System.Collections.Generic;
+using gorilla.commons.utility;
using Gorilla.Commons.Utility;
using MoMoney.Domain.Core;
-using gorilla.commons.utility;
namespace MoMoney.Domain.Accounting
{
- public interface IBill : Entity
- {
- bool is_paid_for();
- void pay(Money amount_to_pay);
- ICompany company_to_pay { get; }
- Money the_amount_owed { get; }
- Date due_date { get; }
- }
-
[Serializable]
- public class Bill : GenericEntity<IBill>, IBill
+ public class Bill : GenericEntity<Bill>
{
- IList<IPayment> payments { get; set; }
+ IList<Payment> payments = new List<Payment>();
- public Bill(ICompany company_to_pay, Money the_amount_owed, DateTime due_date)
+ static public Bill New(Company company, Money for_amount, DateTime that_is_due_on)
{
- this.company_to_pay = company_to_pay;
- this.the_amount_owed = the_amount_owed;
- this.due_date = due_date;
- payments = new List<IPayment>();
+ return new Bill
+ {
+ company_to_pay = company,
+ the_amount_owed = for_amount,
+ due_date = that_is_due_on
+ };
}
- public ICompany company_to_pay { get; private set; }
- public Money the_amount_owed { get; private set; }
- public Date due_date { get; private set; }
+ public virtual Company company_to_pay { get; private set; }
+ public virtual Money the_amount_owed { get; private set; }
+ public virtual Date due_date { get; private set; }
- public bool is_paid_for()
+ public virtual bool is_paid_for()
{
return the_amount_paid().Equals(the_amount_owed);
}
- public void pay(Money amount_to_pay)
+ public virtual void pay(Money amount_to_pay)
{
- payments.Add(new Payment(amount_to_pay));
+ payments.Add(Payment.New(amount_to_pay));
}
Money the_amount_paid()
{
return payments.return_value_from_visiting_all_with(new TotalPaymentsCalculator());
}
-
- public bool Equals(Bill obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- return Equals(obj.company_to_pay, company_to_pay) && Equals(obj.the_amount_owed, the_amount_owed) &&
- obj.due_date.Equals(due_date);
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Bill)) return false;
- return Equals((Bill) obj);
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- var result = (company_to_pay != null ? company_to_pay.GetHashCode() : 0);
- result = (result*397) ^ (the_amount_owed != null ? the_amount_owed.GetHashCode() : 0);
- result = (result*397) ^ due_date.GetHashCode();
- return result;
- }
- }
}
}
\ No newline at end of file
product/Domain/Accounting/BillingExtensions.cs
@@ -2,7 +2,7 @@ namespace MoMoney.Domain.Accounting
{
public static class BillingExtensions
{
- public static bool is_not_paid(this IBill bill)
+ public static bool is_not_paid(this Bill bill)
{
return !bill.is_paid_for();
}
product/Domain/Accounting/BillSpecs.cs
@@ -6,30 +6,30 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
[Concern(typeof (Bill))]
- public class when_checking_to_see_if_a_new_bill_has_been_paid_for : concerns_for<IBill>
+ public class when_checking_to_see_if_a_new_bill_has_been_paid_for : concerns_for<Bill>
{
it should_return_false = () => result.should_be_equal_to(false);
- public override IBill create_sut()
+ public override Bill create_sut()
{
- return new Bill(enmax, amount_owed, DateTime.Now);
+ return Bill.New(enmax, amount_owed, DateTime.Now);
}
context c = () =>
{
amount_owed = new Money(100);
- enmax = an<ICompany>();
+ enmax = an<Company>();
};
because b = () => { result = sut.is_paid_for(); };
static bool result;
static Money amount_owed;
- static ICompany enmax;
+ static Company enmax;
}
[Concern(typeof (Bill))]
- public class when_checking_if_a_paid_bill_has_been_paid_for : concerns_for<IBill>
+ public class when_checking_if_a_paid_bill_has_been_paid_for : concerns_for<Bill>
{
it should_return_true = () => result.should_be_equal_to(true);
@@ -37,7 +37,7 @@ namespace MoMoney.Domain.Accounting
context c = () =>
{
one_hundred_twenty_three_dollars_fourty_five_cents = new Money(123, 45);
- direct_energy = an<ICompany>();
+ direct_energy = an<Company>();
};
because b = () =>
@@ -46,37 +46,36 @@ namespace MoMoney.Domain.Accounting
result = sut.is_paid_for();
};
- public override IBill create_sut()
+ public override Bill create_sut()
{
- return new Bill(direct_energy, one_hundred_twenty_three_dollars_fourty_five_cents, DateTime.Now);
+ return Bill.New(direct_energy, one_hundred_twenty_three_dollars_fourty_five_cents, DateTime.Now);
}
static Money one_hundred_twenty_three_dollars_fourty_five_cents;
static bool result;
- static ICompany direct_energy;
+ static Company direct_energy;
}
- [Concern(typeof (Bill))]
- public class when_checking_if_two_bills_are_the_same_and_they_are : concerns_for<IBill>
- {
- it should_return_true = () => result.should_be_equal_to(true);
+ //[Concern(typeof (Bill))]
+ //public class when_checking_if_two_bills_are_the_same_and_they_are : concerns_for<Bill>
+ //{
+ // it should_return_true = () => result.should_be_true();
+ // context c = () =>
+ // {
+ // company = an<Company>();
+ // due_date = new DateTime(2008, 01, 01);
+ // };
- context c = () =>
- {
- company = an<ICompany>();
- due_date = new DateTime(2008, 01, 01);
- };
+ // because b = () => { result = sut.Equals( Bill.New(company, new Money(0), due_date)); };
- because b = () => { result = sut.Equals(new Bill(company, new Money(0), due_date)); };
+ // public override Bill create_sut()
+ // {
+ // return Bill.New(company, new Money(0), due_date);
+ // }
- public override IBill create_sut()
- {
- return new Bill(company, new Money(0), due_date);
- }
-
- static ICompany company;
- static DateTime due_date;
- static bool result;
- }
+ // static Company company;
+ // static DateTime due_date;
+ // static bool result;
+ //}
}
\ No newline at end of file
product/Domain/Accounting/Company.cs
@@ -5,16 +5,8 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
- public interface ICompany : Entity
- {
- string name { get; }
- void change_name_to(string company_name);
- void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount);
- void pay(IAccountHolder person, Money amount, Date date_of_payment);
- }
-
[Serializable]
- public class Company : GenericEntity<ICompany>, ICompany
+ public class Company : GenericEntity<Company>
{
public string name { get; private set; }
@@ -23,14 +15,14 @@ namespace MoMoney.Domain.Accounting
name = company_name;
}
- public void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount)
+ public void issue_bill_to(AccountHolder customer, DateTime that_is_due_on, Money for_amount)
{
- customer.receive(new Bill(this, for_amount, that_is_due_on));
+ customer.receive( Bill.New(this, for_amount, that_is_due_on));
}
- public void pay(IAccountHolder person, Money amount, Date date_of_payment)
+ public void pay(AccountHolder person, Money amount, Date date_of_payment)
{
- person.receive(new Income(date_of_payment, amount, this));
+ person.receive( Income.New(date_of_payment, amount, this));
}
public override string ToString()
product/Domain/Accounting/CompanyFactory.cs
@@ -3,7 +3,7 @@ using MoMoney.Domain.repositories;
namespace MoMoney.Domain.Accounting
{
- public interface ICompanyFactory : Factory<ICompany> {}
+ public interface ICompanyFactory : Factory<Company> {}
public class CompanyFactory : ICompanyFactory
{
@@ -16,7 +16,7 @@ namespace MoMoney.Domain.Accounting
this.companys = companys;
}
- public ICompany create()
+ public Company create()
{
var company = factory.create();
companys.save(company);
product/Domain/Accounting/GeneralLedger.cs
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using gorilla.commons.utility;
-using MoMoney.Domain.Accounting;
-using MoMoney.Domain.Core;
-
-namespace MoMoney.Domain.accounting
-{
- public interface IGeneralLedger
- {
- IEnumerable<ILedgerEntry> get_all_the_entries_for(IMonth month);
- }
-
- [Serializable]
- public class GeneralLedger : IGeneralLedger
- {
- readonly List<ILedgerEntry> entries;
-
- public GeneralLedger(List<ILedgerEntry> entries)
- {
- this.entries = entries;
- }
-
- public IEnumerable<ILedgerEntry> get_all_the_entries_for(IMonth month)
- {
- return entries.where(x => month.represents(x.entry_date()));
- }
- }
-}
\ No newline at end of file
product/Domain/Accounting/GeneralLedgerSpecs.cs
@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-using developwithpassion.bdd.contexts;
-using Gorilla.Commons.Testing;
-using MoMoney.Domain.Accounting;
-using MoMoney.Domain.Core;
-
-namespace MoMoney.Domain.accounting
-{
- [Concern(typeof (GeneralLedger))]
- public abstract class behaves_like_a_general_ledger : concerns_for<IGeneralLedger, GeneralLedger>
- {
- public override IGeneralLedger create_sut()
- {
- return new GeneralLedger(new List<ILedgerEntry> {february_first, february_twenty_first, april_first});
- }
-
- context c = () =>
- {
- february_first = an<ILedgerEntry>();
- february_twenty_first = an<ILedgerEntry>();
- april_first = an<ILedgerEntry>();
- };
-
- protected static ILedgerEntry february_first;
- protected static ILedgerEntry february_twenty_first;
- protected static ILedgerEntry april_first;
- }
-
- public class when_retrieving_all_the_entries_for_a_month_in_the_past : behaves_like_a_general_ledger
- {
- it should_return_all_the_entries_posted_for_that_month = () =>
- {
- result.should_contain(february_first);
- result.should_contain(february_twenty_first);
- };
-
- it should_not_return_any_entries_that_were_not_posted_for_that_month =
- () => result.should_not_contain(april_first);
-
- context c = () =>
- {
- february_first = an<ILedgerEntry>();
- february_twenty_first = an<ILedgerEntry>();
- april_first = an<ILedgerEntry>();
-
- february_first.is_told_to(x => x.entry_date()).it_will_return(new DateTime(2008, 02, 01));
- february_twenty_first.is_told_to(x => x.entry_date()).it_will_return(new DateTime(2008, 02, 21));
- april_first.is_told_to(x => x.entry_date()).it_will_return(new DateTime(2008, 04, 01));
- };
-
- because b = () => { result = sut.get_all_the_entries_for(Months.February); };
-
- static IEnumerable<ILedgerEntry> result;
- }
-}
\ No newline at end of file
product/Domain/Accounting/ILedgerEntry.cs
@@ -1,9 +0,0 @@
-using System;
-
-namespace MoMoney.Domain.Accounting
-{
- public interface ILedgerEntry
- {
- DateTime entry_date();
- }
-}
\ No newline at end of file
product/Domain/Accounting/Income.cs
@@ -4,52 +4,21 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
- public interface IIncome : Entity
- {
- Date date_of_issue { get; }
- Money amount_tendered { get; }
- ICompany company { get; }
- }
-
[Serializable]
- internal class Income : GenericEntity<IIncome>, IIncome
+ public class Income : GenericEntity<Income>
{
- public Income(Date date_of_issue, Money amount_tendered, ICompany company)
- {
- this.company = company;
- this.amount_tendered = amount_tendered;
- this.date_of_issue = date_of_issue;
- }
-
- public ICompany company { get; private set; }
- public Money amount_tendered { get; private set; }
- public Date date_of_issue { get; private set; }
-
- public bool Equals(Income obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- return Equals(obj.company, company) && Equals(obj.amount_tendered, amount_tendered) &&
- Equals(obj.date_of_issue, date_of_issue);
- }
-
- public override bool Equals(object obj)
+ static public Income New(Date date, Money amount, Company company)
{
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Income)) return false;
- return Equals((Income) obj);
+ return new Income
+ {
+ company = company,
+ amount_tendered = amount,
+ date_of_issue = date
+ };
}
- public override int GetHashCode()
- {
- unchecked
- {
- var result = (company != null ? company.GetHashCode() : 0);
- result = (result*397) ^ (amount_tendered != null ? amount_tendered.GetHashCode() : 0);
- result = (result*397) ^ (date_of_issue != null ? date_of_issue.GetHashCode() : 0);
- return result;
- }
- }
+ public virtual Company company { get; private set; }
+ public virtual Money amount_tendered { get; private set; }
+ public virtual Date date_of_issue { get; private set; }
}
}
\ No newline at end of file
product/Domain/Accounting/IncomeExtensions.cs
@@ -7,7 +7,7 @@ namespace MoMoney.Domain.Accounting
{
static public class IncomeExtensions
{
- static public Money in_the(this IEnumerable<IIncome> income_collected, Year year)
+ static public Money in_the(this IEnumerable<Income> income_collected, Year year)
{
return income_collected.return_value_from_visiting_all_with(new AnnualIncomeVisitor(year));
}
product/Domain/Accounting/Payment.cs
@@ -3,25 +3,18 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
- public interface IPayment : Entity
- {
- Money apply_to(Money money);
- }
-
[Serializable]
- internal class Payment : GenericEntity<IPayment>, IPayment
+ class Payment : GenericEntity<Payment>
{
- Money amount_paid { get; set; }
-
- public Payment(Money amount_paid)
+ static public Payment New(Money amount)
{
- this.amount_paid = amount_paid;
+ return new Payment
+ {
+ amount_paid = amount
+ };
}
- public Money apply_to(Money money)
- {
- return money.add(amount_paid);
- }
+ public Money amount_paid { get; set; }
public bool Equals(Payment obj)
{
product/Domain/Accounting/TotalPaymentsCalculator.cs
@@ -3,16 +3,16 @@ using MoMoney.Domain.Core;
namespace MoMoney.Domain.Accounting
{
- class TotalPaymentsCalculator : ValueReturningVisitor<Money, IPayment>
+ class TotalPaymentsCalculator : ValueReturningVisitor<Money, Payment>
{
public TotalPaymentsCalculator()
{
reset();
}
- public void visit(IPayment payment)
+ public void visit(Payment payment)
{
- value = payment.apply_to(value);
+ value = value.add(payment.amount_paid);
}
public Money value { get; private set; }
product/Domain/Core/GenericEntity.cs
@@ -11,9 +11,9 @@ namespace MoMoney.Domain.Core
id = Guid.NewGuid();
}
- public Id<Guid> id { get; private set; }
+ public virtual Id<Guid> id { get; private set; }
- public bool Equals(GenericEntity<T> obj)
+ public virtual bool Equals(GenericEntity<T> obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
@@ -24,7 +24,7 @@ namespace MoMoney.Domain.Core
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (GenericEntity<T>)) return false;
+ if (!(obj is GenericEntity<T>)) return false;
return Equals((GenericEntity<T>) obj);
}
product/Domain/Repositories/IAccountHolderRepository.cs
@@ -5,7 +5,7 @@ namespace MoMoney.Domain.repositories
{
public interface IAccountHolderRepository
{
- IEnumerable<IAccountHolder> all();
- void save(IAccountHolder account_holder);
+ IEnumerable<AccountHolder> all();
+ void save(AccountHolder account_holder);
}
}
\ No newline at end of file
product/Domain/Repositories/IBillRepository.cs
@@ -5,6 +5,6 @@ namespace MoMoney.Domain.repositories
{
public interface IBillRepository
{
- IEnumerable<IBill> all();
+ IEnumerable<Bill> all();
}
}
\ No newline at end of file
product/Domain/Repositories/ICompanyRepository.cs
@@ -6,9 +6,9 @@ namespace MoMoney.Domain.repositories
{
public interface ICompanyRepository
{
- IEnumerable<ICompany> all();
- ICompany find_company_named(string name);
- ICompany find_company_by(Guid id);
- void save(ICompany company);
+ IEnumerable<Company> all();
+ Company find_company_named(string name);
+ Company find_company_by(Guid id);
+ void save(Company company);
}
}
\ No newline at end of file
product/Domain/Repositories/IIncomeRepository.cs
@@ -5,6 +5,6 @@ namespace MoMoney.Domain.repositories
{
public interface IIncomeRepository
{
- IEnumerable<IIncome> all();
+ IEnumerable<Income> all();
}
}
\ No newline at end of file
product/Domain/Domain.csproj
@@ -72,12 +72,9 @@
<Compile Include="accounting\BillSpecs.cs" />
<Compile Include="accounting\Company.cs" />
<Compile Include="accounting\CompanyFactory.cs" />
- <Compile Include="accounting\ILedgerEntry.cs" />
<Compile Include="accounting\Income.cs" />
<Compile Include="accounting\Payment.cs" />
<Compile Include="accounting\TotalPaymentsCalculator.cs" />
- <Compile Include="accounting\GeneralLedger.cs" />
- <Compile Include="accounting\GeneralLedgerSpecs.cs" />
<Compile Include="accounting\AnnualIncomeVisitor.cs" />
<Compile Include="accounting\IncomeExtensions.cs" />
<Compile Include="core\GenericEntity.cs" />
product/Presentation/Core/ApplicationController.cs
@@ -1,4 +1,5 @@
using MoMoney.Presentation.Views;
+using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Presentation.Core
{
@@ -11,16 +12,20 @@ namespace MoMoney.Presentation.Core
{
IShell shell;
PresenterFactory presenter_factory;
+ IEventAggregator broker;
- public ApplicationController(IShell shell, PresenterFactory presenter_factory)
+ public ApplicationController(IShell shell, PresenterFactory presenter_factory, IEventAggregator broker)
{
this.presenter_factory = presenter_factory;
+ this.broker = broker;
this.shell = shell;
}
public void run<Presenter>() where Presenter : IPresenter
{
- presenter_factory.create<Presenter>().present(shell);
+ var presenter = presenter_factory.create<Presenter>();
+ broker.subscribe(presenter);
+ presenter.present(shell);
}
}
}
\ No newline at end of file
product/Presentation/Core/CachedPresenterFactory.cs
@@ -1,3 +1,4 @@
+using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.utility;
namespace MoMoney.Presentation.Core
@@ -9,18 +10,20 @@ namespace MoMoney.Presentation.Core
public class CachedPresenterFactory : PresenterFactory
{
- IPresenterRegistry registered_presenters;
+ IPresenterRegistry presenters;
ViewFactory view_factory;
- public CachedPresenterFactory(IPresenterRegistry registered_presenters, ViewFactory view_factory)
+ public CachedPresenterFactory(IPresenterRegistry presenters, ViewFactory view_factory)
{
- this.registered_presenters = registered_presenters;
+ this.presenters = presenters;
this.view_factory = view_factory;
}
public Presenter create<Presenter>() where Presenter : IPresenter
{
- var presenter = registered_presenters.find_an_implementation_of<IPresenter, Presenter>();
+ presenters.each(x => this.log().debug("registered presenter: {0}", x));
+ this.log().debug("creating... {0}", typeof (Presenter));
+ var presenter = presenters.find_an_implementation_of<IPresenter, Presenter>();
view_factory.create_for<Presenter>().attach_to(presenter);
return presenter;
}
product/Presentation/Core/CachingViewFactory.cs
@@ -1,3 +1,4 @@
+using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.utility;
using momoney.presentation.views;
@@ -19,6 +20,8 @@ namespace MoMoney.Presentation.Core
public IView<Presenter> create_for<Presenter>() where Presenter : IPresenter
{
+ views.each(x => this.log().debug("registered view: {0}", x));
+ this.log().debug("creating a view for {0}", typeof (Presenter));
return views.find_an_implementation_of<IView, IView<Presenter>>();
}
}
product/Presentation/Model/Menu/File/ISaveChangesCallback.cs
@@ -0,0 +1,9 @@
+namespace MoMoney.Presentation.Model.Menu.File
+{
+ public interface ISaveChangesCallback
+ {
+ void saved();
+ void not_saved();
+ void cancelled();
+ }
+}
\ No newline at end of file
product/Presentation/Model/Menu/File/SaveChangesCommand.cs
@@ -17,13 +17,6 @@ namespace MoMoney.Presentation.Model.Menu.File
void cancel();
}
- public interface ISaveChangesCallback
- {
- void saved();
- void not_saved();
- void cancelled();
- }
-
public class SaveChangesCommand : ISaveChangesCommand, ISaveChangesPresenter
{
readonly IProjectController current_project;
product/Presentation/Presenters/AddCompanyPresenter.cs
@@ -22,9 +22,8 @@ namespace MoMoney.Presentation.Presenters
public void submit(RegisterNewCompany dto)
{
- pump
- .run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto)
- .run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
+ pump.run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto);
+ pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
}
}
}
\ No newline at end of file
product/Presentation/Presenters/ApplicationShellPresenter.cs
@@ -1,3 +1,4 @@
+using System;
using MoMoney.Presentation.Core;
using momoney.presentation.model.eventing;
using momoney.presentation.model.menu.file;
@@ -8,29 +9,32 @@ namespace momoney.presentation.presenters
{
public class ApplicationShellPresenter : IPresenter, IEventSubscriber<ClosingProjectEvent>
{
- IShell shell;
- IEventAggregator broker;
- IExitCommand command;
+ IExitCommand command;
+
+ Action shutdown = () =>
+ {
+ };
protected ApplicationShellPresenter()
{
}
- public ApplicationShellPresenter(IEventAggregator broker, IShell shell, IExitCommand command)
+ public ApplicationShellPresenter(IExitCommand command)
{
- this.broker = broker;
this.command = command;
- this.shell = shell;
}
- public virtual void present(IShell shell1)
+ public virtual void present(IShell shell)
{
- broker.subscribe(this);
+ shutdown = () =>
+ {
+ shell.close_all_windows();
+ };
}
public virtual void notify(ClosingProjectEvent message)
{
- shell.close_all_windows();
+ shutdown();
}
public virtual void shut_down()
product/Presentation/Presenters/NotificationIconModule.cs
@@ -0,0 +1,37 @@
+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.presentation.presenters
+{
+ public class NotificationIconModule : IModule,
+ IEventSubscriber<ClosingTheApplication>,
+ IEventSubscriber<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/Presentation/Presenters/NotificationIconPresenter.cs
@@ -1,45 +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.presentation.presenters
-{
- public interface INotificationIconPresenter : IModule,
- IEventSubscriber<ClosingTheApplication>,
- IEventSubscriber<NewProjectOpened>
- {
- }
-
- public class NotificationIconPresenter : INotificationIconPresenter
- {
- readonly INotificationIconView view;
- readonly IEventAggregator broker;
-
- public NotificationIconPresenter(INotificationIconView view, IEventAggregator broker)
- {
- this.view = view;
- this.broker = broker;
- }
-
- public void run()
- {
- broker.subscribe_to<ClosingTheApplication>(this);
- broker.subscribe_to<NewProjectOpened>(this);
- NetworkChange.NetworkAvailabilityChanged += (sender, args) => view.display(ApplicationIcons.Application, args.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/Presentation/Presenters/NotificationIconPresenterSpecs.cs
@@ -2,31 +2,24 @@ using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;
using momoney.presentation.views;
using MoMoney.Presentation.Winforms.Resources;
-using MoMoney.Service.Infrastructure.Eventing;
namespace momoney.presentation.presenters
{
- [Concern(typeof (NotificationIconPresenter))]
- public abstract class behaves_like_notification_icon_presenter : concerns_for<INotificationIconPresenter, NotificationIconPresenter>
+ [Concern(typeof (NotificationIconModule))]
+ public abstract class behaves_like_notification_icon_presenter : concerns_for<NotificationIconModule>
{
- //public override INotificationIconPresenter create_sut()
- //{
- // return new NotificationIconPresenter(view, broker);
- //}
-
context c = () =>
- {
- view = the_dependency<INotificationIconView>();
- broker = the_dependency<IEventAggregator>();
- };
+ {
+ view = the_dependency<INotificationIconView>();
+ };
- protected static INotificationIconView view;
- protected static IEventAggregator broker;
+ static protected INotificationIconView view;
}
public class when_initializing_the_notification_icon : behaves_like_notification_icon_presenter
{
- it should_ask_the_view_to_display_the_correct_icon_and_text = () => view.was_told_to(v => v.display(ApplicationIcons.Application, "mokhan.ca"));
+ 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();
}
product/Presentation/Presenters/StatusBarPresenter.cs โ product/Presentation/Presenters/StatusBarModule.cs
@@ -9,24 +9,21 @@ using MoMoney.Service.Infrastructure.Threading;
namespace MoMoney.Presentation.Presenters
{
- public interface IStatusBarPresenter : IModule,
- IEventSubscriber<SavedChangesEvent>,
- IEventSubscriber<NewProjectOpened>,
- IEventSubscriber<ClosingTheApplication>,
- IEventSubscriber<UnsavedChangesEvent>,
- IEventSubscriber<StartedRunningCommand>,
- IEventSubscriber<FinishedRunningCommand>,
- IEventSubscriber<ClosingProjectEvent>
- {
- }
-
- public class StatusBarPresenter : IStatusBarPresenter
+ public class StatusBarModule :
+ IModule,
+ IEventSubscriber<SavedChangesEvent>,
+ IEventSubscriber<NewProjectOpened>,
+ IEventSubscriber<ClosingTheApplication>,
+ IEventSubscriber<UnsavedChangesEvent>,
+ IEventSubscriber<StartedRunningCommand>,
+ IEventSubscriber<FinishedRunningCommand>,
+ IEventSubscriber<ClosingProjectEvent>
{
readonly IStatusBarView view;
readonly IEventAggregator broker;
readonly ITimer timer;
- public StatusBarPresenter(IStatusBarView view, IEventAggregator broker, ITimer timer)
+ public StatusBarModule(IStatusBarView view, IEventAggregator broker, ITimer timer)
{
this.view = view;
this.broker = broker;
@@ -35,7 +32,6 @@ namespace MoMoney.Presentation.Presenters
public void run()
{
- broker.subscribe(this);
view.display(ApplicationIcons.blue_circle, "...");
}
product/Presentation/Presenters/StatusBarPresenterSpecs.cs
@@ -6,16 +6,16 @@ using MoMoney.Presentation.Winforms.Resources;
namespace MoMoney.Presentation.Presenters
{
- [Concern(typeof (StatusBarPresenter))]
- public class when_initializing_the_status_bar : concerns_for<IStatusBarPresenter, StatusBarPresenter>
+ [Concern(typeof (StatusBarModule))]
+ public class when_initializing_the_status_bar : concerns_for<StatusBarModule>
{
it should_display_a_ready_message =
() => view.was_told_to(v => v.display(ApplicationIcons.green_circle, "Ready"));
context c = () =>
- {
- view = the_dependency<IStatusBarView>();
- };
+ {
+ view = the_dependency<IStatusBarView>();
+ };
because b = () => sut.notify(new NewProjectOpened(""));
product/Presentation/Presenters/TaskTrayPresenter.cs
@@ -6,31 +6,24 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace momoney.presentation.presenters
{
- public interface ITaskTrayPresenter : IModule,
- IEventSubscriber<SavedChangesEvent>,
- IEventSubscriber<StartedRunningCommand>,
- IEventSubscriber<FinishedRunningCommand>,
- IEventSubscriber<NewProjectOpened>
- {
- }
-
- public class TaskTrayPresenter : ITaskTrayPresenter
+ public class TaskTrayPresenter :
+ IModule,
+ IEventSubscriber<SavedChangesEvent>,
+ IEventSubscriber<StartedRunningCommand>,
+ IEventSubscriber<FinishedRunningCommand>,
+ IEventSubscriber<NewProjectOpened>
{
readonly ITaskTrayMessageView view;
- readonly IEventAggregator broker;
- public TaskTrayPresenter(ITaskTrayMessageView view, IEventAggregator broker)
+ public TaskTrayPresenter(ITaskTrayMessageView view)
{
this.view = view;
- this.broker = broker;
}
public void run()
{
view.display("Welcome!");
view.display("Visit http://mokhan.ca for more information!");
- broker.subscribe_to<SavedChangesEvent>(this);
- broker.subscribe_to<NewProjectOpened>(this);
}
public void notify(SavedChangesEvent message)
product/Presentation/Presenters/TitleBarPresenter.cs
@@ -1,4 +1,3 @@
-using Gorilla.Commons.Infrastructure.Logging;
using MoMoney.Presentation;
using momoney.presentation.model.eventing;
using MoMoney.Presentation.Model.Projects;
@@ -7,39 +6,29 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace momoney.presentation.presenters
{
- public interface ITitleBarPresenter : IModule,
- IEventSubscriber<UnsavedChangesEvent>,
- IEventSubscriber<SavedChangesEvent>,
- IEventSubscriber<NewProjectOpened>,
- IEventSubscriber<ClosingProjectEvent>
- {
- }
-
- public class TitleBarPresenter : ITitleBarPresenter
+ public class TitleBarPresenter :
+ IModule,
+ IEventSubscriber<UnsavedChangesEvent>,
+ IEventSubscriber<SavedChangesEvent>,
+ IEventSubscriber<NewProjectOpened>,
+ IEventSubscriber<ClosingProjectEvent>
{
readonly ITitleBar view;
readonly IProjectController project;
- readonly IEventAggregator broker;
- public TitleBarPresenter(ITitleBar view, IProjectController project, IEventAggregator broker)
+ public TitleBarPresenter(ITitleBar view, IProjectController project)
{
this.view = view;
this.project = project;
- this.broker = broker;
}
public void run()
{
view.display(project.name());
- broker.subscribe_to<UnsavedChangesEvent>(this);
- broker.subscribe_to<SavedChangesEvent>(this);
- broker.subscribe_to<NewProjectOpened>(this);
- broker.subscribe_to<ClosingProjectEvent>(this);
}
public void notify(UnsavedChangesEvent dto)
{
- this.log().debug("adding asterik");
view.append_asterik();
}
product/Presentation/Presenters/TitleBarPresenterSpecs.cs
@@ -8,7 +8,7 @@ using MoMoney.Service.Infrastructure.Eventing;
namespace momoney.presentation.presenters
{
[Concern(typeof (TitleBarPresenter))]
- public abstract class behaves_like_a_title_bar_presenter : concerns_for<ITitleBarPresenter, TitleBarPresenter>
+ public abstract class behaves_like_a_title_bar_presenter : concerns_for<TitleBarPresenter>
{
context c = () =>
{
@@ -26,15 +26,6 @@ namespace momoney.presentation.presenters
{
it should_display_the_name_of_the_file_that_is_opened = () => view.was_told_to(x => x.display("untitled.mo"));
- it should_ask_to_be_notified_of_any_unsaved_changes =
- () => broker.was_told_to(x => x.subscribe_to<UnsavedChangesEvent>(sut));
-
- it should_ask_to_be_notified_when_the_project_is_saved =
- () => broker.was_told_to(x => x.subscribe_to<SavedChangesEvent>(sut));
-
- it should_ask_to_be_notified_when_a_new_project_is_opened =
- () => broker.was_told_to(x => x.subscribe_to<NewProjectOpened>(sut));
-
context c = () => when_the(project).is_told_to(x => x.name()).it_will_return("untitled.mo");
because b = () => sut.run();
product/Presentation/Presenters/ToolBarPresenter.cs
@@ -22,7 +22,7 @@ namespace momoney.presentation.presenters
this.project = project;
}
- public void present(IShell shell1)
+ public void present(IShell shell)
{
shell.region<ToolStrip>(x => buttons().each(y => y.add_to(x)));
}
product/Presentation/Presenters/UnhandledErrorPresenter.cs
@@ -10,14 +10,12 @@ namespace momoney.presentation.presenters
public class UnhandledErrorPresenter : IModule, IPresenter, IEventSubscriber<UnhandledErrorOccurred>
{
readonly IUnhandledErrorView view;
- readonly IEventAggregator broker;
readonly IRestartCommand restart;
- public UnhandledErrorPresenter(IUnhandledErrorView view, IEventAggregator broker, IRestartCommand command)
+ public UnhandledErrorPresenter(IUnhandledErrorView view, IRestartCommand command)
{
this.view = view;
restart = command;
- this.broker = broker;
}
public void present(IShell shell)
@@ -36,7 +34,6 @@ namespace momoney.presentation.presenters
public void run()
{
- broker.subscribe_to(this);
}
}
}
\ No newline at end of file
product/Presentation/Presenters/UnhandledErrorPresenterSpecs.cs
@@ -19,13 +19,6 @@ namespace momoney.presentation.presenters
protected static IEventAggregator broker;
}
- public class when_the_presenter_is_run : behaves_like_unhandled_error_presenter
- {
- it should_listen_for_any_errors_in_the_application = () => broker.was_told_to(x => x.subscribe_to(sut));
-
- because b = () => sut.run();
- }
-
public class when_an_error_occurs_in_the_application : behaves_like_unhandled_error_presenter
{
it should_display_the_error = () => view.was_told_to(x => x.display(error));
product/Presentation/Winforms/Databinding/BindingSelector.cs
@@ -11,8 +11,8 @@ namespace MoMoney.Presentation.Winforms.Databinding
public class BindingSelector<TypeToBindTo> : IBindingSelector<TypeToBindTo>
{
- private readonly TypeToBindTo thing_to_bind_to;
- private readonly IPropertyInspectorFactory factory;
+ TypeToBindTo thing_to_bind_to;
+ IPropertyInspectorFactory factory;
public BindingSelector(TypeToBindTo thing_to_bind_to, IPropertyInspectorFactory factory)
{
@@ -23,8 +23,9 @@ namespace MoMoney.Presentation.Winforms.Databinding
public IPropertyBinder<TypeToBindTo, TypeOfProperty> bind_to_property<TypeOfProperty>(
Expression<Func<TypeToBindTo, TypeOfProperty>> property_to_bind_to)
{
- var property_information = factory.create<TypeToBindTo, TypeOfProperty>().inspect(property_to_bind_to);
- return new PropertyBinder<TypeToBindTo, TypeOfProperty>(property_information, thing_to_bind_to);
+ return
+ new PropertyBinder<TypeToBindTo, TypeOfProperty>(
+ factory.create<TypeToBindTo, TypeOfProperty>().inspect(property_to_bind_to), thing_to_bind_to);
}
}
}
\ No newline at end of file
product/Presentation/Winforms/Databinding/ControlBindingExtensions.cs
@@ -3,23 +3,23 @@ using System.Windows.Forms;
namespace MoMoney.Presentation.Winforms.Databinding
{
- public static class ControlBindingExtensions
+ static public class ControlBindingExtensions
{
- public static IPropertyBinding<PropertyType> bound_to_control<TypeToBindTo, PropertyType>(
+ static public IPropertyBinding<PropertyType> bound_to_control<TypeToBindTo, PropertyType>(
this IPropertyBinder<TypeToBindTo, PropertyType> binder,
Control control)
{
return new TextPropertyBinding<TypeToBindTo, PropertyType>(control, binder);
}
- public static IPropertyBinding<PropertyType> bound_to_control<TypeToBindTo, PropertyType>(
+ static public IPropertyBinding<PropertyType> bound_to_control<TypeToBindTo, PropertyType>(
this IPropertyBinder<TypeToBindTo, PropertyType> binder,
ComboBox control)
{
return new ComboBoxPropertyBinding<TypeToBindTo, PropertyType>(control, binder);
}
- public static IPropertyBinding<DateTime> bound_to_control<TypeToBindTo>(
+ static public IPropertyBinding<DateTime> bound_to_control<TypeToBindTo>(
this IPropertyBinder<TypeToBindTo, DateTime> binder,
DateTimePicker control)
{
product/Presentation/Winforms/Databinding/PropertyInspector.cs
@@ -14,8 +14,7 @@ namespace MoMoney.Presentation.Winforms.Databinding
{
public PropertyInfo inspect(Expression<Func<TypeToBindTo, TypeOfProperty>> property_to_bind_to)
{
- var expression = property_to_bind_to.Body.downcast_to<MemberExpression>();
- return expression.Member.downcast_to<PropertyInfo>();
+ return property_to_bind_to.Body.downcast_to<MemberExpression>().Member.downcast_to<PropertyInfo>();
}
}
}
\ No newline at end of file
product/Presentation/Winforms/Views/AboutTheApplicationView.cs
@@ -24,8 +24,6 @@ namespace MoMoney.Presentation.Winforms.Views
ux_logo.Image = ApplicationImages.Splash;
}
- public void display() {}
-
string assembly_version
{
get { return GetType().Assembly.GetName().Version.ToString(); }
product/Presentation/Winforms/Views/AddCompanyView.cs
@@ -24,10 +24,10 @@ namespace MoMoney.Presentation.Winforms.Views
.icon(ApplicationIcons.AddCompany);
dto = new RegisterNewCompany();
- listView1.View = View.LargeIcon;
- listView1.LargeImageList = new ImageList();
- ApplicationIcons.all().each(x => listView1.LargeImageList.Images.Add(x.name_of_the_icon, x));
- listView1.Columns.Add("Name");
+ companiesListView.View = View.LargeIcon;
+ companiesListView.LargeImageList = new ImageList();
+ ApplicationIcons.all().each(x => companiesListView.LargeImageList.Images.Add(x.name_of_the_icon, x));
+ companiesListView.Columns.Add("Name");
ux_submit_button.Click += (x, y) => submit_button(y);
ux_cancel_button.Click += (x, y) => Close();
@@ -41,10 +41,8 @@ namespace MoMoney.Presentation.Winforms.Views
public void run(IEnumerable<CompanyDTO> companies)
{
- ux_companys_listing.DataSource = companies.databind();
-
- listView1.Items.Clear();
- listView1.Items.AddRange(companies.Select(x => new ListViewItem(x.name, 0)).ToArray());
+ companiesListView.Items.Clear();
+ companiesListView.Items.AddRange(companies.Select(x => new ListViewItem(x.name, 0)).ToArray());
}
}
}
\ No newline at end of file
product/Presentation/Winforms/Views/AddCompanyView.Designer.cs
@@ -28,42 +28,39 @@ namespace MoMoney.Presentation.Winforms.Views
/// </summary>
private void InitializeComponent()
{
- var resources = new System.ComponentModel.ComponentResourceManager(typeof(AddCompanyView));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddCompanyView));
this.kryptonHeaderGroup1 = new ComponentFactory.Krypton.Toolkit.KryptonHeaderGroup();
- this.ux_companys_listing = new ComponentFactory.Krypton.Toolkit.KryptonDataGridView();
- this.kryptonSplitContainer2 = new ComponentFactory.Krypton.Toolkit.KryptonSplitContainer();
- this.kryptonGroup1 = new ComponentFactory.Krypton.Toolkit.KryptonGroup();
- this.kryptonGroup2 = new ComponentFactory.Krypton.Toolkit.KryptonGroup();
this.kryptonSplitContainer1 = new ComponentFactory.Krypton.Toolkit.KryptonSplitContainer();
- this.listView1 = new System.Windows.Forms.ListView();
- this.ux_submit_button = new ComponentFactory.Krypton.Toolkit.KryptonButton();
- this.ux_company_name = new ComponentFactory.Krypton.Toolkit.KryptonTextBox();
- this.ux_cancel_button = new System.Windows.Forms.Button();
+ this.kryptonGroup2 = new ComponentFactory.Krypton.Toolkit.KryptonGroup();
+ this.companiesListView = new System.Windows.Forms.ListView();
+ this.kryptonGroup1 = new ComponentFactory.Krypton.Toolkit.KryptonGroup();
this.kryptonLabel1 = new ComponentFactory.Krypton.Toolkit.KryptonLabel();
+ this.ux_cancel_button = new System.Windows.Forms.Button();
+ this.ux_company_name = new ComponentFactory.Krypton.Toolkit.KryptonTextBox();
+ this.ux_submit_button = new ComponentFactory.Krypton.Toolkit.KryptonButton();
+ this.kryptonSplitContainer2 = new ComponentFactory.Krypton.Toolkit.KryptonSplitContainer();
((System.ComponentModel.ISupportInitialize)(this.kryptonHeaderGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.kryptonHeaderGroup1.Panel)).BeginInit();
this.kryptonHeaderGroup1.Panel.SuspendLayout();
this.kryptonHeaderGroup1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ux_companys_listing)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel2)).BeginInit();
- this.kryptonSplitContainer2.Panel2.SuspendLayout();
- this.kryptonSplitContainer2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1.Panel)).BeginInit();
- this.kryptonGroup1.Panel.SuspendLayout();
- this.kryptonGroup1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2.Panel)).BeginInit();
- this.kryptonGroup2.Panel.SuspendLayout();
- this.kryptonGroup2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1.Panel1)).BeginInit();
this.kryptonSplitContainer1.Panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1.Panel2)).BeginInit();
this.kryptonSplitContainer1.Panel2.SuspendLayout();
this.kryptonSplitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2.Panel)).BeginInit();
+ this.kryptonGroup2.Panel.SuspendLayout();
+ this.kryptonGroup2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1.Panel)).BeginInit();
+ this.kryptonGroup1.Panel.SuspendLayout();
+ this.kryptonGroup1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel2)).BeginInit();
+ this.kryptonSplitContainer2.SuspendLayout();
this.SuspendLayout();
//
// kryptonHeaderGroup1
@@ -87,39 +84,47 @@ namespace MoMoney.Presentation.Winforms.Views
this.kryptonHeaderGroup1.ValuesSecondary.Heading = "Description";
this.kryptonHeaderGroup1.ValuesSecondary.Image = null;
//
- // ux_companys_listing
+ // kryptonSplitContainer1
//
- this.ux_companys_listing.AllowUserToAddRows = false;
- this.ux_companys_listing.AllowUserToDeleteRows = false;
- this.ux_companys_listing.AllowUserToOrderColumns = true;
- this.ux_companys_listing.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.ux_companys_listing.Dock = System.Windows.Forms.DockStyle.Fill;
- this.ux_companys_listing.Location = new System.Drawing.Point(0, 0);
- this.ux_companys_listing.Name = "ux_companys_listing";
- this.ux_companys_listing.ReadOnly = true;
- this.ux_companys_listing.Size = new System.Drawing.Size(201, 584);
- this.ux_companys_listing.StateCommon.BackStyle = ComponentFactory.Krypton.Toolkit.PaletteBackStyle.GridBackgroundList;
- this.ux_companys_listing.TabIndex = 25;
+ this.kryptonSplitContainer1.Cursor = System.Windows.Forms.Cursors.Default;
+ this.kryptonSplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.kryptonSplitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.kryptonSplitContainer1.Name = "kryptonSplitContainer1";
//
- // kryptonSplitContainer2
+ // kryptonSplitContainer1.Panel1
//
- this.kryptonSplitContainer2.Cursor = System.Windows.Forms.Cursors.Default;
- this.kryptonSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.kryptonSplitContainer2.Location = new System.Drawing.Point(0, 0);
- this.kryptonSplitContainer2.Name = "kryptonSplitContainer2";
- this.kryptonSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ this.kryptonSplitContainer1.Panel1.Controls.Add(this.kryptonGroup2);
+ this.kryptonSplitContainer1.Panel1.Controls.Add(this.kryptonGroup1);
+ this.kryptonSplitContainer1.Panel1.PanelBackStyle = ComponentFactory.Krypton.Toolkit.PaletteBackStyle.FormMain;
//
- // kryptonSplitContainer2.Panel1
+ // kryptonSplitContainer1.Panel2
//
- this.kryptonSplitContainer2.Panel1.PanelBackStyle = ComponentFactory.Krypton.Toolkit.PaletteBackStyle.FormCustom1;
+ this.kryptonSplitContainer1.Panel2.Controls.Add(this.kryptonSplitContainer2);
+ this.kryptonSplitContainer1.SeparatorStyle = ComponentFactory.Krypton.Toolkit.SeparatorStyle.HighProfile;
+ this.kryptonSplitContainer1.Size = new System.Drawing.Size(776, 655);
+ this.kryptonSplitContainer1.SplitterDistance = 570;
+ this.kryptonSplitContainer1.TabIndex = 25;
+ //
+ // kryptonGroup2
//
- // kryptonSplitContainer2.Panel2
+ this.kryptonGroup2.Location = new System.Drawing.Point(9, 141);
+ this.kryptonGroup2.Margin = new System.Windows.Forms.Padding(2);
+ this.kryptonGroup2.Name = "kryptonGroup2";
//
- this.kryptonSplitContainer2.Panel2.Controls.Add(this.ux_companys_listing);
- this.kryptonSplitContainer2.SeparatorStyle = ComponentFactory.Krypton.Toolkit.SeparatorStyle.HighProfile;
- this.kryptonSplitContainer2.Size = new System.Drawing.Size(201, 655);
- this.kryptonSplitContainer2.SplitterDistance = 66;
- this.kryptonSplitContainer2.TabIndex = 26;
+ // kryptonGroup2.Panel
+ //
+ this.kryptonGroup2.Panel.Controls.Add(this.companiesListView);
+ this.kryptonGroup2.Size = new System.Drawing.Size(552, 273);
+ this.kryptonGroup2.TabIndex = 24;
+ //
+ // listView1
+ //
+ this.companiesListView.Location = new System.Drawing.Point(2, 34);
+ this.companiesListView.Margin = new System.Windows.Forms.Padding(2);
+ this.companiesListView.Name = "listView1";
+ this.companiesListView.Size = new System.Drawing.Size(550, 182);
+ this.companiesListView.TabIndex = 21;
+ this.companiesListView.UseCompatibleStateImageBehavior = false;
//
// kryptonGroup1
//
@@ -136,47 +141,34 @@ namespace MoMoney.Presentation.Winforms.Views
this.kryptonGroup1.Size = new System.Drawing.Size(532, 110);
this.kryptonGroup1.TabIndex = 23;
//
- // kryptonGroup2
- //
- this.kryptonGroup2.Location = new System.Drawing.Point(9, 141);
- this.kryptonGroup2.Margin = new System.Windows.Forms.Padding(2);
- this.kryptonGroup2.Name = "kryptonGroup2";
- //
- // kryptonGroup2.Panel
- //
- this.kryptonGroup2.Panel.Controls.Add(this.listView1);
- this.kryptonGroup2.Size = new System.Drawing.Size(552, 273);
- this.kryptonGroup2.TabIndex = 24;
- //
- // kryptonSplitContainer1
- //
- this.kryptonSplitContainer1.Cursor = System.Windows.Forms.Cursors.Default;
- this.kryptonSplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.kryptonSplitContainer1.Location = new System.Drawing.Point(0, 0);
- this.kryptonSplitContainer1.Name = "kryptonSplitContainer1";
- //
- // kryptonSplitContainer1.Panel1
+ // kryptonLabel1
//
- this.kryptonSplitContainer1.Panel1.Controls.Add(this.kryptonGroup2);
- this.kryptonSplitContainer1.Panel1.Controls.Add(this.kryptonGroup1);
- this.kryptonSplitContainer1.Panel1.PanelBackStyle = ComponentFactory.Krypton.Toolkit.PaletteBackStyle.FormMain;
+ this.kryptonLabel1.Location = new System.Drawing.Point(11, 21);
+ this.kryptonLabel1.Name = "kryptonLabel1";
+ this.kryptonLabel1.Size = new System.Drawing.Size(101, 20);
+ this.kryptonLabel1.TabIndex = 20;
+ this.kryptonLabel1.Text = "Company Name:";
+ this.kryptonLabel1.Values.ExtraText = "";
+ this.kryptonLabel1.Values.Image = null;
+ this.kryptonLabel1.Values.Text = "Company Name:";
//
- // kryptonSplitContainer1.Panel2
+ // ux_cancel_button
//
- this.kryptonSplitContainer1.Panel2.Controls.Add(this.kryptonSplitContainer2);
- this.kryptonSplitContainer1.SeparatorStyle = ComponentFactory.Krypton.Toolkit.SeparatorStyle.HighProfile;
- this.kryptonSplitContainer1.Size = new System.Drawing.Size(776, 655);
- this.kryptonSplitContainer1.SplitterDistance = 570;
- this.kryptonSplitContainer1.TabIndex = 25;
+ this.ux_cancel_button.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.ux_cancel_button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.ux_cancel_button.Location = new System.Drawing.Point(206, 63);
+ this.ux_cancel_button.Name = "ux_cancel_button";
+ this.ux_cancel_button.Size = new System.Drawing.Size(57, 25);
+ this.ux_cancel_button.TabIndex = 3;
+ this.ux_cancel_button.Text = "Cancel";
+ this.ux_cancel_button.UseVisualStyleBackColor = true;
//
- // listView1
+ // ux_company_name
//
- this.listView1.Location = new System.Drawing.Point(2, 34);
- this.listView1.Margin = new System.Windows.Forms.Padding(2);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(550, 182);
- this.listView1.TabIndex = 21;
- this.listView1.UseCompatibleStateImageBehavior = false;
+ this.ux_company_name.Location = new System.Drawing.Point(110, 21);
+ this.ux_company_name.Name = "ux_company_name";
+ this.ux_company_name.Size = new System.Drawing.Size(410, 20);
+ this.ux_company_name.TabIndex = 1;
//
// ux_submit_button
//
@@ -192,34 +184,21 @@ namespace MoMoney.Presentation.Winforms.Views
this.ux_submit_button.Values.ImageStates.ImageCheckedTracking = null;
this.ux_submit_button.Values.Text = "&Submit";
//
- // ux_company_name
- //
- this.ux_company_name.Location = new System.Drawing.Point(110, 21);
- this.ux_company_name.Name = "ux_company_name";
- this.ux_company_name.Size = new System.Drawing.Size(410, 20);
- this.ux_company_name.TabIndex = 1;
- //
- // ux_cancel_button
+ // kryptonSplitContainer2
//
- this.ux_cancel_button.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.ux_cancel_button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.ux_cancel_button.Location = new System.Drawing.Point(206, 63);
- this.ux_cancel_button.Name = "ux_cancel_button";
- this.ux_cancel_button.Size = new System.Drawing.Size(57, 25);
- this.ux_cancel_button.TabIndex = 3;
- this.ux_cancel_button.Text = "Cancel";
- this.ux_cancel_button.UseVisualStyleBackColor = true;
+ this.kryptonSplitContainer2.Cursor = System.Windows.Forms.Cursors.Default;
+ this.kryptonSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.kryptonSplitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.kryptonSplitContainer2.Name = "kryptonSplitContainer2";
+ this.kryptonSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
- // kryptonLabel1
+ // kryptonSplitContainer2.Panel1
//
- this.kryptonLabel1.Location = new System.Drawing.Point(11, 21);
- this.kryptonLabel1.Name = "kryptonLabel1";
- this.kryptonLabel1.Size = new System.Drawing.Size(101, 20);
- this.kryptonLabel1.TabIndex = 20;
- this.kryptonLabel1.Text = "Company Name:";
- this.kryptonLabel1.Values.ExtraText = "";
- this.kryptonLabel1.Values.Image = null;
- this.kryptonLabel1.Values.Text = "Company Name:";
+ this.kryptonSplitContainer2.Panel1.PanelBackStyle = ComponentFactory.Krypton.Toolkit.PaletteBackStyle.FormCustom1;
+ this.kryptonSplitContainer2.SeparatorStyle = ComponentFactory.Krypton.Toolkit.SeparatorStyle.HighProfile;
+ this.kryptonSplitContainer2.Size = new System.Drawing.Size(201, 655);
+ this.kryptonSplitContainer2.SplitterDistance = 66;
+ this.kryptonSplitContainer2.TabIndex = 26;
//
// AddCompanyView
//
@@ -237,27 +216,25 @@ namespace MoMoney.Presentation.Winforms.Views
this.kryptonHeaderGroup1.Panel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.kryptonHeaderGroup1)).EndInit();
this.kryptonHeaderGroup1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.ux_companys_listing)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel2)).EndInit();
- this.kryptonSplitContainer2.Panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2)).EndInit();
- this.kryptonSplitContainer2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1.Panel)).EndInit();
- this.kryptonGroup1.Panel.ResumeLayout(false);
- this.kryptonGroup1.Panel.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1)).EndInit();
- this.kryptonGroup1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2.Panel)).EndInit();
- this.kryptonGroup2.Panel.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2)).EndInit();
- this.kryptonGroup2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1.Panel1)).EndInit();
this.kryptonSplitContainer1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1.Panel2)).EndInit();
this.kryptonSplitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer1)).EndInit();
this.kryptonSplitContainer1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2.Panel)).EndInit();
+ this.kryptonGroup2.Panel.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup2)).EndInit();
+ this.kryptonGroup2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1.Panel)).EndInit();
+ this.kryptonGroup1.Panel.ResumeLayout(false);
+ this.kryptonGroup1.Panel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonGroup1)).EndInit();
+ this.kryptonGroup1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2.Panel2)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.kryptonSplitContainer2)).EndInit();
+ this.kryptonSplitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -265,10 +242,9 @@ namespace MoMoney.Presentation.Winforms.Views
#endregion
private ComponentFactory.Krypton.Toolkit.KryptonHeaderGroup kryptonHeaderGroup1;
- private ComponentFactory.Krypton.Toolkit.KryptonDataGridView ux_companys_listing;
private ComponentFactory.Krypton.Toolkit.KryptonSplitContainer kryptonSplitContainer1;
private ComponentFactory.Krypton.Toolkit.KryptonGroup kryptonGroup2;
- private System.Windows.Forms.ListView listView1;
+ private System.Windows.Forms.ListView companiesListView;
private ComponentFactory.Krypton.Toolkit.KryptonGroup kryptonGroup1;
private ComponentFactory.Krypton.Toolkit.KryptonLabel kryptonLabel1;
private System.Windows.Forms.Button ux_cancel_button;
product/Presentation/Winforms/Views/ApplicationDockedWindow.cs
@@ -94,11 +94,10 @@ namespace MoMoney.Presentation.Winforms.Views
{
using (new SuspendLayout(panel))
{
- if (window_is_already_contained_in(panel)) remove_from(panel);
- //else
- {
- Show(panel, dock_state);
- }
+ if (window_is_already_contained_in(panel))
+ remove_from(panel);
+
+ Show(panel, dock_state);
}
}
product/Presentation/Winforms/Views/ApplicationShellSpecs.cs
@@ -7,20 +7,29 @@ using MoMoney.Presentation.Winforms.Helpers;
namespace MoMoney.Presentation.Winforms.Views
{
- public class concern : concerns_for<IShell, ApplicationShell>
+ public class ApplicationShellSpecs
{
- }
+ public class concern : concerns_for<IShell, ApplicationShell>
+ {
+ }
- public class when_the_application_shell_is_closed : concern
- {
- it should_execute_the_close_command = () => presenter.was_told_to(x => x.shut_down());
+ public class when_the_application_shell_is_closed : concern
+ {
+ it should_execute_the_close_command = () => presenter.was_told_to(x => x.shut_down());
- context c = () => { presenter = an<ApplicationShellPresenter>(); };
+ context c = () =>
+ {
+ presenter = an<ApplicationShellPresenter>();
+ };
- after_the_sut_has_been_created a = () => { sut.attach_to(presenter); };
+ after_the_sut_has_been_created a = () =>
+ {
+ sut.attach_to(presenter);
+ };
- because b = () => EventTrigger.trigger_event<Events.FormEvents>(x => x.OnClosed(new EventArgs()), sut);
+ because b = () => EventTrigger.trigger_event<Events.FormEvents>(x => x.OnClosed(new EventArgs()), sut);
- static ApplicationShellPresenter presenter;
+ static ApplicationShellPresenter presenter;
+ }
}
}
\ No newline at end of file
product/Presentation/Winforms/Views/ApplicationWindow.cs
@@ -13,7 +13,6 @@ namespace MoMoney.Presentation.Winforms.Views
{
InitializeComponent();
Icon = ApplicationIcons.Application;
- //this.log().debug("created {0}", GetType());
activated = x => { };
deactivated = x => { };
product/Presentation/Presentation.csproj
@@ -71,6 +71,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\test\mbunit\MbUnit.Framework.dll</HintPath>
</Reference>
+ <Reference Include="PresentationCore">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="PresentationFramework">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
<Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\test\rhino.mocks\Rhino.Mocks.dll</HintPath>
@@ -93,10 +99,16 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
+ <Reference Include="UIAutomationProvider">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.3.3392.19652, Culture=neutral, PublicKeyToken=b602bcfb76b4e90d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\app\dock.panel.suite\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
</Reference>
+ <Reference Include="WindowsBase">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
<Reference Include="XPExplorerBar, Version=3.3.0.0, Culture=neutral, PublicKeyToken=26272737b5f33015">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\app\xp.explorer.bar\XPExplorerBar.dll</HintPath>
@@ -107,6 +119,7 @@
<Compile Include="core\CachingViewFactory.cs" />
<Compile Include="model\eventing\FinishedRunningCommand.cs" />
<Compile Include="model\eventing\StartedRunningCommand.cs" />
+ <Compile Include="model\menu\file\ISaveChangesCallback.cs" />
<Compile Include="model\navigation\INavigationTreeVisitor.cs" />
<Compile Include="model\navigation\ITreeBranch.cs" />
<Compile Include="model\navigation\ITreeViewToRootNodeMapper.cs" />
@@ -215,10 +228,10 @@
<Compile Include="presenters\GettingStartedPresenterSpecs.cs" />
<Compile Include="presenters\LogFilePresenter.cs" />
<Compile Include="presenters\LogFileViewPresenterSpecs.cs" />
- <Compile Include="presenters\NotificationIconPresenter.cs" />
+ <Compile Include="presenters\NotificationIconModule.cs" />
<Compile Include="presenters\NotificationIconPresenterSpecs.cs" />
<Compile Include="presenters\NotificationPresenter.cs" />
- <Compile Include="presenters\StatusBarPresenter.cs" />
+ <Compile Include="presenters\StatusBarModule.cs" />
<Compile Include="presenters\StatusBarPresenterSpecs.cs" />
<Compile Include="presenters\TaskTrayPresenter.cs" />
<Compile Include="presenters\TitleBarPresenter.cs" />
product/Service/Application/AddNewIncomeCommandSpecs.cs
@@ -8,6 +8,7 @@ using MoMoney.Domain.Core;
using MoMoney.Domain.repositories;
using MoMoney.DTO;
using MoMoney.Service.Contracts.Application;
+using Rhino.Mocks;
namespace MoMoney.Service.Application
{
@@ -38,8 +39,8 @@ namespace MoMoney.Service.Application
context c = () =>
{
- var a_company = an<ICompany>();
- var matching_income = an<IIncome>();
+ var a_company = MockRepository.GenerateMock<Company>();
+ var matching_income = MockRepository.GenerateMock<Income>();
var today = new Date(2008, 12, 26);
Id<Guid> id = Guid.NewGuid();
product/Service/Application/GetAllBillsQuery.cs
@@ -10,9 +10,9 @@ namespace MoMoney.Service.Application
public class GetAllBillsQuery : IGetAllBillsQuery
{
readonly IBillRepository bills;
- readonly Mapper<IBill, BillInformationDTO> mapper;
+ readonly Mapper<Bill, BillInformationDTO> mapper;
- public GetAllBillsQuery(IBillRepository bills, Mapper<IBill, BillInformationDTO> mapper)
+ public GetAllBillsQuery(IBillRepository bills, Mapper<Bill, BillInformationDTO> mapper)
{
this.bills = bills;
this.mapper = mapper;
product/Service/Application/GetAllCompanysQuery.cs
@@ -9,10 +9,10 @@ namespace MoMoney.Service.Application
{
public class GetAllCompanysQuery : IGetAllCompanysQuery
{
- readonly ICompanyRepository companys;
- readonly Mapper<ICompany, CompanyDTO> mapper;
+ ICompanyRepository companys;
+ Mapper<Company, CompanyDTO> mapper;
- public GetAllCompanysQuery(ICompanyRepository companys, Mapper<ICompany, CompanyDTO> mapper)
+ public GetAllCompanysQuery(ICompanyRepository companys, Mapper<Company, CompanyDTO> mapper)
{
this.companys = companys;
this.mapper = mapper;
product/Service/Application/GetAllIncomeQuery.cs
@@ -10,9 +10,9 @@ namespace MoMoney.Service.Application
public class GetAllIncomeQuery : IGetAllIncomeQuery
{
readonly IIncomeRepository all_income;
- readonly Mapper<IIncome, IncomeInformationDTO> mapper;
+ readonly Mapper<Income, IncomeInformationDTO> mapper;
- public GetAllIncomeQuery(IIncomeRepository all_income, Mapper<IIncome, IncomeInformationDTO> mapper)
+ public GetAllIncomeQuery(IIncomeRepository all_income, Mapper<Income, IncomeInformationDTO> mapper)
{
this.all_income = all_income;
this.mapper = mapper;
product/Service/Application/GetTheCurrentCustomerQuery.cs
@@ -5,7 +5,7 @@ using MoMoney.Domain.repositories;
namespace MoMoney.Service.Application
{
- public interface IGetTheCurrentCustomerQuery : Query<IAccountHolder> {}
+ public interface IGetTheCurrentCustomerQuery : Query<AccountHolder> {}
public class GetTheCurrentCustomerQuery : IGetTheCurrentCustomerQuery
{
@@ -16,7 +16,7 @@ namespace MoMoney.Service.Application
this.account_holders = account_holders;
}
- public IAccountHolder fetch()
+ public AccountHolder fetch()
{
var c = account_holders.all().SingleOrDefault();
product/Service/Application/RegisterNewCompanyCommand.cs
@@ -13,8 +13,7 @@ namespace MoMoney.Service.Application
readonly Notification notification;
readonly ICompanyRepository companies;
- public RegisterNewCompanyCommand(ICompanyFactory factory, Notification notification,
- ICompanyRepository companies)
+ public RegisterNewCompanyCommand(ICompanyFactory factory, Notification notification, ICompanyRepository companies)
{
this.factory = factory;
this.notification = notification;
@@ -23,15 +22,15 @@ namespace MoMoney.Service.Application
public void run(RegisterNewCompany item)
{
- if (company_has_already_been_registered(item))
+ if (is_there_a_company_registered_with(item.company_name))
notification.notify(create_error_message_from(item));
else
factory.create().change_name_to(item.company_name);
}
- bool company_has_already_been_registered(RegisterNewCompany dto)
+ bool is_there_a_company_registered_with(string company_name)
{
- return companies.all().Count(x => x.name.is_equal_to_ignoring_case(dto.company_name)) > 0;
+ return companies.all().Any(x => x.name.is_equal_to_ignoring_case(company_name));
}
string create_error_message_from(RegisterNewCompany dto)
product/service.infrastructure/eventing/EventAggregator.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq.Expressions;
using System.Threading;
using gorilla.commons.utility;
@@ -9,13 +8,11 @@ namespace MoMoney.Service.Infrastructure.Eventing
public class EventAggregator : IEventAggregator
{
readonly SynchronizationContext context;
- readonly HashSet<object> subscribers;
- readonly object mutex;
+ readonly HashSet<object> subscribers = new HashSet<object>();
+ readonly object mutex = new object();
public EventAggregator(SynchronizationContext context)
{
- subscribers = new HashSet<object>();
- mutex = new object();
this.context = context;
}
@@ -24,7 +21,7 @@ namespace MoMoney.Service.Infrastructure.Eventing
subscribe(subscriber);
}
- public void subscribe<Listener>(Listener subscriber) where Listener : class
+ public void subscribe<Listener>(Listener subscriber)
{
within_lock(() => subscribers.Add(subscriber));
}
@@ -34,9 +31,9 @@ namespace MoMoney.Service.Infrastructure.Eventing
process(() => subscribers.call_on_each<IEventSubscriber<Event>>(x => x.notify(the_event_to_broadcast)));
}
- public void publish<T>(Expression<Action<T>> call) where T : class
+ public void publish<T>(Action<T> call) where T : class
{
- process(() => subscribers.each(x => x.call_on(call.Compile())));
+ process(() => subscribers.each(x => x.call_on(call)));
}
public void publish<Event>() where Event : IEvent, new()
product/service.infrastructure/eventing/IEventAggregator.cs
@@ -1,14 +1,13 @@
using System;
-using System.Linq.Expressions;
namespace MoMoney.Service.Infrastructure.Eventing
{
public interface IEventAggregator
{
void subscribe_to<Event>(IEventSubscriber<Event> subscriber) where Event : IEvent;
- void subscribe<Listener>(Listener subscriber) where Listener : class;
+ void subscribe<Listener>(Listener subscriber);
void publish<Event>(Event the_event_to_broadcast) where Event : IEvent;
- void publish<T>(Expression<Action<T>> call) where T : class;
+ void publish<T>(Action<T> call) where T : class;
void publish<Event>() where Event : IEvent, new();
}
}
\ No newline at end of file
product/service.infrastructure/threading/AsynchronousCommandProcessor.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq.Expressions;
using System.Threading;
using gorilla.commons.utility;
@@ -20,9 +19,9 @@ namespace MoMoney.Service.Infrastructure.Threading
manual_reset = new ManualResetEvent(false);
}
- public void add(Expression<Action> action_to_process)
+ public void add(Action command)
{
- add(new AnonymousCommand(action_to_process));
+ add(new AnonymousCommand(command));
}
public void add(Command command_to_process)
product/service.infrastructure/threading/CommandProcessor.cs
@@ -1,12 +1,11 @@
using System;
-using System.Linq.Expressions;
using gorilla.commons.utility;
namespace MoMoney.Service.Infrastructure.Threading
{
public interface CommandProcessor : Command
{
- void add(Expression<Action> action_to_process);
+ void add(Action command);
void add(Command command_to_process);
void stop();
}
product/service.infrastructure/threading/SynchronousCommandProcessor.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq.Expressions;
using gorilla.commons.utility;
namespace MoMoney.Service.Infrastructure.Threading
@@ -14,9 +13,9 @@ namespace MoMoney.Service.Infrastructure.Threading
queued_commands = new Queue<Command>();
}
- public void add(Expression<Action> action_to_process)
+ public void add(Action command)
{
- add(new AnonymousCommand(action_to_process));
+ add(new AnonymousCommand(command));
}
public void add(Command command_to_process)