Commit 5dae42c
Changed files (12)
trunk
product
MyMoney
Presentation
Model
Menu
Help
Presenters
Views
Tasks
infrastructure
trunk/product/MyMoney/Presentation/Model/Menu/Help/help_menu.cs → trunk/product/MyMoney/Presentation/Model/Menu/Help/HelpMenu.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using MoMoney.Presentation.Model.Menu.Help.commands;
using MoMoney.Presentation.Presenters.Commands;
+using MoMoney.Presentation.Presenters.Shell;
using MoMoney.Presentation.Presenters.updates;
using MoMoney.Presentation.Resources;
@@ -10,11 +11,11 @@ namespace MoMoney.Presentation.Model.Menu.Help
{
}
- public class help_menu : IHelpMenu
+ public class HelpMenu : IHelpMenu
{
readonly IRunPresenterCommand command;
- public help_menu(IRunPresenterCommand command)
+ public HelpMenu(IRunPresenterCommand command)
{
this.command = command;
}
@@ -33,6 +34,14 @@ namespace MoMoney.Presentation.Model.Menu.Help
.named("Check For Updates...")
.that_executes(() => command.run<ICheckForUpdatesPresenter>())
.build();
+
+ yield return create.a_menu_item_separator();
+
+ yield return create
+ .a_menu_item()
+ .named("View Log File")
+ .that_executes(() => command.run<ILogFilePresenter>())
+ .build();
}
public string name
trunk/product/MyMoney/Presentation/Presenters/Shell/LogFilePresenter.cs
@@ -0,0 +1,33 @@
+using MoMoney.Presentation.Core;
+using MoMoney.Presentation.Views.core;
+using MoMoney.Presentation.Views.Shell;
+using MoMoney.Tasks.infrastructure;
+
+namespace MoMoney.Presentation.Presenters.Shell
+{
+ public interface ILogFilePresenter : IContentPresenter
+ {
+ }
+
+ public class LogFilePresenter : ILogFilePresenter
+ {
+ readonly ILogFileView view;
+ readonly ILogFileTasks tasks;
+
+ public LogFilePresenter(ILogFileView view, ILogFileTasks tasks)
+ {
+ this.view = view;
+ this.tasks = tasks;
+ }
+
+ public void run()
+ {
+ view.display(tasks.get_the_contents_of_the_log_file());
+ }
+
+ IDockedContentView IContentPresenter.View
+ {
+ get { return view; }
+ }
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Shell/LogFileViewPresenterSpecs.cs
@@ -0,0 +1,35 @@
+using jpboodhoo.bdd.contexts;
+using MoMoney.Presentation.Views.Shell;
+using MoMoney.Tasks.infrastructure;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+
+namespace MoMoney.Presentation.Presenters.Shell
+{
+ public class behaves_like_log_file_presenter : concerns_for<ILogFilePresenter, LogFilePresenter>
+ {
+ context c = () =>
+ {
+ view = the_dependency<ILogFileView>();
+ tasks = the_dependency<ILogFileTasks>();
+ };
+
+ static protected ILogFileView view;
+ static protected ILogFileTasks tasks;
+ }
+
+ public class when_displaying_the_log_file : behaves_like_log_file_presenter
+ {
+ it should_display_the_contents_of_the_log_file = () => view.was_told_to(x => x.display(log_file_contents));
+
+ context c = () =>
+ {
+ log_file_contents = "hello_jello";
+ tasks.is_told_to(x => x.get_the_contents_of_the_log_file()).it_will_return(log_file_contents);
+ };
+
+ because b = () => sut.run();
+
+ static string log_file_contents;
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/helpers/EventTriggerSpecs.cs
@@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using jpboodhoo.bdd.contexts;
-using MbUnit.Framework;
using MoMoney.Testing.spechelpers.contexts;
using MoMoney.Testing.spechelpers.core;
@@ -29,14 +28,14 @@ namespace MoMoney.Presentation.Views.helpers
{
it should_make_the_call_correctly = () => control.key_press_arguments.should_be_equal_to(args);
- [Test]
- public void should_make_the_call_correctly2()
- {
- var new_args = new KeyPressEventArgs('A');
- control = new TestControl();
- EventTrigger.trigger_event<Events.ControlEvents>(x => x.OnKeyPress(new_args), control);
- control.key_press_arguments.should_be_equal_to(new_args);
- }
+ //[Test]
+ //public void should_make_the_call_correctly2()
+ //{
+ // var new_args = new KeyPressEventArgs('A');
+ // control = new TestControl();
+ // EventTrigger.trigger_event<Events.ControlEvents>(x => x.OnKeyPress(new_args), control);
+ // control.key_press_arguments.should_be_equal_to(new_args);
+ //}
context c = () => { control = new TestControl(); };
trunk/product/MyMoney/Presentation/Views/Shell/ILogFileView.cs
@@ -0,0 +1,9 @@
+using MoMoney.Presentation.Views.core;
+
+namespace MoMoney.Presentation.Views.Shell
+{
+ public interface ILogFileView : IDockedContentView
+ {
+ void display(string contents);
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/LogFileView.cs
@@ -0,0 +1,17 @@
+using MoMoney.Presentation.Views.core;
+
+namespace MoMoney.Presentation.Views.Shell
+{
+ public partial class LogFileView : ApplicationDockedWindow, ILogFileView
+ {
+ public LogFileView()
+ {
+ InitializeComponent();
+ }
+
+ public void display(string contents)
+ {
+ ux_log_file.Text = contents;
+ }
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/LogFileView.Designer.cs
@@ -0,0 +1,60 @@
+namespace MoMoney.Presentation.Views.Shell
+{
+ partial class LogFileView
+ {
+ /// <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_log_file = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // ux_log_file
+ //
+ this.ux_log_file.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.ux_log_file.Location = new System.Drawing.Point(0, 0);
+ this.ux_log_file.Multiline = true;
+ this.ux_log_file.Name = "ux_log_file";
+ this.ux_log_file.Size = new System.Drawing.Size(292, 266);
+ this.ux_log_file.TabIndex = 0;
+ //
+ // LogFileView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(292, 266);
+ this.Controls.Add(this.ux_log_file);
+ this.Name = "LogFileView";
+ this.Text = "LogFileView";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ public System.Windows.Forms.TextBox ux_log_file;
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/LogFileView.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/product/MyMoney/Tasks/infrastructure/LogFileTasks.cs
@@ -0,0 +1,18 @@
+using System.IO;
+using MoMoney.Infrastructure.Extensions;
+
+namespace MoMoney.Tasks.infrastructure
+{
+ public interface ILogFileTasks
+ {
+ string get_the_contents_of_the_log_file();
+ }
+
+ public class LogFileTasks : ILogFileTasks
+ {
+ public string get_the_contents_of_the_log_file()
+ {
+ return File.ReadAllText(Path.Combine(this.startup_directory(), "logs/log.txt"));
+ }
+ }
+}
\ No newline at end of file
trunk/product/MyMoney/windows.ui/global_error_handling.cs
@@ -1,4 +1,6 @@
using System;
+using System.Globalization;
+using System.Threading;
using System.Windows.Forms;
using MoMoney.Infrastructure.Container;
using MoMoney.Infrastructure.eventing;
@@ -13,6 +15,7 @@ namespace MoMoney.windows.ui
{
public void run()
{
+ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += (sender, e) => handle_error(e.Exception);
trunk/product/MyMoney/windows.ui/wire_up_the_views_in_to_the.cs
@@ -45,6 +45,7 @@ namespace MoMoney.windows.ui
register.transient<IStatusBarView, StatusBarView>();
register.transient<IUnhandledErrorView, UnhandledErrorView>();
register.transient<IGettingStartedView, WelcomeScreen>();
+ register.transient<ILogFileView, LogFileView>();
}
}
trunk/product/MyMoney/MyMoney.csproj
@@ -367,6 +367,8 @@
<Compile Include="Presentation\Presenters\Shell\GettingStartedModuleSpecs.cs" />
<Compile Include="Presentation\Presenters\Shell\GettingStartedPresenter.cs" />
<Compile Include="Presentation\Presenters\Shell\GettingStartedPresenterSpecs.cs" />
+ <Compile Include="Presentation\Presenters\Shell\LogFilePresenter.cs" />
+ <Compile Include="Presentation\Presenters\Shell\LogFileViewPresenterSpecs.cs" />
<Compile Include="Presentation\Presenters\Shell\ToolBarPresenter.cs" />
<Compile Include="Presentation\Presenters\Navigation\MainMenuPresenter.cs" />
<Compile Include="Presentation\Presenters\Navigation\NavigationPresenter.cs" />
@@ -478,10 +480,17 @@
<Compile Include="Presentation\Views\Shell\BitmapRegion.cs" />
<Compile Include="Presentation\Views\Shell\button_extensions.cs" />
<Compile Include="Presentation\Views\Shell\IGettingStartedView.cs" />
+ <Compile Include="Presentation\Views\Shell\ILogFileView.cs" />
<Compile Include="Presentation\Views\Shell\INotificationIconView.cs" />
<Compile Include="Presentation\Views\Shell\IShell.cs" />
<Compile Include="Presentation\Views\Shell\IStatusBarView.cs" />
<Compile Include="Presentation\Views\Shell\IUnhandledErrorView.cs" />
+ <Compile Include="Presentation\Views\Shell\LogFileView.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Presentation\Views\Shell\LogFileView.Designer.cs">
+ <DependentUpon>LogFileView.cs</DependentUpon>
+ </Compile>
<Compile Include="Presentation\Views\Shell\NotificationIconView.cs" />
<Compile Include="Presentation\Views\Shell\StatusBarView.cs" />
<Compile Include="Presentation\Views\Shell\TaskTrayMessage.cs" />
@@ -509,6 +518,7 @@
<Compile Include="Tasks\application\CustomerTasks.cs" />
<Compile Include="Tasks\infrastructure\FileSystemTasks.cs" />
<Compile Include="Tasks\application\IncomeTasks.cs" />
+ <Compile Include="Tasks\infrastructure\LogFileTasks.cs" />
<Compile Include="Tasks\infrastructure\UpdateTasks.cs" />
<Compile Include="Testing\MetaData\IntegrationAttribute.cs" />
<Compile Include="Testing\spechelpers\contexts\concerns_for.cs" />
@@ -563,7 +573,7 @@
<Compile Include="Presentation\Core\IPresentationModule.cs" />
<Compile Include="Utility\Extensions\RegistryExtensions.cs" />
<Compile Include="Presentation\Model\Menu\File\FileMenu.cs" />
- <Compile Include="Presentation\Model\Menu\Help\help_menu.cs" />
+ <Compile Include="Presentation\Model\Menu\Help\HelpMenu.cs" />
<Compile Include="Utility\Core\ISpecification.cs" />
<Compile Include="Utility\Core\Map.cs" />
<Compile Include="Utility\Core\or_specification.cs" />
@@ -691,6 +701,9 @@
<DependentUpon>ApplicationShell.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Presentation\Views\Shell\LogFileView.resx">
+ <DependentUpon>LogFileView.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Presentation\Views\Shell\UnhandledErrorView.resx">
<DependentUpon>UnhandledErrorView.cs</DependentUpon>
</EmbeddedResource>