Commit 4667165
Changed files (7)
trunk
src
MyMoney
Infrastructure
Container
Windsor
Presentation
trunk/src/MyMoney/Infrastructure/Container/Windsor/windsor_dependency_registry.cs
@@ -8,10 +8,11 @@ namespace MyMoney.Infrastructure.Container.Windsor
{
public class windsor_dependency_registry : IDependencyRegistry
{
- private readonly IWindsorContainer underlying_container;
+ readonly IWindsorContainer underlying_container;
public windsor_dependency_registry() : this(new windsor_container_factory())
- {}
+ {
+ }
public windsor_dependency_registry(IWindsorContainerFactory factory)
{
@@ -28,30 +29,27 @@ namespace MyMoney.Infrastructure.Container.Windsor
return underlying_container.ResolveAll<Interface>();
}
- public void register<Interface, Implementation>() where Implementation : Interface
+ public void singleton<Interface, Implementation>() where Implementation : Interface
{
var interface_type = typeof (Interface);
var implementation_type = typeof (Implementation);
- underlying_container
- .AddComponent(create_a_key_using(interface_type, implementation_type),
- interface_type,
- implementation_type);
+ underlying_container.AddComponent(create_a_key_using(interface_type, implementation_type), interface_type,
+ implementation_type);
}
-
public void register_instance_of<Interface>(Interface instanceOfTheInterface)
{
underlying_container.Kernel.AddComponentInstance<Interface>(instanceOfTheInterface);
}
- public void register_as_a_transient<Interface, Implementation>() where Implementation : Interface
+ public void transient<Interface, Implementation>() where Implementation : Interface
{
underlying_container.AddComponentLifeStyle(
create_a_key_using(typeof (Interface), typeof (Implementation)),
typeof (Interface), typeof (Implementation), LifestyleType.Transient);
}
- private string create_a_key_using(Type interface_type, Type implementation_type)
+ string create_a_key_using(Type interface_type, Type implementation_type)
{
return "{0}-{1}".formatted_using(interface_type.FullName, implementation_type.FullName);
}
trunk/src/MyMoney/Presentation/Views/dialogs/save_changes_view.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Windows.Forms;
+using MyMoney.Presentation.Model.Menu.File.Commands;
+using MyMoney.Presentation.Resources;
+
+namespace MyMoney.Presentation.Views.dialogs
+{
+ public partial class save_changes_view : Form, ISaveChangesView
+ {
+ bool can_be_closed;
+
+ public save_changes_view()
+ {
+ InitializeComponent();
+ ux_image.Image = ApplicationImages.Splash;
+ ux_image.SizeMode = PictureBoxSizeMode.StretchImage;
+ create_tool_tip_for("Save", "Save the document, and then close it.", ux_save_button);
+ create_tool_tip_for("Don't Save", "Discard the unsaved changes.", ux_do_not_save_button);
+ create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
+ }
+
+
+ public void attach_to(ISaveChangesPresenter presenter)
+ {
+ ux_save_button.Click += (sender, e) => execute(presenter.save);
+ ux_do_not_save_button.Click += (sender, e) => execute(presenter.dont_save);
+ ux_cancel_button.Click += (sender, e) => execute(presenter.cancel);
+ Closing += (sender, e) => { if (!can_be_closed) presenter.cancel(); };
+ }
+
+ public void prompt_user_to_save()
+ {
+ ShowDialog();
+ }
+
+ void execute(Action action)
+ {
+ can_be_closed = true;
+ Hide();
+ Close();
+ action();
+ }
+
+ void create_tool_tip_for(string title, string caption, Control control)
+ {
+ new ToolTip { IsBalloon = true, ToolTipTitle = title }.SetToolTip(control, caption);
+ }
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/dialogs/save_changes_view.Designer.cs
@@ -0,0 +1,145 @@
+namespace MyMoney.Presentation.Views.dialogs
+{
+public partial class save_changes_view
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.ux_save_button = new System.Windows.Forms.Button();
+ this.ux_do_not_save_button = new System.Windows.Forms.Button();
+ this.ux_cancel_button = new System.Windows.Forms.Button();
+ this.ux_image = new System.Windows.Forms.PictureBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.ux_image)).BeginInit();
+ this.SuspendLayout();
+ //
+ // ux_save_button
+ //
+ this.ux_save_button.Location = new System.Drawing.Point(12, 100);
+ this.ux_save_button.Name = "ux_save_button";
+ this.ux_save_button.Size = new System.Drawing.Size(267, 63);
+ this.ux_save_button.TabIndex = 0;
+ this.ux_save_button.Text = "&Save";
+ this.ux_save_button.UseVisualStyleBackColor = true;
+ //
+ // ux_do_not_save_button
+ //
+ this.ux_do_not_save_button.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.ux_do_not_save_button.Location = new System.Drawing.Point(13, 185);
+ this.ux_do_not_save_button.Name = "ux_do_not_save_button";
+ this.ux_do_not_save_button.Size = new System.Drawing.Size(267, 63);
+ this.ux_do_not_save_button.TabIndex = 2;
+ this.ux_do_not_save_button.Text = "Do&n\'t Save";
+ this.ux_do_not_save_button.UseVisualStyleBackColor = true;
+ //
+ // ux_cancel_button
+ //
+ this.ux_cancel_button.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.ux_cancel_button.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.ux_cancel_button.Location = new System.Drawing.Point(13, 254);
+ this.ux_cancel_button.Name = "ux_cancel_button";
+ this.ux_cancel_button.Size = new System.Drawing.Size(267, 63);
+ this.ux_cancel_button.TabIndex = 3;
+ this.ux_cancel_button.Text = "Cancel";
+ this.ux_cancel_button.UseVisualStyleBackColor = true;
+ //
+ // ux_image
+ //
+ this.ux_image.Location = new System.Drawing.Point(12, 12);
+ this.ux_image.Name = "ux_image";
+ this.ux_image.Size = new System.Drawing.Size(115, 85);
+ this.ux_image.TabIndex = 4;
+ this.ux_image.TabStop = false;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(136, 42);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(144, 13);
+ this.label1.TabIndex = 6;
+ this.label1.Text = "You have unsaved changes.";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(136, 55);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(136, 13);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "What would you like to do?";
+ //
+ // label3
+ //
+ this.label3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.label3.Location = new System.Drawing.Point(11, 173);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(273, 2);
+ this.label3.TabIndex = 8;
+ this.label3.Text = " " +
+ " ";
+ //
+ // UnsavedChangesView
+ //
+ this.AcceptButton = this.ux_save_button;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.ux_cancel_button;
+ this.ClientSize = new System.Drawing.Size(295, 327);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.ux_image);
+ this.Controls.Add(this.ux_cancel_button);
+ this.Controls.Add(this.ux_do_not_save_button);
+ this.Controls.Add(this.ux_save_button);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "UnsavedChangesView";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Unsaved Changes";
+ ((System.ComponentModel.ISupportInitialize)(this.ux_image)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button ux_save_button;
+ private System.Windows.Forms.Button ux_do_not_save_button;
+ private System.Windows.Forms.Button ux_cancel_button;
+ private System.Windows.Forms.PictureBox ux_image;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/dialogs/save_changes_view.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
trunk/src/MyMoney/windows.ui/wire_up_the_reports_in_to_the.cs
@@ -16,8 +16,8 @@ namespace MyMoney.windows.ui
public void run()
{
- registry.register_as_a_transient<IReportView, report_viewer>();
- registry.register_as_a_transient<IViewAllBillsReport, view_all_bills_report>();
+ registry.transient<IReportView, report_viewer>();
+ registry.transient<IViewAllBillsReport, view_all_bills_report>();
}
}
}
\ No newline at end of file
trunk/src/MyMoney/windows.ui/wire_up_the_views_in_to_the.cs
@@ -2,6 +2,7 @@ using MyMoney.Infrastructure.Container.Windsor;
using MyMoney.Presentation.Context;
using MyMoney.Presentation.Views;
using MyMoney.Presentation.Views.billing;
+using MyMoney.Presentation.Views.dialogs;
using MyMoney.Presentation.Views.income;
using MyMoney.Presentation.Views.Menu.Help;
using MyMoney.Presentation.Views.Navigation;
@@ -13,26 +14,27 @@ namespace MyMoney.windows.ui
{
internal class wire_up_the_views_in_to_the : ICommand
{
- private readonly windsor_dependency_registry registry;
+ private readonly windsor_dependency_registry register;
public wire_up_the_views_in_to_the(windsor_dependency_registry registry)
{
- this.registry = registry;
+ this.register = registry;
}
public void run()
{
- registry.register<IShell, window_shell>();
- registry.register<the_application_context, the_application_context>();
- registry.register_as_a_transient<IAboutApplicationView, about_the_application_view>();
- registry.register_as_a_transient<ISplashScreenView, splash_screen_view>();
- registry.register_as_a_transient<INavigationView, navigation_view>();
- registry.register_as_a_transient<IAddCompanyView, add_new_company_view>();
- registry.register_as_a_transient<IViewAllBills, view_all_bills>();
- registry.register_as_a_transient<IAddBillPaymentView, add_bill_payment>();
- registry.register_as_a_transient<IActionsTaskView, actions_task_list>();
- registry.register_as_a_transient<IAddNewIncomeView, add_new_income_view>();
- registry.register_as_a_transient<IViewIncomeHistory, view_all_income>();
+ register.singleton<IShell, window_shell>();
+ register.singleton<the_application_context, the_application_context>();
+ register.transient<IAboutApplicationView, about_the_application_view>();
+ register.transient<ISplashScreenView, splash_screen_view>();
+ register.transient<INavigationView, navigation_view>();
+ register.transient<IAddCompanyView, add_new_company_view>();
+ register.transient<IViewAllBills, view_all_bills>();
+ register.transient<IAddBillPaymentView, add_bill_payment>();
+ register.transient<IActionsTaskView, actions_task_list>();
+ register.transient<IAddNewIncomeView, add_new_income_view>();
+ register.transient<IViewIncomeHistory, view_all_income>();
+ register.transient<ISaveChangesView, save_changes_view>();
}
}
}
\ No newline at end of file
trunk/src/MyMoney/MyMoney.csproj
@@ -351,6 +351,12 @@
</Compile>
<Compile Include="Presentation\Views\billing\IAddBillPaymentView.cs" />
<Compile Include="Presentation\Views\dialogs\ISaveChangesView.cs" />
+ <Compile Include="Presentation\Views\dialogs\save_changes_view.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Presentation\Views\dialogs\save_changes_view.Designer.cs">
+ <DependentUpon>save_changes_view.cs</DependentUpon>
+ </Compile>
<Compile Include="Presentation\Views\IAddCompanyView.cs" />
<Compile Include="Presentation\Views\billing\IViewAllBills.cs" />
<Compile Include="Presentation\Views\billing\view_all_bills.cs">
@@ -549,6 +555,9 @@
<DependentUpon>view_all_bills.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Presentation\Views\dialogs\save_changes_view.resx">
+ <DependentUpon>save_changes_view.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Presentation\Views\income\add_new_income_view.resx">
<DependentUpon>add_new_income_view.cs</DependentUpon>
<SubType>Designer</SubType>