Commit bbfd821
Changed files (9)
trunk
product
MyMoney
Infrastructure
Extensions
Presentation
Presenters
Commands
Startup
Views
core
Startup
trunk/product/MyMoney/Infrastructure/Extensions/threading_extensions.cs → trunk/product/MyMoney/Infrastructure/Extensions/ThreadingExtensions.cs
@@ -3,7 +3,7 @@ using MoMoney.Utility.Core;
namespace MoMoney.Infrastructure.Extensions
{
- public static class threading_extensions
+ public static class ThreadingExtensions
{
public static IBackgroundThread on_a_background_thread(this IDisposableCommand command)
{
trunk/product/MyMoney/Infrastructure/Threading/IntervalTimer.cs
@@ -15,6 +15,10 @@ namespace MoMoney.Infrastructure.Threading
readonly ITimerFactory factory;
readonly IDictionary<ITimerClient, Timer> timers;
+ public IntervalTimer() : this(new TimerFactory())
+ {
+ }
+
public IntervalTimer(ITimerFactory factory)
{
this.factory = factory;
@@ -26,7 +30,7 @@ namespace MoMoney.Infrastructure.Threading
stop_notifying(client_to_be_notified);
var timer = factory.create_for(span);
- timer.Elapsed += ((sender, args) => client_to_be_notified.notify());
+ timer.Elapsed += (sender, args) => client_to_be_notified.notify();
timer.Start();
timers[client_to_be_notified] = timer;
}
trunk/product/MyMoney/Infrastructure/Threading/SynchronizedContext.cs
@@ -14,7 +14,8 @@ namespace MoMoney.Infrastructure.Threading
public void run(ICommand item)
{
- context.Post(x => item.run(), new object());
+ //context.Post(x => item.run(), new object());
+ context.Send(x => item.run(), new object());
}
}
}
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/Threading/ThreadSafeInterceptor.cs
@@ -1,4 +1,5 @@
using Castle.Core.Interceptor;
+using MoMoney.Infrastructure.Extensions;
using MoMoney.Infrastructure.interceptors;
using MoMoney.Utility.Core;
@@ -23,6 +24,7 @@ namespace MoMoney.Infrastructure.Threading
public void Intercept(IInvocation invocation)
{
+ this.log().debug("running synchronized command: {0}", invocation.Method);
factory.create().run(new ActionCommand(invocation.Proceed));
}
}
trunk/product/MyMoney/Presentation/Presenters/Commands/display_the_splash_screen.cs
@@ -20,7 +20,6 @@ namespace MoMoney.Presentation.Presenters.Commands
public void Dispose()
{
- presenter().run("Complete");
presenter().Dispose();
}
}
trunk/product/MyMoney/Presentation/Presenters/Startup/SplashScreenPresenter.cs
@@ -15,7 +15,7 @@ namespace MoMoney.Presentation.Presenters.Startup
readonly ISplashScreenView view;
ISplashScreenState current_state;
- public SplashScreenPresenter() : this(new IntervalTimer(new TimerFactory()), new SplashScreenView())
+ public SplashScreenPresenter() : this(new IntervalTimer(), new SplashScreenView())
{
}
trunk/product/MyMoney/Presentation/Views/core/ApplicationWindow.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
+using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using MoMoney.Infrastructure.Extensions;
@@ -27,6 +28,7 @@ namespace MoMoney.Presentation.Views.core
this.log().debug("created {0}", GetType());
context = SynchronizationContext.Current;
operation = AsyncOperationManager.CreateOperation(null);
+ Debug.Assert(null != context, "The Synchronization Context is not there");
}
public IApplicationWindow create_tool_tip_for(string title, string caption, Control control)
@@ -58,8 +60,9 @@ namespace MoMoney.Presentation.Views.core
protected void on_ui_thread(Action action)
{
- context.Post(x => action(), new object());
- //action();
+ //context.Post(x => action(), new object());
+ //context.Send(x => action(), new object());
+ action();
//operation.Post(x => action(), new object());
//if (InvokeRequired)
//{
trunk/product/MyMoney/Presentation/Views/Startup/SplashScreenView.Designer.cs
@@ -27,22 +27,13 @@ namespace MoMoney.Presentation.Views.Startup {
/// </summary>
private void InitializeComponent()
{
- this.progress_bar = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
- // progress_bar
- //
- this.progress_bar.Location = new System.Drawing.Point(8, 225);
- this.progress_bar.Name = "progress_bar";
- this.progress_bar.Size = new System.Drawing.Size(272, 26);
- this.progress_bar.TabIndex = 0;
- //
// SplashScreenView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(282, 255);
- this.Controls.Add(this.progress_bar);
this.Name = "SplashScreenView";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -53,7 +44,6 @@ namespace MoMoney.Presentation.Views.Startup {
#endregion
- private System.Windows.Forms.ProgressBar progress_bar;
}
}
\ No newline at end of file
trunk/product/MyMoney/MyMoney.csproj
@@ -236,7 +236,7 @@
<Compile Include="Infrastructure\eventing\EventAggregatorSpecs.cs" />
<Compile Include="Infrastructure\eventing\IEvent.cs" />
<Compile Include="Infrastructure\eventing\IEventSubscriber.cs" />
- <Compile Include="Infrastructure\Extensions\threading_extensions.cs" />
+ <Compile Include="Infrastructure\Extensions\ThreadingExtensions.cs" />
<Compile Include="Infrastructure\interceptors\Lazy.cs" />
<Compile Include="Infrastructure\interceptors\LazySpecs.cs" />
<Compile Include="Infrastructure\interceptors\LazyLoadedInterceptor.cs" />