Commit b7176bc
Changed files (13)
trunk
src
MyMoney
Infrastructure
Container
Presentation
Presenters
updates
Views
windows.ui
trunk/src/MyMoney/Infrastructure/Container/Windsor/configuration/component_registration_configuration.cs
@@ -13,7 +13,9 @@ namespace MyMoney.Infrastructure.Container.Windsor.configuration
public void configure(ComponentRegistration registration)
{
new RegisterComponentContract()
+ .then(new ConfigureComponentLifestyle())
.then(new ApplyLoggingInterceptor())
+ .then(new LogComponent())
.configure(registration);
}
}
trunk/src/MyMoney/Infrastructure/Container/Windsor/configuration/ConfigureComponentLifestyle.cs
@@ -0,0 +1,18 @@
+using Castle.Core;
+using Castle.MicroKernel.Registration;
+
+namespace MyMoney.Infrastructure.Container.Windsor.configuration
+{
+ public class ConfigureComponentLifestyle : IRegistrationConfiguration
+ {
+ public void configure(ComponentRegistration registration)
+ {
+ var implementation = registration.Implementation;
+ if (implementation.GetCustomAttributes(typeof (SingletonAttribute), false).Length > 0)
+ {
+ registration.LifeStyle.Is(LifestyleType.Singleton);
+ }
+ registration.LifeStyle.Is(LifestyleType.Transient);
+ }
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Infrastructure/Container/Windsor/configuration/LogComponent.cs
@@ -0,0 +1,14 @@
+using Castle.MicroKernel.Registration;
+using MyMoney.Infrastructure.Extensions;
+
+namespace MyMoney.Infrastructure.Container.Windsor.configuration
+{
+ public class LogComponent : IRegistrationConfiguration
+ {
+ public void configure(ComponentRegistration registration)
+ {
+ var implementation = registration.Implementation;
+ this.log().debug("registering: {0}", implementation);
+ }
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Infrastructure/Container/Windsor/configuration/RegisterComponentContract.cs
@@ -1,4 +1,3 @@
-using Castle.Core;
using Castle.MicroKernel.Registration;
namespace MyMoney.Infrastructure.Container.Windsor.configuration
@@ -12,14 +11,6 @@ namespace MyMoney.Infrastructure.Container.Windsor.configuration
{
registration.For(implementation);
}
- else
- {
- if (implementation.GetCustomAttributes(typeof (SingletonAttribute), false).Length > 0)
- {
- registration.LifeStyle.Is(LifestyleType.Singleton);
- }
- registration.LifeStyle.Is(LifestyleType.Transient);
- }
}
}
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Core/could_not_find_presenter.cs
@@ -0,0 +1,13 @@
+using System;
+using MyMoney.Utility.Extensions;
+
+namespace MyMoney.Presentation.Core
+{
+ public class could_not_find_presenter<T> : Exception
+ {
+ public could_not_find_presenter(Exception e)
+ : base("Could Not Find an implementation of".formatted_using(typeof (T)), e)
+ {
+ }
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Core/presenter_registry_extensions.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using MyMoney.Domain.Core;
@@ -19,10 +20,17 @@ namespace MyMoney.Presentation.Core
public static Presenter find_an_implementation_of<Presenter>(this IRegistry<IPresenter> registry)
where Presenter : IPresenter
{
- return registry
- .all()
- .Single(p => p.is_an_implementation_of<Presenter>())
- .downcast_to<Presenter>();
+ try
+ {
+ return registry
+ .all()
+ .Single(p => p.is_an_implementation_of<Presenter>())
+ .downcast_to<Presenter>();
+ }
+ catch (Exception exception)
+ {
+ throw new could_not_find_presenter<Presenter>(exception);
+ }
}
}
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Presenters/updates/CheckForUpdatesPresenter.cs
@@ -1,3 +1,4 @@
+using System;
using MyMoney.Presentation.Core;
using MyMoney.Presentation.Presenters.Commands;
using MyMoney.Presentation.Views.updates;
@@ -11,13 +12,14 @@ namespace MyMoney.Presentation.Presenters.updates
void begin_update();
void cancel_update();
void restart();
+ void do_not_update();
}
public class CheckForUpdatesPresenter : ICheckForUpdatesPresenter
{
- readonly ICheckForUpdatesView view;
- readonly IUpdateTasks tasks;
- readonly IRestartCommand command;
+ private readonly ICheckForUpdatesView view;
+ private readonly IUpdateTasks tasks;
+ private readonly IRestartCommand command;
public CheckForUpdatesPresenter(ICheckForUpdatesView view, IUpdateTasks tasks, IRestartCommand command)
{
@@ -47,6 +49,11 @@ namespace MyMoney.Presentation.Presenters.updates
command.run();
}
+ public void do_not_update()
+ {
+ throw new NotImplementedException();
+ }
+
public void complete()
{
view.update_complete();
trunk/src/MyMoney/Presentation/Views/dialogs/save_changes_view.cs
@@ -7,7 +7,7 @@ namespace MyMoney.Presentation.Views.dialogs
{
public partial class save_changes_view : Form, ISaveChangesView
{
- bool can_be_closed;
+ private bool can_be_closed;
public save_changes_view()
{
@@ -33,7 +33,7 @@ namespace MyMoney.Presentation.Views.dialogs
ShowDialog();
}
- void execute(Action action)
+ private void execute(Action action)
{
can_be_closed = true;
Hide();
@@ -41,9 +41,9 @@ namespace MyMoney.Presentation.Views.dialogs
action();
}
- void create_tool_tip_for(string title, string caption, Control control)
+ private void create_tool_tip_for(string title, string caption, Control control)
{
- new ToolTip { IsBalloon = true, ToolTipTitle = title }.SetToolTip(control, caption);
+ new ToolTip {IsBalloon = true, ToolTipTitle = title}.SetToolTip(control, caption);
}
}
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/updates/check_for_updates.cs
@@ -0,0 +1,46 @@
+using System.Windows.Forms;
+using MyMoney.Presentation.Model.updates;
+using MyMoney.Presentation.Presenters.updates;
+using MyMoney.Presentation.Resources;
+
+namespace MyMoney.Presentation.Views.updates
+{
+ public partial class check_for_updates : Form, ICheckForUpdatesView
+ {
+ public check_for_updates()
+ {
+ InitializeComponent();
+ ux_image.Image = ApplicationImages.Splash;
+ ux_image.SizeMode = PictureBoxSizeMode.StretchImage;
+ create_tool_tip_for("Update", "Update the application, and then re-start it.", ux_update_button);
+ create_tool_tip_for("Don't Update", "Discard the latest version.", ux_dont_update_button);
+ create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
+ }
+
+ public void attach_to(ICheckForUpdatesPresenter presenter)
+ {
+ ux_update_button.Click += (sender, e) => presenter.begin_update();
+ ux_dont_update_button.Click += (sender, e) => presenter.do_not_update();
+ ux_cancel_button.Click += (sender, e) => presenter.cancel_update();
+ }
+
+ public void display(ApplicationVersion information)
+ {
+ if (information.updates_available)
+ {
+ ux_update_button.Enabled = information.updates_available;
+ }
+ ShowDialog();
+ }
+
+ public void update_complete()
+ {
+ MessageBox.Show("update complete", "Complete");
+ }
+
+ private 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/updates/check_for_updates.Designer.cs
@@ -0,0 +1,146 @@
+namespace MyMoney.Presentation.Views.updates
+{
+ partial class check_for_updates
+ {
+ /// <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.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.ux_image = new System.Windows.Forms.PictureBox();
+ this.ux_cancel_button = new System.Windows.Forms.Button();
+ this.ux_dont_update_button = new System.Windows.Forms.Button();
+ this.ux_update_button = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.ux_image)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label3
+ //
+ this.label3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.label3.Location = new System.Drawing.Point(12, 211);
+ this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(364, 2);
+ this.label3.TabIndex = 15;
+ this.label3.Text = " " +
+ " ";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(178, 66);
+ this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(177, 17);
+ this.label2.TabIndex = 14;
+ this.label2.Text = "What would you like to do?";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(178, 50);
+ this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(188, 17);
+ this.label1.TabIndex = 13;
+ this.label1.Text = "You have unsaved changes.";
+ //
+ // ux_image
+ //
+ this.ux_image.Location = new System.Drawing.Point(13, 13);
+ this.ux_image.Margin = new System.Windows.Forms.Padding(4);
+ this.ux_image.Name = "ux_image";
+ this.ux_image.Size = new System.Drawing.Size(153, 105);
+ this.ux_image.TabIndex = 12;
+ this.ux_image.TabStop = false;
+ //
+ // 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(14, 311);
+ this.ux_cancel_button.Margin = new System.Windows.Forms.Padding(4);
+ this.ux_cancel_button.Name = "ux_cancel_button";
+ this.ux_cancel_button.Size = new System.Drawing.Size(356, 78);
+ this.ux_cancel_button.TabIndex = 11;
+ this.ux_cancel_button.Text = "Cancel";
+ this.ux_cancel_button.UseVisualStyleBackColor = true;
+ //
+ // ux_dont_update_button
+ //
+ this.ux_dont_update_button.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.ux_dont_update_button.Location = new System.Drawing.Point(14, 226);
+ this.ux_dont_update_button.Margin = new System.Windows.Forms.Padding(4);
+ this.ux_dont_update_button.Name = "ux_dont_update_button";
+ this.ux_dont_update_button.Size = new System.Drawing.Size(356, 78);
+ this.ux_dont_update_button.TabIndex = 10;
+ this.ux_dont_update_button.Text = "Do&n\'t Update";
+ this.ux_dont_update_button.UseVisualStyleBackColor = true;
+ //
+ // ux_update_button
+ //
+ this.ux_update_button.Enabled = false;
+ this.ux_update_button.Location = new System.Drawing.Point(13, 121);
+ this.ux_update_button.Margin = new System.Windows.Forms.Padding(4);
+ this.ux_update_button.Name = "ux_update_button";
+ this.ux_update_button.Size = new System.Drawing.Size(356, 78);
+ this.ux_update_button.TabIndex = 9;
+ this.ux_update_button.Text = "&Update";
+ this.ux_update_button.UseVisualStyleBackColor = true;
+ //
+ // check_for_updatescs
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(388, 403);
+ 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_dont_update_button);
+ this.Controls.Add(this.ux_update_button);
+ this.Name = "check_for_updatescs";
+ this.Text = "check_for_updatescs";
+ ((System.ComponentModel.ISupportInitialize)(this.ux_image)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.PictureBox ux_image;
+ private System.Windows.Forms.Button ux_cancel_button;
+ private System.Windows.Forms.Button ux_dont_update_button;
+ private System.Windows.Forms.Button ux_update_button;
+
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/updates/check_for_updates.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_views_in_to_the.cs
@@ -8,6 +8,7 @@ using MyMoney.Presentation.Views.Menu.Help;
using MyMoney.Presentation.Views.Navigation;
using MyMoney.Presentation.Views.Shell;
using MyMoney.Presentation.Views.Startup;
+using MyMoney.Presentation.Views.updates;
using MyMoney.Utility.Core;
namespace MyMoney.windows.ui
@@ -35,6 +36,7 @@ namespace MyMoney.windows.ui
register.transient<IAddNewIncomeView, add_new_income_view>();
register.transient<IViewIncomeHistory, view_all_income>();
register.transient<ISaveChangesView, save_changes_view>();
+ register.transient<ICheckForUpdatesView, Presentation.Views.updates.check_for_updates>();
}
}
}
\ No newline at end of file
trunk/src/MyMoney/MyMoney.csproj
@@ -192,8 +192,10 @@
<Compile Include="Domain\repositories\company_repository_extensions.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\ApplyLoggingInterceptor.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\component_exclusion_specification.cs" />
+ <Compile Include="Infrastructure\Container\Windsor\configuration\ConfigureComponentLifestyle.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\IComponentExclusionSpecification.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\ImplementationOfDependencyRegistry.cs" />
+ <Compile Include="Infrastructure\Container\Windsor\configuration\LogComponent.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\NoInterfaces.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\RegisterComponentContract.cs" />
<Compile Include="Infrastructure\Container\Windsor\configuration\SubclassesForm.cs" />
@@ -239,6 +241,7 @@
<Compile Include="Infrastructure\transactions\unit_of_work_registry.cs" />
<Compile Include="Infrastructure\transactions\unit_of_work_registry_specs.cs" />
<Compile Include="Infrastructure\transactions\unit_of_work_specs.cs" />
+ <Compile Include="Presentation\Core\could_not_find_presenter.cs" />
<Compile Include="Presentation\Core\IContentPresenter.cs" />
<Compile Include="Presentation\Databindings\date_time_picker_property_binding.cs" />
<Compile Include="Presentation\Databindings\date_time_property_binding_specs.cs" />
@@ -421,6 +424,12 @@
<Compile Include="Presentation\Views\Shell\notification_icon_view.cs" />
<Compile Include="Presentation\Views\Shell\task_tray_message.cs" />
<Compile Include="Presentation\Views\Shell\title_bar.cs" />
+ <Compile Include="Presentation\Views\updates\check_for_updates.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Presentation\Views\updates\check_for_updates.Designer.cs">
+ <DependentUpon>check_for_updates.cs</DependentUpon>
+ </Compile>
<Compile Include="Presentation\Views\updates\ICheckForUpdatesView.cs" />
<Compile Include="Tasks\application\billing_tasks.cs" />
<Compile Include="Tasks\application\customer_tasks.cs" />
@@ -599,6 +608,9 @@
<DependentUpon>window_shell.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Presentation\Views\updates\check_for_updates.resx">
+ <DependentUpon>check_for_updates.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>