Commit a48c622
Changed files (9)
trunk
product
MyMoney
boot
container
registration
proxy_configuration
Infrastructure
Container
Windsor
Threading
Presentation
Presenters
Navigation
Views
trunk/product/MyMoney/boot/container/registration/proxy_configuration/SynchronizedConfiguration.cs
@@ -0,0 +1,14 @@
+using MoMoney.Infrastructure.proxies;
+using MoMoney.Infrastructure.Threading;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.boot.container.registration.proxy_configuration
+{
+ internal class SynchronizedConfiguration<T> : IConfiguration<IProxyBuilder<T>>
+ {
+ public void configure(IProxyBuilder<T> item)
+ {
+ item.add_interceptor<ThreadSafeInterceptor>().intercept_all();
+ }
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/wire_up_the_views_in_to_the.cs
@@ -1,5 +1,3 @@
-using System.Threading;
-using System.Windows.Forms;
using MoMoney.Infrastructure.Container;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Views.billing;
trunk/product/MyMoney/Infrastructure/Container/Windsor/WindsorDependencyRegistry.cs
@@ -35,11 +35,6 @@ namespace MoMoney.Infrastructure.Container.Windsor
implementation_type);
}
- public void singleton<Interface>(Interface instanceOfTheInterface)
- {
- underlying_container.Kernel.AddComponentInstance<Interface>(instanceOfTheInterface);
- }
-
public void singleton<Contract>(Func<Contract> instance_of_the_contract)
{
underlying_container.Kernel.AddComponentInstance<Contract>(instance_of_the_contract());
@@ -66,7 +61,7 @@ namespace MoMoney.Infrastructure.Container.Windsor
{
var builder = new ProxyBuilder<T>();
configuration.configure(builder);
- singleton(builder.create_proxy_for(target));
+ singleton(() => builder.create_proxy_for(target));
}
public void proxy<T, Configuration>(Func<T> target)
trunk/product/MyMoney/Infrastructure/Threading/SynchronizedContext.cs
@@ -15,7 +15,7 @@ namespace MoMoney.Infrastructure.Threading
public void run(ICommand item)
{
//context.Post(x => item.run(), new object());
- context.Send(x => item.run(), new object());
+ context.Send(x => { item.run(); }, new object());
}
}
}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/helpers/BindableListFactory.cs
@@ -0,0 +1,120 @@
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace MoMoney.Presentation.Views.helpers
+{
+ static public class BindableListFactory
+ {
+ static public IBindableList<ItemToBindTo> create_for<ItemToBindTo>(ListBox listbox)
+ {
+ return new BindableListBox<ItemToBindTo>(new ListBoxListControl<ItemToBindTo>(listbox));
+ }
+
+ static public IBindableList<ItemToBindTo> create_for<ItemToBindTo>(ComboBox combobox)
+ {
+ return new BindableListBox<ItemToBindTo>(new ComboBoxListControl<ItemToBindTo>(combobox));
+ }
+ }
+
+ public interface IBindableList<ItemToBindTo>
+ {
+ void bind_to(IEnumerable<ItemToBindTo> items);
+ ItemToBindTo get_selected_item();
+ void set_selected_item(ItemToBindTo item);
+ }
+
+ public interface IListControl<ItemToStore>
+ {
+ ItemToStore get_selected_item();
+ void add_item(ItemToStore item);
+ void set_selected_item(ItemToStore item);
+ }
+
+ public class BindableListBox<ItemToBindTo> : IBindableList<ItemToBindTo>
+ {
+ readonly IListControl<ItemToBindTo> listControl;
+
+ public BindableListBox(IListControl<ItemToBindTo> listControl)
+ {
+ this.listControl = listControl;
+ }
+
+ public void bind_to(IEnumerable<ItemToBindTo> items)
+ {
+ foreach (var item in items)
+ {
+ listControl.add_item(item);
+ }
+ }
+
+ public ItemToBindTo get_selected_item()
+ {
+ return listControl.get_selected_item();
+ }
+
+ public void set_selected_item(ItemToBindTo item)
+ {
+ listControl.set_selected_item(item);
+ }
+ }
+
+ public class ListBoxListControl<ItemToStore> : IListControl<ItemToStore>
+ {
+ readonly ListBox _listBox;
+
+ public ListBoxListControl(ListBox listBox)
+ {
+ _listBox = listBox;
+ }
+
+ public ItemToStore get_selected_item()
+ {
+ return (ItemToStore) _listBox.SelectedItem;
+ }
+
+ public void add_item(ItemToStore item)
+ {
+ _listBox.Items.Add(item);
+ }
+
+ public void set_selected_item(ItemToStore item)
+ {
+ if (_listBox.Items.Contains(item))
+ {
+ _listBox.SelectedItem = item;
+ }
+ }
+ }
+
+ public class ComboBoxListControl<ItemToStore> : IListControl<ItemToStore>
+ {
+ readonly ComboBox combo_box;
+
+ public ComboBoxListControl(ComboBox combo_box)
+ {
+ this.combo_box = combo_box;
+ }
+
+ public ItemToStore get_selected_item()
+ {
+ return (ItemToStore) combo_box.SelectedItem;
+ }
+
+ public void add_item(ItemToStore item)
+ {
+ combo_box.Items.Add(item);
+ combo_box.SelectedIndex = 0;
+ }
+
+ public void set_selected_item(ItemToStore item)
+ {
+ if (!Equals(item, default(ItemToStore)))
+ {
+ if (combo_box.Items.Contains(item))
+ {
+ combo_box.SelectedItem = item;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Menu/Help/AboutTheApplicationView.cs
@@ -15,13 +15,14 @@ namespace MoMoney.Presentation.Views.Menu.Help
protected override void OnLoad(EventArgs e)
{
+ var assembly = GetType() .Assembly;
on_ui_thread(() =>
{
- labelProductName.Text = get_attribute<AssemblyProductAttribute>().Product;
- labelVersion.Text = string.Format("Version {0} {0}", AssemblyVersion);
- uxCopyright.Text = get_attribute<AssemblyCopyrightAttribute>().Copyright;
- uxCompanyName.Text = get_attribute<AssemblyCompanyAttribute>().Company;
- uxDescription.Text = get_attribute<AssemblyDescriptionAttribute>().Description;
+ labelProductName.Text = assembly.get_attribute<AssemblyProductAttribute>().Product;
+ labelVersion.Text = string.Format("Version {0} {0}", assembly_version);
+ uxCopyright.Text = assembly.get_attribute<AssemblyCopyrightAttribute>().Copyright;
+ uxCompanyName.Text = assembly.get_attribute<AssemblyCompanyAttribute>().Company;
+ uxDescription.Text = assembly.get_attribute<AssemblyDescriptionAttribute>().Description;
ux_logo.Image = ApplicationImages.Splash;
});
}
@@ -31,7 +32,7 @@ namespace MoMoney.Presentation.Views.Menu.Help
//on_ui_thread(() => ShowDialog());
}
- string AssemblyVersion
+ string assembly_version
{
get { return GetType().Assembly.GetName().Version.ToString(); }
}
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
+using System.Drawing;
using System.Windows.Forms;
using MoMoney.Presentation.Presenters.Shell;
using MoMoney.Presentation.Views.core;
@@ -28,6 +29,7 @@ namespace MoMoney.Presentation.Views.Shell
{ux_status_bar.GetType().FullName, ux_status_bar},
{notification_icon.GetType().FullName, notification_icon},
};
+ base.BackColor = Color.FromArgb(229, 238, 226);
}
protected override void OnLoad(EventArgs e)
trunk/product/MyMoney/MyMoney.csproj
@@ -166,6 +166,7 @@
<ItemGroup>
<Compile Include="boot\container\registration\auto_wire_components_in_to_the.cs" />
<Compile Include="boot\container\registration\auto_wire_components_in_to_the_specs.cs" />
+ <Compile Include="boot\container\registration\proxy_configuration\SynchronizedConfiguration.cs" />
<Compile Include="boot\container\registration\SynchronizedConfiguration.cs" />
<Compile Include="boot\container\registration\wire_up_the_infrastructure_in_to_the.cs" />
<Compile Include="boot\container\tear_down_the_container.cs" />
@@ -465,6 +466,7 @@
<DependentUpon>SaveChangesView.cs</DependentUpon>
</Compile>
<Compile Include="Presentation\Views\dialogs\SaveChangesViewSpecs.cs" />
+ <Compile Include="Presentation\Views\helpers\BindableListFactory.cs" />
<Compile Include="Presentation\Views\helpers\EventTriggerExtensions.cs" />
<Compile Include="Presentation\Views\helpers\SuspendLayout.cs" />
<Compile Include="Presentation\Views\IAddCompanyView.cs" />